Example for LCD on Arduino doesn't work

Hi,
I am getting crazy on my first LCD example. I use an Arduino Uno and a brick chasis stacked onto it like in the 2nd picture on page 3 (the red one) of:
http://www.seeedstudio.com/depot/images/product/Electronic%20Bricks%20Vol1.1.pdf
I did most of the examples for simple sensors and then tried the LCD example on page 16 (16 x 2 characters). I connected the 10 pin cable on BUS 2 of the brick chasis and on the LCD board, set the power switch to ON and backlight to OFF. The Uno board is connected via USB to my laptop.
The LCD first shows 16 "inverted spaces" in first line and nothing in second line.
Then I uploaded the program on the bottom from page 17.
It still shows the black rectangles in the first line and nothing in second.
What is strange too: When I switch the LCD power off I see the text "Hello, World" in the first line but still nothing in the second.
What is going wrong here?

#include <LiquidCrystal.h>

LiquidCrystal lcd(10, 11, 12, 13, 14, 15, 16);

void setup() {
lcd.clear(); // clear and cursor in upper left corner
lcd.print("Hello, World");
lcd.setCursor(2,1);
lcd.print("Hello, me");
}

void loop() {
}

Sounds like you have the contrast pot set too high, or wired up wrong. What value are you using?

Grumpy_Mike:
Sounds like you have the contrast pot set too high, or wired up wrong. What value are you using?

Hi,
I don't have a contrast pot on my LCD board. It looks like in the picture on page 16.

Hi,

Like Grumpy_Mike, the first thing to check I think it's the contrast.

So, to change contrast value, you have two solutions :

  • wire a 10k pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3)
  • you can connect the Vo pin of your LCD with any available PWM-output (for example pin 9) and add the following code in the setup() section:

pinMode(9, OUTPUT);
analogWrite(9, CONTRAST);

Replace contrast with the value of your choice. Try something between 10 and 20.

wire a 10k pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3)

No I would wire the wiper to pin 3, one end of the pot to ground but leave the other end of the pot floating. This is because most LCDs develop a negative bias voltage and wiring to pot to +5 will kill this.

Grumpy_Mike:

wire a 10k pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3)

No I would wire the wiper to pin 3, one end of the pot to ground but leave the other end of the pot floating. This is because most LCDs develop a negative bias voltage and wiring to pot to +5 will kill this.

oK oK, thank you for your advice. :slight_smile:

It still shows the black rectangles in the first line and nothing in second

I would have said that if the contrast pot were the issue, the two lines might both show 'inverted spaces.
One of the settings in LCD initialization is one line vs 2 lines, so I'd have suspected that the LCD was not initialized correctly.

1 Like

the two lines might both show 'inverted spaces.

Yes there is an other problem with writing to the wrong location here as well but it is not a problem with the initialisation. All LCD displays in my experience have none contiguous writing space. He needs to sort the contrast pot out first, then it is worth addressing his other problem.

Hi, are you using liquid crystal library from Seeed studio and Electronic Brick Starter kit shield? If yes please use BUS1 instead BUS2, so pins will be:
LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);
I suppose, that on the pin 13 is led, so it could not be used - it was wroten at Seeed studio forum.

Modified library from Seeed studio is here:
http://www.seeedstudio.com/depot/images/product/LiquidCrystal.rar

And problem is described here:
http://www.seeedstudio.com/forum/viewtopic.php?f=17&t=840

What is strange too: When I switch the LCD power off I see the text "Hello, World" in the first line but still nothing in the second.
What is going wrong here?

Without an lcd.begin() statement the display will be initialized as a single line display.

Don

No I would wire the wiper to pin 3, one end of the pot to ground but leave the other end of the pot floating. This is because most LCDs develop a negative bias voltage and wiring to pot to +5 will kill this.

I have seen at least one display that shows this connection, but almost all of the other data sheets that I have seen have the pot connected between pins 1 and 2 with the wiper going to pin three. Most displays seem to require about 0.3 v at the wiper for a good image.

Don

Hi Folks,

I made progress!!! The seller of the LCD had an idea. No additional resistor is needed, no alternative library so far. Below I post the working code for BUS2. Whomever may help this in future!
Summarizing: In the Seeedstudio example, there is statement lcd.begin() missing and lcd.setCursor() was used wrongly, because numbering starts with 0 as it is the case most often in computer science.

#include <LiquidCrystal.h>

// BUS2
LiquidCrystal lcd(10, 11, 12, 13, 14, 15, 16);

void setup() {
lcd.begin(16, 2);
lcd.clear(); // clear and cursor in upper left corner
lcd.setCursor(0, 0);
lcd.print("Hello, World");
lcd.setCursor(0, 1);
lcd.print("Hello, me");
}

void loop() {
}

Hi guys!
I have a problem and i hope you can solve it
I would try this example of LCD code and when i connect all parts correctly (and add a 10k pot for the contrast) the lcd screen turns on, the contrast change if I turn the pot... but i can't display any character in the screen... =( =(

This is the code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8 );

void setup()
{
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("hello, world!");// Print a message to the LCD.
}

void loop()
{
}

I don't know if it matters but I'm using Mac OSX and I connect Arduino in tty.usbmodem 621 serial port

@Flame

The program is fine. So check your wirring. Here a tutorial to how to use a LCD display - parallel type Arduino Tutorial - connecting a parallel LCD and the Arduino LCD Library LiquidCrystal - Arduino Reference and check http://arduino.cc/en/Reference/LiquidCrystalConstructor
to get the connections / pins right. I use the "Hello Wold " to check the LCD I purchase from a surplus store.

The pin out of a typical LCD is : Pin 1 - Vss - GND, Pin 2 - Vdd - +5, Pin 3 - Vo - 10 K pot middle pin, Pin 4 - RS, Pin 5 - R/W - go to GND, Pin 6 - E, Pin 7 - DB0 - go to GND, Pin 8 - DB1 - go to GND, Pin 9 - DB2 - go to GND, Pin 10 - DB3 - go to GND, Pin 11 - DB4, Pin 12 - DB5, PIN 13 - DB6, Pin 14 - DB7, Pin 15 - A - connect a 220 ohm resistor to +5 V, Pin 16 - K - go to GND. The init line LiquidCrystal lcd (rs, enable, d4, d5, d6, d7), has to match the pins of the Arduino, so check those connections and you may have to re-write your LCD init line. And adjust the trim pot for contrast.

I made a program using a LCD display. Check my post. It count passager for a bus. http://arduino.cc/forum/index.php/topic,68744.0.html That will give you some examples.

You have not yet provided a picture or two to prove you have connected the display correctly. That is the most important thing right now between you getting stuck and getting more help.

liudr:
You have not yet provided a picture or two to prove you have connected the display correctly. That is the most important thing right now between you getting stuck and getting more help.

Ok, i reconect all again and i took a picture:

I use HelloWorld example this time

Thanks for all!

arduino_lcd_flame.jp2 (865 KB)

Can you do any better than this? I can't open your .jp2 file format. Last time I checked, most commonly used picture file format online was jpg. See the following page for how much you have restricted the viewers of your picture:

My windows version of mozilla doesn't even open it despite the claim made on the page that it would open a .jp2.

This is the code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7, smiley-cool;

void setup()
{
  lcd.begin(16, 2);
  lcd.clear();
lcd.setCursor(0,0);
  lcd.print("hello, world!");// Print a message to the LCD.
}

void loop()
{
}

I hope you removed the emoticon and replaced the parentheses in the lcd.begin statement before you tried to use the code.

Your code says LiquidCrystal lcd(2, 3, 4, 5, 6, 7); but your photo shows you using what looks to me like pins 12, 11, 5, 4, 3, and 2. I can see that you certainly don't have anything connected to pins 6 and 7.

Do you understand how the numbers in the LiquidCrystal lcd argument relate to the pins you use on your Arduino? The tutorial doesn't explain this too clearly, but look here: LiquidCrystal - Arduino Reference.

You don't need the lcd.clear or the setCursor statements where you have them. The statement won't hurt anything but that stuff is already done during the initialization.

Don

Flame:
I use HelloWorld example this time

Looking more closely at the photograph it seems that you may actually have a bad display. You are only getting one row of dots when you should be getting one row of boxes (several rows of dots). What does the display look like when you remove the six wires that connect to the Arduino leaving just the five wires for power, contrast, and backlight?

Don