2004A LCD works but doesn't display what I programmed

I’m trying to get my 2004A LCD to work with my Arduino Uno and display a simple message but whenever it’s turned on, it boots up showing the first and third rows filled entirely with blocks for a couple of seconds, and then it disappears (backlight still on of course) so it can’t be a contrast issue.

If I swap out the LCD with a 1602A LCD it works just fine and displays my message (obviously with lcd.begin modified for the appropriate columns and rows).
Here’s the code I am using:

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11 , 12);

void setup() {
lcd.begin(20, 4);
lcd.setCursor(0,2);
lcd.write(“Hello, PENIS”);
}

void loop() { }

From my understanding, the pins have to be connected in the exact same way as the 1602A LCD is so I’m hoping that’s not the issue.

VSS to Ground
VDD to +5V
VO to to middle pin of 50k potentiometer (with first and last pins of the potmeter connected to ground also)
RS to Pin 7 of Arduino
RW to Ground
E to to Pin 8 of Arduino
D0 don’t use (what the heck is this for?)
D1 don’t use (what the heck is this for?)
D2 don’t use (what the heck is this for?)
D3 don’t use (what the heck is this for?)
D4 to Pin 9 of Arduino
D5 to Pin 10 of Arduino
D6 to Pin 11 of Arduino
D7 to Pin 12 of Arduino
K to +5V
A to Ground

So what am I doing wrong? Why does the 1602A LCD display my message and the 2004A does not?

Try lcd.setCursor(0.0) just as you would for the 1602.

No change when using lcd.setCursor(0.0).

Are the pins on the 2004 labelled?- maybe you've misinterpreted which is which... While it might well be true that for instance LCD D5 goes to Arduino 10, are you sure it's the LCD's D5 in the first place?

And this intrigues me...

with first and last pins of the potmeter connected to ground also

JimboZA: Are the pins on the 2004 labelled?- maybe you've misinterpreted which is which... While it might well be true that for instance LCD D5 goes to Arduino 10, are you sure it's the LCD's D5 in the first place?

And this intrigues me...

with first and last pins of the potmeter connected to ground also

The pins on the 2004A are not labelled. But the HD44870 demo board that came with it is and it has the same configuration as the 1602A LCD. I've seen a few photos people have taken of their 2004A working fine by simply overlapping the holes of both together and sliding pins through so I'm certain the pin arrangement on the 2004A is the same.

Here's the reference picture by which I'm talking about and that happens to be the ebay listing I got it from in case it is relevant somehow. http://www.ebay.com.au/itm/2004-LCD-Character-LCD-White-on-Blue-HD44780-20X4-PIC-Arduino-AVR-AU-Stock-/181236070886?pt=AU_B_I_Electrical_Test_Equipment&hash=item2a3282f9e6&_uhb=1

Also, no I haven't connected a pin wrongly since all the pins are connected to a pin header which I then plug into holes on 1602A or 2004A.

In regards to your comment about the way my potmeter is connected, I followed the instructions from this page: http://www.dreamdealer.nl/tutorials/connecting_a_1602a_lcd_display_and_a_light_sensor_to_arduino_uno.html If it's wrongly connected then I'm a little confused because it works fine in adjusting the contrast on both my LCDs.

I use a 20x4 as follows on my Uno:

//pin SDA on lcd to Arduino Analog pin 4 //pin SCL on lcd to Arduino Analog pin 5 //pin GND on lcd to Arduino GND //pin VCC on lcd to Arduino 5v

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); // translates to (rs,rw,e,d4,d5,d6,d7 on lcd) int backLight = 13; // a pot connected between pin 13 of Arduino Uno and LCD pin 15 (or 'A') will control the backlight

//pin 16 of lcd tied to a Uno gnd //pin 3 or 'VO' on lcd is connected to a pot and then to gnd on Uno for contrast control

I hope I haven't missed anything.

Connect: first pin of the potmeter > GND of the breadboard Connect: middle pin of the potmeter > pin 3 of the LCD display (VO)

It doesn't say connect the 3rd pin to ground anywhere I can see. I think the photo might be deceptive, or wrong.

arduinodlb: Connect: first pin of the potmeter > GND of the breadboard Connect: middle pin of the potmeter > pin 3 of the LCD display (VO)

It doesn't say connect the 3rd pin to ground anywhere I can see. I think the photo might be deceptive, or wrong.

Yeah, you're right. I just went by these photos in regards to the last pin: http://img.dreamdealer.nl/dd/arduino1/006.jpg http://img.dreamdealer.nl/dd/arduino1/012.jpg

I can adjust the contrast on both LCDs just fine with the way it is connected like that. Not saying it isn't wrong but unless someone has a technical explanation it seems to be the right way to do it?

It’s unclear to me whether VO (or is it V0… “oh” vs “zero”) is a ground or a voltage input.

If it’s an input, then grounding it through a pot doesn’t make sense to me. For it to work, then the other side of the pot needs to be at V+ and the wiper provides a voltage between 0 and V+.

If it’s a ground (and V+ is the supply on pin 2 Vdd) then only one side of the pot must be at ground, to get the full range of the resistance of the pot, then acting as a simple variable resistor. A 50k pot grounded both sides, gives a very flat resistance curve, with a max of 12.5. It’s even worse with a 10k, which is at about 2-2.5 along most of the range.

EDIT… just checked my 1602 (a DFR0009), which has a built in pot. Its schematic shows the VO on the wiper of a pot between 0v (Vss) and 5v (Vdd). Try that…

MORE EDIT… Attached snip from my 1602 datasheet which shows the pot.

1602 variable resistor.jpg

JimboZA:
It’s unclear to me whether VO (or is it V0… “oh” vs “zero”) is a ground or a voltage input.

If it’s an input, then grounding it through a pot doesn’t make sense to me. For it to work, then the other side of the pot needs to be at V+ and the wiper provides a voltage between 0 and V+.

If it’s a ground (and V+ is the supply on pin 2 Vdd) then only one side of the pot must be at ground, to get the full range of the resistance of the pot, then acting as a simple variable resistor. A 50k pot grounded both sides, gives a very flat resistance curve, with a max of 12.5. It’s even worse with a 10k, which is at about 2-2.5 along most of the range.

EDIT… just checked my 1602 (a DFR0009), which has a built in pot. Its schematic shows the VO on the wiper of a pot between 0v (Vss) and 5v (Vdd). Try that…

MORE EDIT… Attached snip from my 1602 datasheet which shows the pot.

The potentiometer was always connected just fine, exactly the way that diagram shows it is. I just tested without the 3rd pin being connected to anything and it works okay.
Regardless, this seems completely irrelevant to the problem that I’m having which is getting the 2004A LCD to display my message.

I forgot to make mention of my sketch entries supporting the lcd:

int backLight = 13; // pin 13 will control the backlight

void setup() {
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH);
lcd.begin(20, 4);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“anything”);
}

From your original post:

VO to to middle pin of 50k potentiometer (with first and last pins of the potmeter connected to ground also)

The ends of the potentiometer go to +5V and GND and the center terminal goes to pin 3 of the LCD module.

Here my generic step by step approach that should work:

(1) If the module has a backlight then get it working properly. This involves only pins 15 and 16 on your LCD module. Make sure to use a current limiting resistor if there is none on the LCD module.

(2) Get the power and contrast working properly. This involves only pins 1, 2, and 3 on your LCD module. You should be able to see blocks on one row of a two row display and on two rows of a four row display.

NOTE: The Arduino has not been used yet, except as a possible source for the power needed for the first two steps. Do not try to go any further until this is working. If you don’t see the blocks then no amount of program code will help.

(3) Connect the LCD R/W pin (pin 5) to GND.

(4) Connect the six control and data wires between your LCD module and your Arduino.

(5) Upload your sketch and it should work.

If you still don’t get a display then make sure that your wiring matches the numbers in the descriptor (or vice versa).

Code:

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // put your pin numbers here

If you get a display but it is garbled or has some other problems then try again with a ‘static’ sketch, one that displays a simple message on the top row of the display and then stops. All of your code should be in setup() and loop() should be empty between the brackets.

If you are still having problems then we need to see a photograph of your setup that clearly and unambiguously shows all of the connections between your Arduino and your LCD module.

Don

Just in case you missed it: Did you check this link form the page you linked to ? It shows a datasheet of that display (don't know for sure it is your display).

Whoops. So I finally got it working, turns out it is necessary to solder connections from the pins to the copper either on the back or front surfaces - there is almost no contact made just by keeping the pins lose and having them fit through the holes. Enough of them were making contact to supply power to the backlight but the ones necessary to receive information from the Arduino were obviously not touching.

Sorry for wasting everyone's time.

As for the potmeter connection, I'm still running the end wires to the ground and the middle wire to pin 3 of the LCD and it works fine in adjusting the contrast of the text. Yet I'm still being told to make one of the end connections to 5V. What difference would this make?

Sorry to second guess you experienced folks but I'm just concerned about potentially shorting something since it is working fine as it is (unless the way I have it setup now is already shorting something). Thoughts?

Glad you've got it working. Yep, unless they are purpose made connectors, you always need to solder things together to ensure proper electrical connection.

RE: your pot. In depends on how it's designed to be wired. If the circuit is just looking at middle pin resistance to ground, then grounding both external pins would work, but you'd have a different tapering since effectively, both sides of the pot become resistors in parallel. If it's supposed to have one side at 5V, then the pot acts as a voltage divider, probably into a signal pin. You really need to figure out how the circuit intends to have it wired up, then wire it up that way.

your description of V0 in your first post there is wrong.

As for the potmeter connection, I'm still running the end wires to the ground and the middle wire to pin 3 of the LCD and it works fine in adjusting the contrast of the text. Yet I'm still being told to make one of the end connections to 5V. What difference would this make?

As an "engineering wannabee", I'd mark that as a "fail". Imcomprehension of very elementary circuit theory.

The purpose of that pin 3 connection, is to supply a variable voltage between 0 and 5 volts to pin3, controlled by you, which somehow controls the contrast of the LCD.

Connecting both ends of the potentiometer to ground, would result in the voltage applied to pin 3 to be zero, no matter how you turned the knob. If you can see anything on there, you are just lucky.

The only way your method could possibly work, is if the chip itself was applying its own voltage to pin 3 from the inside, measuring the current, and deducing from that what the resistance to ground is, and therefore your potentiometer setting. I suppose it could be made to work that way, but I rather doubt that it is.

As an "engineering wannabee",

Well, at least he's honest.

EngineerWannabe: Whoops. So I finally got it working, turns out it is necessary to solder connections from the pins to the copper either on the back or front surfaces - there is almost no contact made just by keeping the pins lose and having them fit through the holes. Enough of them were making contact to supply power to the backlight but the ones necessary to receive information from the Arduino were obviously not touching.

As I read your further explanations, I was beginning to realise that was the problem.

If you are going to use temporary connections, get a box of toothpicks.

EngineerWannabe: Sorry for wasting everyone's time.

There is much to be said about that. :D

EngineerWannabe: As for the potmeter connection, I'm still running the end wires to the ground and the middle wire to pin 3 of the LCD and it works fine in adjusting the contrast of the text. Yet I'm still being told to make one of the end connections to 5V. What difference would this make?

Well, you are being told the correct way to do it. Sadly, not everything you see posted on the Internet is correct.

What is happening, is that the optimum contrast control voltage is actually very close to ground because it is the voltage between the 5V line and this that actually drives the display and it needs to be about 4.5 to 4.8V - which is why these displays will not operate from less than 5V and some require even more than that by providing a negative supply. Some displays in fact do operate from 3.3V by adding a charge pump to the PCB.

You are effectively connecting it to ground through a variable resistor with maximum resistance in the centre and you are making use of the fact that this pin sources some current from the 5V supply. The limitation however, is that current is dependent on how many segments are being activated, so the contrast will fluctuate as you change the text.

If you connect it as described, between 5V and ground, it will need to be set quite close to the ground end. If you wished finer control, this could be a potentiometer of say, 1K with ten times the value in series to the 5V, but in practice you do not need such fine control, the potentiometer will be set close to the ground end, and you save the extra resistor.

Well apart from the header pins not being attached, the real culprit of the piece was the linked explanation. In there it said it was going to explain how to attach all three pins of the pot, then only actually explained two, but showed the absurd connection of both ends to ground in the pix.

All good fun....