Project 23 - Basic LCD. LCD Displaying Junk Characters

Hi All,

I tried the Project 23 from Beginning Arduino. After I power-cycled the board, the LCD is displaying junk characters. Has anyone experienced the same before ? How to reset the LCD ?

Thanks,
Dominic

is it always displaying junk characters or just when you restart it? can you post your code and take a picture of your setup?

Without a copy of the book it is difficult to evaluate the code. My guess is that the code may rely on the unreliable 'Initialization by Internal Reset Circuit' for the LCD controller. This technique relies on specific power-up conditions to initialize the controller.

When you power up the un-programmed microprocessor and the LCD module, download the sketch, and then run the sketch the conditions are different than when you power up the programmed microprocessor and the LCD module together. In the latter case the LCD controller may not even be functioning by the time the microprocessor starts sending code to it. This will result in exactly the conditions that you describe.

Follow the LCD Initialization link at http://web.alfredstate.edu/weimandn for more information on this subject.

Don

Actually after running this program, the LCD is displaying junk characters. It displays as "o<-o<-" and these characters move right after every minute.

/*
LiquidCrystal Library - Serial Input

Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.

This sketch displays text sent over the serial port
(e.g. from the Serial Monitor) on an attached LCD.

The circuit:

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2
  • LCD R/W pin to ground
  • 10K resistor:
  • ends to +5V and ground
  • wiper to LCD VO pin (pin 3)

Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe

This example code is in the public domain.

*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup(){
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// initialize the serial communications:
Serial.begin(9600);
}

void loop()
{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}

And you're using 9600 baud rate on your computer's serial monitor?

Try using the Hello World example program to get the serial communications out of the picture. Once you verify your hardware connections you can try this program again.

Don

Tried Hello World Program, still didnt work. LCD is showing "o<-o <-oo ooooo"

/*
LiquidCrystal Library - Hello World

Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.

This sketch prints "Hello World!" to the LCD
and shows the time.

The circuit:

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2
  • LCD R/W pin to ground
  • 10K resistor:
  • ends to +5V and ground
  • wiper to LCD VO pin (pin 3)

Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe

This example code is in the public domain.

*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}

Well the Hello World code is correct as is the LiquidCrystal library. This leaves your Arduino, your LCD module, and the wiring between them. A good start would be to provide an in-focus photograph that unambiguously shows that wiring, including both ends of each wire. You don't happen to have one of the surface mount UNOs with the bad bootloader, do you?

Don

I am having Arduino Uno.

I rewired the LCD as in Hello World program, and this time it shows more junk characters, and the backlight in not stable.

I am having Arduino Uno.

Some of the UNOs use a surface mount microcontroller chip and some of those have a bad bootloader.

I rewired the LCD as in Hello World program

The wiring is the same for both programs.

We can't do much more without seeing a picture of your wiring.

Don

I used the same connection as in the schematic..

As Floresta has pointed out, the library code is correct, so it's either your connection or the LCD, if your arduino is working. You thought you made the right connection. I can't say how many times I did that too. But it's either I missed ground pin or else that I thought I did. Pictures or you'll get a silent treatment.

I used the same connection as in the schematic.

I think you mean that you attempted to use the same connections as in the schematic. We have to see if you did it correctly.

Don