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

One thought on “How to use 16×2 LCD with I2C on Arduino and Wemos”

Leave a Reply