4
\$\begingroup\$

Has anyone got a really clear diagram of the way to link up a 16x2 LCD screen to an Arduino?

Basically I have an LCD for which the back light is coming on, but I am not getting any words appearing on the screen.

Which Pins should I be focusing on to test this?

This is the screen i'm using

http://www.littlebirdelectronics.com/products/basic-16x2-character-lcd-yellow-on-blue-5v

\$\endgroup\$
  • \$\begingroup\$ Can you give us identifying information on what kind of 16x2 LCD you are trying to hook up? \$\endgroup\$ – Lou Feb 9 '10 at 19:31
4
\$\begingroup\$

Check this link out - very good tutorial exactly what you want from LadyAda. Her LCD has a block of pins at the end, most LCDs have 16 pins along the top with pin 1 at the top left (looking from the front). Note LadyAda pins are reversed from normal but if you have the back light sorted then the code below will help a lot.

Also another tutorial but no wiring diagram

From here I copied this -

// my pinout from L (LCD pin) to A (Arduino pin):
// LCD pin 1: Vss --> to Arduino GND
// LCD pin 2: Vdd --> to Arduino +5V
// LCD pin 3: V0 (contrast) --> to GND (I chose the PWM pin 10, see below)
// LCD pin 4: RS (register select) --> to Arduino pin 11
// LCD pin 5: R/W- (read/write) --> to Arduino pin 2
// LCD pin 6: E (H/L enable) --> to Arduino pin 3
// LCD pin 7: DB0 (data bit 0) --> to Arduino PIN 4
// LCD pin 8: DB1 (data bit 1) --> to Arduino PIN 5
// LCD pin 9: DB2 --> to Arduino PIN 6
// LCD pin 10: DB3 --> to Arduino PIN 7
// LCD pin 11: DB4 --> to Arduino PIN 14
// LCD pin 12: DB5 --> to Arduino PIN 15
// LCD pin 13: DB6 --> to Arduino PIN 16
// LCD pin 14: DB7 --> to Arduino PIN 17
// LCD pin 15: A/Vee (backlight+) --> to a 4.2Vcc source (see documentation)
// LCD pin 16: K (backlight-) --> to Arduino GND

note you can ignore the R/W line (connect it to ground) and use 4 bit mode (with the LCD 4bit library) by disconnecting LCD pin 7, 8, 9 & 10. The pin assignments for the 4-bit library are mentioned in the library code. The mistake I made initially here was to wire up the lower nibble (DB0 to DB3) instead of the high nibble (DB4 to DB7).

// --------- PINS -------------------------------------
//is the RW pin of the LCD under our control?  If we're only ever going to write to the LCD, we can use one less microcontroller pin, and just tie the LCD pin to the necessary signal, high or low.
//this stops us sending signals to the RW pin if it isn't being used.
int USING_RW = false;

//RS, RW and Enable can be set to whatever you like
int RS = 4;
int RW = 11;
int Enable = 5;
//DB should be an unseparated group of pins  - because of lazy coding in pushNibble()
int DB[] = {6, 7, 8, 9};  //wire these to DB4~7 on LCD.
\$\endgroup\$
1
\$\begingroup\$

JohnC got most of it.

One LCD I own has the pins in reverse order from the datasheet. Since there are power and ground on both ends (mirrored, even), it still powers on even with it hooked up "backwards". It's worth checking that possibility if you're pretty sure you have the basic stuff hooked up correctly.

Also, for 4 pin mode, you'll want DB4-7 connected. I always forget and hook up DB0-3 instead. That doesn't work as well :)

Good luck. These are trickier than they seem.

\$\endgroup\$
  • \$\begingroup\$ If you have the back light working then the pin identification should be easy, as the back light is always controlled from pins 14 (anode - 5V) and 15 (cathode - ground). Note can take high current so if you want to control from Arduino then use a transistor. \$\endgroup\$ – JohnC Feb 9 '10 at 19:58
1
\$\begingroup\$

I have looked at a number of LCDs and the pin-out can vary quite a bit. Which display are you using?

How do you have the contrast pin connected? I am not sure what display you are using but on the Optrex 51505 that I use the pin is labeled VLCD. I connect VLCD to the wiper of a 10K pot. One side of the pot is connected to 5V the other is connected to GND.

You should be able to adjust the pot all the way in one direction and see black blocks all the way in the other and you will see nothing.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.