16x2 I2C LiquidCrystal Display(LCD) for UNO R3 and Mega2560

This DIY project will tell you how to send a string like "Hello World!" to I2C 1602 LCD.

Osoyoo I2C 1602 LiquidCrystal Display is an improved version of the traditional alphanumeric LCD (16x2 characters) in original Arduino starter kit.

LACC2006AD-9LACC2006AD-8

Osoyoo I2C 1602 LCD based on the 1602 panel with a small back-panel to convert it to I2C. The old style 1602 LCD needs 4 data lines + 2 control lines and totally occupies 6 digital ports. The new Osoyoo I2C LCD occupies only two analog ports and saves lots of Arduino port resources.

Setup instructions :

Step 1: Download LiquidCrystal_I2C.zip library file and Install I2C library:

This library REPLACES the standard one in Arduino V1.0. So

- in Arduino root fold->libraries rename the existing LiquidCrystal library directory

- unzip the LiquidCrystal_I2C.zip file

- place the folder LiquidCrystal_I2C into the libraries folder.

- in Arduino IDE click: Sketch->Import Library ->Add Library , then select above LiquidCrystal_I2C fold and open.

the import library list should show a new item "LiquidCrystal_I2C"

- Start up the Arduino IDE

Step 2 - Connect LCD with Arduino

lcd-Connection

For Uno R3 , the I2C connections are on SDA=A4 and SCL=A5. So go ahead and wire these up, along with the two power leads to the 5V and GND terminals.

lcd-Connection

For Mega2560 , the I2C connections are on SDA=20 and SCL=21. So go ahead and wire these up, along with the two power leads to the 5V and GND terminals.

Step 3 - Power up your devices.

You should see the LCD light up. Depending on how the device was constructed, you might want to turn down the contrast of the LCD; you can do this by inserting a screwdriver into the potentiometer at the back. I suggest you turn it half-way so that there's still a little contrast.

Step 4 - find the I2C address

Each device has an I2C address that it uses to accept commands or send messages. For Uno board, this address usually is 0x27. But sometimes the address might be changed 0x37,0x24 ...., So let's go and look for the one on your device.

Download ic2_scanner sketch file and load it into Arduino IDE. By opening up the serial monitor in the upright corner, Arduino will scan the address range looking for a reply. Most Arduino board will show 0x27, however it be other number.

ic2scanner

Write down the Address that you have found, you'll need it in the next step.

Step 5 - Fire up the LCD

Download ic2_lcd_test sketch file and set the I2C address to match ic2_scanner output value, load it into Arduino IDE.

You should see following message in LCD:

Hello World!

Soonics.com/blog

Done!

Posted in Uncategorized

Leave a Reply

WordPress spam blocked by CleanTalk.