Using a 4x20 LCD with Arduino

Hello all,

Here I am back, trying to test my new setup of Arduino using a 4x20 LCD as output.

The idea is to monitor a car engine with Arduino.

Something is wrong in my construction.

The program is a simple test routine:

#include <LiquidCrystal.h>

/* LiquidCrystal display with:
LCD 4 (RS) to arduino pin 12
LCD 5 (R/W) to ground (pin 14)
LCD 6 (E) to arduino pin 11
LCD DB4, DB5, DB6, DB7 on arduino pins 7, 8, 9, 10 */

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

void setup()
{
lcd.begin(20,4);
lcd.clear();
lcd.setCursor(2,0); // Position cursor on line x=3,y=1
lcd.print("4x20 LCD DISPLAY"); // Print a message to the LCD
lcd.setCursor(4,1);
lcd.print("BBB Freeduino");
lcd.setCursor(4,2);
lcd.print("BUB programmer");
}

void loop()
{
}

The output I am getting is a double rows of black squares.

The setuo can be seen here:

Any ideas of what can be my mistake?

Tks in advance,

OldBeaver

Do you have the back-light wired up, and turned up bright enough?

Tks for yr help.

Yes, I do wired the backlit and contrast is working well. Both are working...

OldBeav

Hi Oldbeaver,

Did you try it with the contrast turned down so that the black squares are just visible?

BTW, the picture did not show up in your post, is this it?

Oldbeaver:

I am confused about 'R/W'. Is it grounded or is it connected to pin 14?

As I see it - if LCD pin 5 is grounded as mentioned here:

LCD 5 (R/W) to ground (pin 14)

then you shouldn't be mentioning pin 14 here:

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

Don

Dear Don and all,

Yes, the picture shown in yr post is the one.

Yes, I tried with the contrast all the way. The only thing that shows are the two lines of blocks, just as in the picture.

With reference to pin 14, let me check it again. Maybe it is the key ....

Thank you. I try and come back.

OldBeaver

Mem, Don and all,

Well, I checked the tech specs of the LCD and the setting of the pins for interfacing with Arduino are Ok.

I think I used the same setting when I first tested the LCD on a protoboard, and worked fine.

As a conclusion, I must have a wrong wiring now.

Let me double check that before making more clues...

Tks,

OldBeaver

Here is the system working with the test program.

Hope you can see the picture.

The mistake? The data plug was plugged to the wrong pins!

Next steps:

Test and adjust programs for 7 signals, first in the office.
Test the programs with the car signals.
Adjust signals impedance.
Make a single program for the 7 signals.
Test the program with the car.

Thank you all for the help.

OldBeaver

The data plug was plugged to the wrong pins!

Don't you just hate wires that don't go where you tell them to?

Good to hear you have it working. Looking forward to reading about your progress, have fun

Oldbeavers working LCD

Thnx alot Its really nice and help me too. Thanks to all of you MEMBERS