Having trouble with my LCD screen. It's the regular 16x2 5V one that comes with the arduino Uno starter kit.
The background is lit up just fine. When I connect the contrast pin (3) to a potentiometer the words are only just barely visible at the minimum resistance. It looks the same when I connect that contrast pin straight to ground.
Weirdly when I quickly disconnect and reconnect the power it throws random words on the screen that are very bright and visible. But I can't seem to get it to do that for me normally.
Also, this was not the case with my Arduino Uno using 3.3V (it worked just fine). Now I am using a Dragonfly STM32L476 on 3.3V and I'm having this problem. Here's my code, very simple:
Are you running the LCD at 3v? If so, run the LCD at 5v.
You don't need to run the LCD at 3v to interface with 3v processor outputs.
The LCD at 5v will still see logic H for a 3.3 v H signal output.
First check the integrity of your LCD: reconnect it to your 'old' Arduino Uno and run the 'hello World' sketch for the LCD
then reconnect to the Dragonfly STM32L476
I checked your constructor (LiquidCrystal lcd(8, 7, 5, 4, 3, 2)). For the Uno, it is usually LiquidCrystal lcd (12,11 7, 5, 4, 3, 2).
The pins used, even if incorrect, is not going to affect the contrast of the LCD.
doodlestj said he could see the words which means that pin mapping is correct.
you can't alter the contrast on this type of LCD h/w with s/w on the host.
The reason the pixels get bright after power is yanked is that the LCD reverts back to its default mode which is 8 bit mode and single line. The garbage is from the LCD being out of sync with the host on the interface so it is not seeing proper instructions.
In single line mode the LCD pixels get twice the duty cycle and will appear brighter given the same contrast input voltage than multi line mode.
Given the symptoms presented so far, it looks to me like a 5v LCD is being run off 3v instead of 5v.
Scroll down on this link and you can see the pin out of my board:
I believe all of the pins 2-8 that I'm using are digital output which works
I don't think my board has a 5V? Correct me if I'm wrong. I would've assumed that the issue was that I'm using 3.3V but when I connect everything to my Uno at 3.3V the LCD works fine
bperrybap:
The pins used, even if incorrect, is not going to affect the contrast of the LCD.
doodlestj said he could see the words which means that pin mapping is correct.
you can't alter the contrast on this type of LCD h/w with s/w on the host.
The reason the pixels get bright after power is yanked is that the LCD reverts back to its default mode which is 8 bit mode and single line. The garbage is from the LCD being out of sync with the host on the interface so it is not seeing proper instructions.
In single line mode the LCD pixels get twice the duty cycle and will appear brighter given the same contrast input voltage than multi line mode.
Given the symptoms presented so far, it looks to me like a 5v LCD is being run off 3v instead of 5v.
--- bill
This is good info. I changed my code to set up the LCD as only one line and the contrast is great...
So how can I keep this with two lines? I'm unsure how to give V0 negative voltage
doodlestj:
This is good info. I changed my code to set up the LCD as only one line and the contrast is great...
So how can I keep this with two lines? I'm unsure how to give V0 negative voltage
You can't.
As the LCD chip has to drive more rows of pixels it takes more time .
doodlestj:
I don't think my board has a 5V? Correct me if I'm wrong. I would've assumed that the issue was that I'm using 3.3V but when I connect everything to my Uno at 3.3V the LCD works fine
Measure the actual voltage being fed to the LCD. I'm guessing it is a little bit higher when using the UNO.
As the voltage gets lower on the 5v lcd, the contrast voltage will also drop and at some point you will need a negative voltage to get good contrast.
You likely will need a 3v LCD device for this unless you can generate the negative voltage.
bperrybap:
You can't.
As the LCD chip has to drive more rows of pixels it takes more time .
Measure the actual voltage being fed to the LCD. I'm guessing it is a little bit higher when using the UNO.
As the voltage gets lower on the 5v lcd, the contrast voltage will also drop and at some point you will need a negative voltage to get good contrast.
You likely will need a 3v LCD device for this unless you can generate the negative voltage.
--- bill
I measured the voltage (at the microcontroller, do I need to measure it at the LCD?) and both Uno and Dragonfly were 3.26V
Can you explain how to get a negative voltage to the V0 pin? Or also if you know a good 3V LCD I might just buy that
Sorry I guess I was wrong - when I measure the voltage with the Uno it's 4.1V and 3.26V with the Dragonfly. If that's the problem then I guess I need a 3V LCD screen
If the UNO was at 5v then yes 4.1v is too high for a 3v power level.
However, you should not be running the LCD at a lower voltage than the output signal voltage of the processor.
i.e. if the processor is outputting 5v signals to control the LCD then the LCD needs to run at 5v.
bperrybap:
And this is when running the UNO at 3v?
If the UNO was at 5v then yes 4.1v is too high for a 3v power level.
However, you should not be running the LCD at a lower voltage than the output signal voltage of the processor.
i.e. if the processor is outputting 5v signals to control the LCD then the LCD needs to run at 5v.
--- bill
Yes I have the wire coming from the 3.3V pin on the Uno