1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Electronics PWM for LCD contrast?

Discussion in 'Modding' started by ch424, 6 Mar 2006.

  1. ch424

    ch424 Design Warrior

    Joined:
    26 May 2004
    Posts:
    3,112
    Likes Received:
    41
    Does anyone know if I can use PWM instead of a pot to have digital control over the contrast of an HD44780 LCD, or is it more complicated than that?

    I assume I'd have to have a high resolution (<1ms?) to make it work, but would PWM actually work at all?

    This is just an idea my friend had to use up one of the spare PIC pins on my AS project, so it's not too crucial!

    Thanks for any info,

    ch424
     
  2. freemc

    freemc What's a Dremel?

    Joined:
    20 Feb 2006
    Posts:
    17
    Likes Received:
    0
    I think if it is backlighted with led's it shouldn't be a problem. Just make sure that the time for one complete cycle is less than 50ms. Normally a 6bit resolution should be more than enough. So then your frequency would have to be higher than 20*2^6
     
  3. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    Most LCD's do not like PWM at all on the contrast pin so I can't recommend it. Usually a digital potentiometer would be used.
     
  4. ch424

    ch424 Design Warrior

    Joined:
    26 May 2004
    Posts:
    3,112
    Likes Received:
    41
    freemc, I'm changing the contrast, not the backlight.

    SteveyG, thanks, I'm not really bothered about it, just wondering if it's possible with no/few extra components. An analogue pot will do fine for now ;) A quick search gives this lot, so I can add one in the future if I change my mind!

    Thanks again,

    ch424
     
  5. Turbokeu

    Turbokeu Minimodder

    Joined:
    30 Jul 2002
    Posts:
    347
    Likes Received:
    2
    PWM should be possible if the PWM output is followed by a 47k serial resistor-1µF parallel capacitor (integrator?) to smoothen out the PWM signal and convert it to a DC level.
    Most character LCD's need a contrast voltage of about +4.5V for optimal contrast.

    CD :)
     
  6. ch424

    ch424 Design Warrior

    Joined:
    26 May 2004
    Posts:
    3,112
    Likes Received:
    41
    Yeah, I initially thought that, but then I realised that if the mark/space ratio is going to change, the cap and resistor values will no longer match the time perioid. Is this correct?

    ch424
     
  7. Turbokeu

    Turbokeu Minimodder

    Joined:
    30 Jul 2002
    Posts:
    347
    Likes Received:
    2
    Not at all...
    I used the 47k-1µF integrator to produce a 0 to 5VDC voltage from a 15 to 50kHz PWM signal with a duty cycle ranging from 0 to 100%.
    As long as the integrator isn't charged with a low impedance the DC output voltage is quite linear and smooth.

    CD :)
     
  8. ch424

    ch424 Design Warrior

    Joined:
    26 May 2004
    Posts:
    3,112
    Likes Received:
    41
    Awesome, thanks. I'll give it a go!

    ch424
     
  9. freemc

    freemc What's a Dremel?

    Joined:
    20 Feb 2006
    Posts:
    17
    Likes Received:
    0
    woops, sorry I misread, **** happens... :wallbash:
     

Share This Page