How to Connect a Serial LCD to an Arduino UNO

80,508

305

37

In this instructable I will show you how I connected a serial LCD 16X2 to an Arduino UNO.

There are lots of instructables and tutorials showing you how to connect a regular LCD to an Arduino but not many showing a serial LCD and on my Arduino the PINS to attach the UART pins are hidden. With this instructable I will shed some light on this issue :)

One of the reasons why you would be using a serial LCD is the fact that it uses only 4 PINS instead of 16.

The UART or serial module that is attached to the back of the LCD is responsible for sending and receiving serial communications between the Arduino and the LCD and it has a onboard potentiometer to adjust the brightness of the screen.

What you need for this project is:

  1. An Arduino UNO
  2. Serial LCD a 16X2
  3. and 4 jumper wires male to female.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Connect the Electronics

I will use 4 colored jumper wires to make it easy.

There are 4 pins on the UART labeled GND, VCC, SDA and SCL.

Use the red wire to connect the VCC from the UART to the VCC on the Arduino

Use the black wire to connect the GND from the UART to the GND on the Arduino

Use the green Wire to connect the SDA from the UART to the SDA on the Arduino

And finally use the yellow wire to connect the SCL from the UART to the SCL on the Arduino

NOTE:

The SDA and SCL PINS on the Arduino are labeled on the back of the board, use the pictures as guidelines

This is it for wiring, it is easy. Then load the Arduino IDE and upload the sketch to the Arduino.

Step 2: The Sketch

Step one is to download the Liquid Crystal library if you haven't done so already.

I will add a zip file with the library for Windows or you can go the site https://bitbucket.org/fmalpartida/new-liquidcrysta... and download it yourself.

Once you have the library, extract the contents in the Arduino library folder on your computer. On my computer the default location was C:\programfiles\Arduino\library.

I attached a copy of the sketch I used in this instructable,

Here is the breakdown:

First you need to load the libraries, we will load wire.h, LCD.h and LiquidCrystal_I2C.h

//load libraries
#include wire.h

#include LCD.h

#include LiquidCrystal_I2C.h


Then we need to define variables... in this section just copy it as is because it tells the IDE where to find the PCF8574A and how to interact with the LCD to turn on the backlight, the read pin, the write pin and data pins etc...

//Define variables

#define I2C_ADDR 0x27 //Define I2C Address where the PCF8574A is

#define BACKLIGHT_PIN 3

#define En_pin 2

#define Rw_pin 1

#define Rs_pin 0

#define D4_pin 4

#define D5_pin 5

#define D6_pin 6

#define D7_pin 7

Another line is needed to initialize the LCD, this is done through an array which includes the variables that we defined earlier.

//Initialise the LCD
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

In the void set up, we start by telling the IDE that we are dealing with a 16X2 LCD

lcd.begin (16,2);

Then I turn on the back light (always good to have a lit LCD), notice it is the same variable from above...

lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);

Then I tell it to go to the first line at left most position lcd.setCursor(0,0);

and print lcd.print("I just made an");

then move the cursor to the second line and the left most position lcd.setCursor(0,1);

and print: lcd.print("Instructable :)");

There is void loop because the program need a loop to compile but it should remain empty.

And that's it.... very simple, if you follow these instructions the LCD will output anything you type in this code.

There is a detailed video in the next step.

Step 3: Step by Step Video

Step 4: End Result

If you follow the steps in the instructable The LCD should print out "I made and an Instructable :)"

Happy making

4 People Made This Project!

Recommendations

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

37 Discussions

None
midwestmangoshanhanmumuqq

Reply 7 months ago

I2c IS a form of serial communications, along with hundreds of others. Serial basically means not parallel (like the 8 data pins directly on the LCD itself for example)

None
midwestmangosKishor_inov_IND

Reply 7 months ago

However you want, soldering works directly, adding your own headers or pins, the main goal is simply to get the electricity from point a to point b, headers are the easiest once they're attached because they're easy to remove and replace later but soldering wires directly to the board gives a better connection.

None
CalvinM1

3 years ago

what's the device behind the LCD that allows connection with the SDA and SLC pins on the arduino?

2 replies
None
scratchndent

2 years ago

LiquidCrystal_I2C.h does not exist and neither does LCD.h

also not compatible with any other lcd librarys or script.

1 reply
None
KrisO1

2 years ago

I hate to be the one to state the obvious but... THAT IS NOT A SERAL LCD ANYMORE. This isn't a tutorial on how to connect a serial lcd, it's on how to connect an I2C backpack to an Arduino. If you where using a serial lcd you'd have to wire all 16 pins to the arduino instead of having the prepackaged backpack do all the grunt work for you.

1 reply
None
midwestmangosKrisO1

Reply 7 months ago

Correct me if I'm wrong, but if you hooked up all the 16 wires direct to the Arduino, that would be a parallel lcd display, not serial. The tutorial shows how to use the backpack converted lcd to hook it up using serial rather than parallel so it really is accurate.

None
taking a nap

7 months ago

the code will not open in Arduino ide

None
Elementk2

Question 1 year ago

what if you dont have a 0538A?

None
Akshay6766

1 year ago

Got compiled no but giving blank backlight display mine using 0x3F address is there any shorting to be done

None
jankiewiet

2 years ago

it almost works, it uploads fine but i got no text on my lcd, any tips

is it different with a mac book?

3 replies
None
fisharmor.jankiewiet

Reply 2 years ago

Ok I got mine figured out. Here's where I got the answer, and this is a great, packed-with-info video:

At one point he mentions that there are three jumpers on the back of the I2C backpack (mine are labeled A0, A1, and A2) which are unsoldered. This instructable assumes what is in the video above - that the baseline serial address for the backpack is 0x27.

Well I read on the Amazon reviews where I got my serial LCD that I'm supposed to be using 0x3F as the address. The backpack does NOT have anything soldered in the jumpers area so basically whoever made the backpack I have is not following the convention at all. The 0x27 address shows up over and over in tutorials, but is apparently not always the case.

I didn't have to do this, but if you don't know the serial address, you can use this link to write code to find it for you.
http://playground.arduino.cc/Main/I2cScanner

None
RobinE25fisharmor.

Reply 2 years ago

Oh man, thank you so much for this comment!!!

I was slowly going nuts... mine is the 0x3F too... for two of my LCDs... I never thought about this address, as it's really mentioned in every tutorial...

Again - Thanks!

None
fisharmor.jankiewiet

Reply 2 years ago

I'm having the same problem... everything connected up and uploading, no compile errors, and a blank screen. :(

None
a_wrek

4 years ago

Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"

lcd_test.ino:3:17: fatal error: LCD.h: No such file or directory
compilation terminated.
Error compiling.

This is the error I get when I try this. Please help. I have not yet been able to get my lcd to work on any tutorial I have tried.

1 reply
None
scratchndenta_wrek

Reply 2 years ago

in the top bar, go to [ Sketch > Include Libraries > Manage Libraries > Filter ]

and type in the library that you need to download find what you need, get the latest version and click install. then go to

[ Sketch > Include Libraries > (...Library Name...) and click on it. then in the script bar it should pop up with

#include <...Library Name...>

Hope this helps

~Scratchndent