How to use 16×2 LCD with I2C on Arduino and Wemos

After we discussed how to install drivers and additional tool tools for Wemos Uno here, this time we will discuss how to program LCD in Arduino and Wemos.

It seems, this Eid Mubarak holiday will be wasted by writing tutorials.

You need LCD library from marcoschwatz at GitHub.

Extract that, and copy the contents to

C:\Program Files\Arduino\libraries

or

C:\Program Files\Arduino\libraries

This is the results.

To connect I2C, you can refer to this picture.

Arduino Mega
Wemos D1 Uno
Arduino Uno

White : SCL
Black : SDA
Red : VCC
Grey : GND

On MEGA, SDA  and SCL can also be used on pin 20 and 21.

For Uno, SCL is on A5 and SDA is on A4.

For WeMos, SDA is on D4 and SCL is on D5.

But before that, you need to search first what is your I2C bus address. Mine is on 0x3F, yours may be different. Use the program below to find it out.


Code from Arduino.cc

After you uploaded that, you need to open Serial Monitor

Then plug your I2C. if everything happens correctly, you’ll see something like this. 

Take a note of that address code, and then replace 0x3F with your address in my code.

After you upload this code, the results should be similar to my photos above.

Thanks for reading! I’ll see you around.

Share Button

By Rinaldo Jonathan

Admin of this site. Artis papan PCB. #zoneRinaldo #Controllerism Studio Demon, Stage Angel, Sleepy Developer, Smoke free. Kalkud SHS 2012, PCR G15.

1 comment

Leave a Reply

Verified by ExactMetrics