Help getting LCD 16x2 display to work

Hi all... I hope you can help me.

I've been trying without success for the past day to get a 16x2 "HD44780" based LCD to work with my Arduino Duemilanove.

I have tried multiple different pin configurations, several different sketches (both examples and ones I have written), using the included arduino library and a couple of others I have found but no success.

I've checked all wiring again and again, and there doesn't seem to be anything different between what I have and the examples I have found. (been following the guide here: Adams Bros Blog)

The only one difference is I don't have a 10k potentiometer to use, but I have tried with a 50k and using the diode to ground method with a 10k resistor that i found here: Arduino Playground - LCD - "Instead of using a potentiometer for the contrast setting you could use a diode and a 10K resistor. From pin 3 of the display put a diode (1N4001) to ground (pin 1 of the display). Ring on the diode should be oriented to ground! And put the 10K resistor from pin 2 (Vcc) of the display to 5V supply voltage. On several displays this gives a perfect contrast".

The backlight comes on, the IDE doesn't report any errors but the screen stays perfectly blank. When using the potentiometer (not 10k) I can turn it back and forth and at one end the black blocks appear on one line, which I take it from other posts means that the screen isn't totally fried. Anywhere else in the range the screen is just blank, and no combinations of code or pins have got me anywhere yet.

Here is the exact screen I have: http://www.maplin.co.uk/supertwist-alphanumeric-lcd-modules-36389 (number N27AZ)
Datasheet: http://www.maplin.co.uk/Media/PDFs/N27AZ.pdf

Any help you can give would be hugely appreciated as I need this working urgently for my project.

Thanks in advance!

Your problem appears to be right here:

// position cursor on line x=4,y=3
lcd.setCursor(3,2);

You are using a two line display but this instruction is putting the message on line 3. Just comment out the line and see what happens.

Also, you can get rid of all the extra junk on pin 3, the 50K pot will work all by itself.

Don

Hi there

Thanks for your reply :slight_smile: I've already tried with/without this line, and realising that his display had more lines I've tried with set cursor 0,1 or 1,0 or 0,0 or 1,1.... lots of variations.

Are there any checks i can do with a multimeter or arduino code to check that the right signals are being sent?

Thanks!

We can only work with the information that we are given.

To what position was the potentiometer adjusted when you tested your code?

You should post the actual code that you are using and a photograph that clearly shows the connections between your LCD module and your Arduino.

Don

Here's the code:

/*
  LiquidCrystal Library - Blink
 
 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 makes the 
 cursor block blink.
 
 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.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 
 */

// 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() {
  // Turn off the blinking cursor:
  lcd.noBlink();
  delay(3000);
   // Turn on the blinking cursor:
  lcd.blink();
  delay(3000);
}

As you can see it's a standard example sketch. I've got all the wiring to the pins set to the same configuration as the default example.

Here's some pictures of my circuit, please excuse the quality, I've made it the clearest I can.



On the last image there, the left wire with the heatshrink is the backlight power with a resistor. Next to that the ground for the LED.

From then on the wiring is: GND, +5v, Pot centre pin, arduino pin 12, GND, arduino pin 11, nothing, nothing, nothing, nothing, arduino pin 5, arduino pin 4, arduino pin 3, arduino pin 2.

I've tried the potentiometer in a range of positions turning very slowly as I go.

Above is the mini circuit I tried to use instead of the potentiometer, with +5v on right, screen pin 3 in middle, and ground on left. After this I went back to trying the potentiometer, correctly wired.

I should note that I realise there's one or two wires that have come out of the connections on the arduino, e.g. the ground on the left but that was connected when I've been trying, it just popped out when i went to take the pic.

It isn't clear how the display gets it's power. Usually the display is connectded to the +5V pin on the Arduino. From your pictures, it looks like that pin just goes to a diode (connected backwards). Does the backlight work?

Sorry, I should have explained.

To make it easier to create that mini circuit on the breadboard, I have +5v coming from the arduino to a row on the breadboard. The screen is wired to this, and so is that potentiometer. The backlight on the screen functions and as I said when you twist the potentiometer all the way to one side (maximum resistance I believe) it displays black squares down one row, like this:

As you can see the room is dark and the backlight works just fine :).

Thanks for the input guys! It is really important I get this working as I have a deadline for the project.

Your wiring appears to match your code (which is not the "standard example sketch"), but your soldering skills leave a little bit to be desired. Your most likely problem is some sort of wiring defect. It could be a poor connection or some shorted pins.

Since your backlight works and since you can see the row of boxes on the display your power is ok. You should set the pot until those boxes are visible but not too dark. The voltage at pin 3 will be around 0.5V.

Temporarily remove the power and check each of the six wires between the LCD and the Arduino. Those are the six lines called out in the parentheses of the LiquidCrystal lec() statement. Check continuity from the PC board below the black connectors at the Arduino end to the PC board itself (not the solder blob) at the LCD end. You also want to check for shorts between adjacent pins.

Reapply power and use a simple sketch that does not involve anything in loop. Here's my suggestion:

#include <LiquidCrystal.h>

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

void setup()
  {
  lcd.begin(16, 2);                          // this will work for all displays except some rare 16x1's
  lcd.print("hello, world!");
  lcd.setCursor(0,1)
  lcd.print("it works!");
  }

void loop()
  {
  }

Don

Since your backlight works and since you can see the row of boxes on the display your power is ok.

I am going to amend this statement based on your loose ground wires and some recent problems others have had.

Since your backlight works and since you can see the row of boxes on the display your power appears to be OK. On the other hand, there have been cases where the display powers up with one of the power leads disconnected, probably through the I/O circuitry. You probably should make sure those power connections really are correct and solid.

Don

Still no joy I'm afraid :frowning:

I've been through and tested each and every connection, and resoldered any that seemed untidy. All are ok, but still zero display.

I found one slight glitch, however.

When I use connect the enable pin (6) to arduino pin 11, then my multimeter reads that this is directly connected to ground. However if I shift the wire across to pin 10 (modifying the code accordingly) then this is not the case. Could this indicate a problem with my Arduino, or the LCD?

Also is there any way I can check the arduino is outputting the right signals with my meter?

Thanks!

When I use connect the enable pin (6) to arduino pin 11, then my multimeter reads that this is directly connected to ground.

There's really no telling what you will get when you measure the resistance between a microprocessor output pin and ground. It depends on the circuitry within the microprocessor and on the polarity of your ohmmeter pins. There is also the possibility of damage caused by the voltage being supplied by the meter.

Just an outside chance... Arduino Pin 11 connects to pin 4 of the ICSP header next to the reset pushbutton. This is the center pin nearest the edge of the board. Pin 6 is right below that pin and it is connected to GND. Make sure everything looks good at that header.

Also is there any way I can check the arduino is outputting the right signals with my meter?

No.

I think it is time to completely desolder everything from your LCD and replace the wire connections with header pins that will enable you to plug the LCD module into your breadboard. If you don't have any headers then short lengths of bare wire will do.

After this you should follow the tutorial at Arduino Tutorial - connecting a parallel LCD except use the sketch that I provided earlier.

Don