Introduction: How to Connect I2C Lcd Display to Arduino Uno
Hello Guys , In this Instructable you are going to see how to connect i2c lcd display to arduino and how to print on lcd display .
Before going to start this tutorial you must know a brief about i2c communication .
Each I2C bus consists of two signals: SCL and SDA. SCL is the clock signal, and SDA is the data signal. The clock signal is always generated by the current bus master; some slave devices may force the clock low at times to delay the master sending more data (or to require more time to prepare data before the master attempts to clock it out). This is called “clock stretching” and is described on the protocol page.
For more information visit Electronics Projects Hub
Now lets start this Instructable ..
Step 1: Components Required
Arduino Uno : https://goo.gl/TlOucU
I2C LCD Display : https://goo.gl/Fh6su4
Male to female jumpers - 4 : https://goo.gl/nsAkuw
Step 2: Circuiting
I2C Board of LCD Arduino
GND <---> GND
VCC <---> 5V
SDA <---> A4
SCL <---> A5
Step 3: Code
We must require to include two libraries ,in order to work the code attached .
Download the libraries from the attachment LCD library .
Basic functions we use in code
lcd.begin(16,2); //Defining 16 columns and 2 rows of lcd display
lcd.backlight(); //To Power ON /OFF the back light
lcd.setCursor(0,0); //Defining positon to write from first row,first column .
lcd.setCursor(0,1); //Defining positon to write from second row,first column .
lcd.print(" write here to print"); //You can write 16 Characters per line within quotations.
lcd.clear(); //Clean the screen
Step 4: Output
The outputs attached are done according to code attached above .
Step 5: Complete Video Tutorial
If you want to learn C Programming you can easily learn at codingtute. It will enhance your arduino programming skills.
Don't forget subscribe my YouTube Channel
Check out my website Electronics Projects Hub
4 People Made This Project!
- EvanMaksud made it!
- jcontreraso made it!
- ChalaZiko made it!
- aaRsh 2019 made it!
28 Comments
Question 2 years ago on Step 2
Hi There. I uploaded the code onto my arduino LCD screen however the backlight will not illuminate and I can barely see the text. any suggestions?
Answer 2 years ago
try rotating the potmeter?
Reply 2 years ago
make sure that you are hooking up to A4 and A5 and not D4 and D5. It makes a difference.
Question 2 years ago on Step 3
What is the purpose of declaring LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); if we are using pins A4 and A5? I know that 0x27 is the ic address but what is the rest for?
Answer 2 years ago
not sure if anyone is still interested but if you look in the LiquidCrystal_I2C.h file you will see the in comments for the initializer...
@param lcd_Addr[in] I2C address of the IO expansion module. For I2CLCDextraIO,
the address can be configured using the on board jumpers.
@param En[in] LCD En (Enable) pin connected to the IO extender module
@param Rw[in] LCD Rw (Read/write) pin connected to the IO extender module
@param Rs[in] LCD Rs (Reset) pin connected to the IO extender module
@param d4[in] LCD data 0 pin map on IO extender module
@param d5[in] LCD data 1 pin map on IO extender module
@param d6[in] LCD data 2 pin map on IO extender module
@param d7[in] LCD data 3 pin map on IO extender module
there is a bit more but i'll leave that for you to look into. in a more sophisticated IDE you normally can right click to a sub menu that will take you to the definition. it's a great way to help you get a deeper understanding of how things work.
Answer 2 years ago
Hi Robert did you manage to get an answer for this? I know that POSITIVE is used to turn on the backlight but mine wont illuminate. frustrating
Reply 2 years ago
No I never got an answer. Mine works with the code, I am just trying to get a little background on it.
Reply 2 years ago
same here! plus idont know how to turn backlight off .plus i m not a pro. triple trouble :(
Question 3 years ago
Hello Guys,
I am getting a error while i m going to add zip file of lcd library error id this zip file does not contains a valid library please help me to resolve this issue as soon as possible.....
Answer 3 years ago
you should extract the zip file and click on it.
it would have two different zip file inside it
lastly, add both zip files into your library
4 years ago
Hey guys. My LCD works fine using the above instructions (when replacing the existing LCD library in the Arduino directory) but I can't get the backlight to ever switch off. Suggestions?
Reply 3 years ago
Hi
Pull the jumper off the i2c board which is marked LED
I hope this helps
Reply 3 years ago
Dear,
Rotate potentiotmeter
Question 3 years ago on Step 1
can i change the pin for SDA and SCL to A2 and A3 instead of A4 and A5
Question 3 years ago on Step 5
hey guys what can i do beacause when i am going to uploaded they said that have multiplie librarys ???
3 years ago
Hello bro My lcd is displaying nothing
Please help me i badly need it to display as my fyp is on way
4 years ago on Step 3
i cant seem to be able to add the library. it keeps saying that it isn't a valid library
Question 4 years ago on Introduction
I have written this code.But after compiling,it is showing the below written error message:
Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"
I2C_LCD_TUTORIAL:6: error: 'POSITIVE' was not declared in this scope
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
^
exit status 1
'POSITIVE' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Answer 4 years ago
Ho friend, My suggestion, use LiquidCrystal_I2C lcd(0x27,16,2);
Where 16,2 is LCD display 16x2, you need to change the same as per your LCD.
0x27 is the i2c address..
Hope this helps.
Answer 4 years ago
I had the same problem. I deleted all libraries with i2c lcd in the arduino IDE. Then imported the one linked in the files here.
Worked like a charm