Contents
An I2C LCD
This LCD has an I2C interface. I like that. I like quick and easy implementation and I like having pins left over for other things. The I2C interface itself is actually a small daughter board that has been soldered onto a readily available LCD.
In fact, this YWRobot board can be purchased separately and connected to the the LCD of your choice.
Finding One
The searches below will most certainly bring you to listings that include the daughter board seen here. However, they will also some other stuff. If your intent is to copy what I’ve done here, I suggest playing close attention to the advertisement photos.
eBay Amazon Bang Good Ali-Express
YWRobot LCM1602 IIC V1 LCD Pin Outs
The picture below provides both an front view and a rear view.
As you can see, the pins are accessed beneath the display.
Ensure the jumper is installed if you are not going to use external control of back light brightness.
Also note that the contrast control affects the dot intensity.
ARDUINO YWRobot LCM1602 IIC V1 Tutorial
Get the Necessary Library
There are different versions of this library and you may have an older one. You will want version 1.2.1. You and get it HERE.
If you DO have the older version, you may want to move out of your library directory to avoid conflicts.
If you are new to adding and using libraries, I suggest visiting the Arduino Library Page.
Connect your Arduino to the LCD
Its just a matter of using four jumpers between your Arduino and the LCD
Upload and Run the I2C Scanner Sketch
You would think that all of these modules would come with some indication of what the I2C address is.
They don’t.
Worse, the seller you purchased this from may or may not have included the address in his description. If he did tell you the address, he may very well be wrong.
Mine came with an address of 0x27. Others report addresses of 0x20. In order to make sure, I suggest you run the I2C scanner found here and verify your address.
Copy, Paste and Upload the Tutorial Hello World Sketch
#include <Wire.h> #include <LiquidCrystal_I2C.h> // Using version 1.2.1 // The LCD constructor - address shown is 0x27 - may or may not be correct for yours // Also based on YWRobot LCM1602 IIC V1 LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); void setup() { lcd.begin(16,2); // sixteen characters across - 2 lines lcd.backlight(); // first character - 1st line lcd.setCursor(0,0); lcd.print("Hello World!"); // 8th character - 2nd line lcd.setCursor(8,1); lcd.print("-------"); } void loop() { }