Tutorial: Basic 16x2 LCD with Arduino

On this tutorial, we will show you how to connect a basic 16x2 LCD to your Arduino. In the LCD datasheet we can check the correct pins of your display. Connect it like the picture above.

Behind your display, we can see the pin numbers, from 1 to 16. To turn the backlight on, connect the pin 15 to 5V and the 16 to GND.

In the Arduino IDE, go to File > Examples > LiquidCrystal and select "Hello World". It will open the following code:

/*

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.

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!");    // Write on LCD
}

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);
}

The function lcd.print("hello, world!"); is the main one that writes into the LCD. Upload your code. That message should apperar on your display. Feel free to change the text and see what happens.

References:

http://www.sparkfun.com/datasheets/LCD/GDM1602K.pdf

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

Views: 11975

Tags: arduino, lcd, tutorial

Comment by HaimaN Adel on January 26, 2013 at 8:41am

thank you

done

this my project

Comment

You need to be a member of GarageLab (arduino, electronics, robotics, hacking) to add comments!

Join GarageLab (arduino, electronics, robotics, hacking)

Latest Activity

Shannon Bradley and Marcelo Rodrigues are now friends
Wednesday
Terry Renner is now a member of GarageLab (arduino, electronics, robotics, hacking)
Wednesday
Andy S posted a discussion

Arduino MEGA boolean?

Hi everyone,been banging my head against the wall a few days now.i have a small project, where i…See More
Wednesday
Bobby Marshall posted a video

SELFIE Mirror

Meet the S.E.L.F.I.E., the "The Self Enhancing Live Feed Image Engine". Find out how it works: http://istrategylabs.com/2014/04/take-an-instant-selfie-with-t...
Tuesday
GarageLab posted a blog post
Tuesday
pj jones posted a status
"Designing an Home Automation Project"
Monday
Profile Iconpj jones, Robert Kribel and Lars Goldschlager joined GarageLab (arduino, electronics, robotics, hacking)
Monday
Fontaine Pierre commented on GarageLab's blog post Tutorial: Using GPS Shield as an Anti-Theft Device
"Hi, Is it possible to make a car tracker with this GPS + GSM shield to send a message if limits…"
Apr 11
GarageLab posted a blog post
Apr 11
Profile Iconeslam mohamed haredy, Wesley Castillo and Lise Pape joined GarageLab (arduino, electronics, robotics, hacking)
Apr 10
Terry Dark left a comment for Beula Isaac
"Hi Beulah, Greetings from down under (Australia) Please tell me about yourself and your interests…"
Apr 9
Terry Dark and Beula Isaac are now friends
Apr 9
GarageLab posted blog posts
Apr 9
GarageLab posted a blog post

Festo's BionicKangaroo gets the hop on energy-efficiency

The BionicKangaroo features pneumatic actuators that provide the jumping power and at the same time…See More
Apr 7
Profile IconAnthony Parker, John Nicosia and Tom Devey joined GarageLab (arduino, electronics, robotics, hacking)
Apr 7
wani sageer posted photos
Apr 6
GarageLab posted a blog post

Using a 3D Printer to Draw Tattoos: InkD

 It’s one thing to allow a professional tattoo artist to ink your arm. It’s another thing…See More
Apr 4
GarageLab posted a blog post

Dispensing Solder Paste With A 3D Printer

There’s a strange middle ground in PCB production when it comes to making a few boards. Dispensing…See More
Apr 3
Duong Nguyen is now a member of GarageLab (arduino, electronics, robotics, hacking)
Apr 3
GarageLab posted blog posts
Apr 1

© 2014   Created by Marcelo Rodrigues.

Badges  |  Report an Issue  |  Terms of Service