wokwi / wokwi-elements

Web Components for Electronics and IoT Parts
https://elements.wokwi.com/
MIT License
185 stars 50 forks source link

LCD V0 for contrast turns off backlight #127

Closed Koepel closed 2 years ago

Koepel commented 2 years ago

A normal LCD display (not with I2C backpack) has a contrast pin 3 called "V0". Often a 10k potentiometer is used for it. It is little known that it has a internal resistor to a positive voltage, therefor a resistor to GND is all that is needed for the contrast.

Here is my test project: https://wokwi.com/projects/328962883622797906

The contrast should not control the backlight and the display should work with the two used circuits (potentiometer at V0 or a resistor to GND).

afbeelding

Koepel commented 2 years ago

I found the bug because of this topic in the Arduino forum: https://forum.arduino.cc/t/lcd-display-not-working-correctly/981088/ As you can read over there, the correct way for the contrast is a potentiometer of 1k to GND (not to 5V). A selected fixed resistor will also often work.

Almost everyone does it wrong in the real world, but that does not mean that we can't do it right in a simulation. This is the right way (no 5V to the potentiometer): afbeelding

urish commented 2 years ago

Thanks for pointing this out!

We do not simulate contrast at the moment (maybe we should? I think can be more confusing than helpful, but that's just my opinion).

I'll switch the backlight to be controlled by the A/K pins (not sure why I mixed them up with V0 at the first place)

urish commented 2 years ago

I'll switch the backlight to be controlled by the A/K pins (not sure why I mixed them up with V0 at the first place)

Done, mind having a look?

p.s. thanks for creating this awesome reproduction playground, it's really helpful!

Koepel commented 2 years ago

It works. Thank you.

I found the limit. The internal pullup resistor of a Arduino Uno with pinMode( pin, INPUT_PULLUP) can turn the backlight on when directly connected to the Anode. When there is a resistor to the Anode, then it does not turn the backlight on.

Contrast simulation is not needed.