Creative Commons License
.

LCD I2C

Hello there! Fellow electronics enthusiasts.

I am quite sure we all make some or the other projects,  so as a part of our learning experience or academics. We sure would want to display some data present on our micro controllers, from sensors or simply create a USER INTERFACE.

so here is a quick tutorial about LCD displays, in which we will learn how to wire and program a I²C LCD Display

Step 1: Watch the VIDEO

Step 2: Understand Whatis I²C Communication?

I2C (Inter-Integrated Circuit) is a synchronous, multi-master, multi-slave, packet switched, single-ended, serial computer bus invented in 1982 by Philips Semiconductor.

So It is widely used for attaching lower-speed peripheral IC’s to processors and micro-controllers in short-distance, intra-board communication.

So I²C uses only two bidirectional open collector or open drain lines, Serial Data Line (SDA) and Serial Clock Line (SCL), pulled up with resistors. And so Typical voltages used are +5 V or +3.3 V. The I²C reference design has a 7-bit address space, with a rarely-used 10-bit extension. Common I²C bus speeds are the 100 kbit/sstandard mode and the 400 kbit/s Fast mode.

Step 4: Connecting the L.C.D. Display to Microcontroller

LCD I2C

So By using this I2C technique, we can operate our LCD Display to display data from our sensors or any text from Microcontroller by using only 2 pins, i.e. SCL (which is clock pin) and SDA (which is data pin),also we would need to use 2 more pins for power. i.e. Vcc and Gnd.

steps for LCD I2C

1.connect the SCL data and SDA data pin to SCL and SDA pins in your microcontroller,

(if you don’t know which pin is SCL and which is SDA, so check the data sheet for pin-out)

so for this tutorial, we will use an ARDUINO UNO microcontroller, which has SCL as pin A5SDA pin as A4.)

2. also connect 5V to 5V, and Gnd to ground pin of arduino.

3. So Adjust the Contrast of L.C.D using Pot on the back side of LCD module.

Step 5: Finding the HexaDecimal Address of I²C LCD

We can connect multiple I2C devices at a same time. but to distinguish between devices, aHexadecimaladdress is allotted to each I2C device, so which we need to know before proceeding any further.

To know this address,

1. Connect your I²C device to Arduino Uno, (Follow Previous Step).

2. So Download the Attached Code and Upload it to your IDE.

3. also open Serial Moniter, which will return you the Hex Address of the Connected I²C Device.

Step 6: Add Required LIBRARIES

LCD I2C

So Before proceeding any further, lets download and install custom library for our “I²C LCD” on IDE,

also For which, We will use LiquidCrystal_I2C library by frank.

steps.
  1. So download the zip file.

2. so open ide, under sketch menuinclude library tab, select “add .zip library“ option, and select the downloaded file.

link

https://github.com/fdebrabander/Arduino-LiquidCrys…

Step 7: Coding

LCD I2C

steps

1. Include the two libraries. ( so i.e. wire.h and LiquidCrystal_I2C.h)

2. So Define the address and set up the lcd

by LiquidCrystal_I2C lcd(0x27,16,2);

where, “0X27” is hexadecimal address obtained from previous step and “16,2” is columns, rows.

3.In void setup, initialize the lcd by lcd.init();

4. also Turn on the backlight by using lcd.backlight();

5. So Set cursor, which can be done using the syntax lcd.setCursor( rows, columns)

(and so here we are using 16X2 LCD, which means we have 16 rows and 2 colums)

6. And then type Required Message inside the syntax lcd.print( “hello friends”);

Write A Comment

Minov

A Market Place for your Innovations

0