1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

[ATMEGA] LCD PWM LED and Contrast

Discussion in 'General Electronics Chat' started by Pol, Dec 31, 2008.

  1. Pol

    Pol New Member

    Joined:
    Dec 31, 2008
    Messages:
    11
    Likes:
    0
    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: Dec 31, 2008
  2. Boncuk

    Boncuk New Member

    Joined:
    Nov 10, 2007
    Messages:
    5,382
    Likes:
    88
    Location:
    Phetchabun,Thailand
    Why would you PWM contrast? Once set it will stay there. For the backlight use PB3 (MOSI).
     
    Last edited: Dec 31, 2008
  3. Pol

    Pol New Member

    Joined:
    Dec 31, 2008
    Messages:
    11
    Likes:
    0
    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?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Boncuk

    Boncuk New Member

    Joined:
    Nov 10, 2007
    Messages:
    5,382
    Likes:
    88
    Location:
    Phetchabun,Thailand

    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
     

    Attached Files:

    • BL.gif
      BL.gif
      File size:
      14.7 KB
      Views:
      3,507
    Last edited: Dec 31, 2008
  6. Pol

    Pol New Member

    Joined:
    Dec 31, 2008
    Messages:
    11
    Likes:
    0
    Thanks a lot.
    I can use this same connect for contrast?
     
  7. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    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
     
  8. Boncuk

    Boncuk New Member

    Joined:
    Nov 10, 2007
    Messages:
    5,382
    Likes:
    88
    Location:
    Phetchabun,Thailand
    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.
     

Share This Page