[ATMEGA] LCD PWM LED and Contrast

Pol

New Member
Hello,

Is possible to control LCD's(hd44780) contrast and backlight by PWM outputs in ATMEGA(8)? If yes , how to connect it?
 
Last edited:
Why would you PWM contrast? Once set it will stay there. For the backlight use PB3 (MOSI).
 
Last edited:
Ok, so Vo to 10k potentiometer. MOSI in my construction is for programming, I'm going to use PB1(OC1A) but I read somewhere that I must connect backlight via some transistor and some resistors - but what?
 
As you know the ATMEGA8 can sink only 10mA. The LED-backlight requires 100mA in some cases.

Connect a small N-channel MosFet (BS170) to the I/O port via a 100Ω resistor and connect the drain to the backlight cathode (-). Connect a current limiting resistor to backlight anode (+) according to display specifications.

MOSI is used for ISP in almost every application. Despite that you can use it during normal operation as a PWM output.

like that:

Boncuk
 

Attachments

  • BL.gif
    14.7 KB · Views: 3,827
Last edited:
Thanks a lot.
I can use this same connect for contrast?

hi,

I would not recommend that, the contrast would be a min or a max, so the LCD could be blank or black.
Use a 10K pot from +5V to 0v, wiper to contrast pin on the LCD. Adjust for optimum contrast
 
Thanks a lot.
I can use this same connect for contrast?

Once again: Why would one want to adjust contrast more than once? You might of course adjust it to blank the screen or make it fully black.

But again: For what reason?

Some industrially manufactured circuits don't even use a pot for contrast adjustment. (saving space and reducing cost)

Using a fixed voltage divider resulting in a Vee of 0.3 to 0.4V will set the contrast as well.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…