Template: LCD1602 I2C Module Arduino

From Waveshare Wiki
Jump to: navigation, search

Working With Arduino

Hardware Connection

Arduino Pin Connection Correspondence
Module Interface Arduino Pin
VCC 5V/3.3V
GND GND
SCL SCL
SDA SDA

Connection diagram:
LCD1602 RGB Module003.jpg

Arduino IDE

Download this sample demo in the Resource, enter the Arduino folder, and double-click to open the test.ino file, Arduino IDE will automatically load the driver library under the same folder, select the correct driver board model and its corresponding port number, click the upload button to automatically start compiling and uploading the demo, and the demo will run automatically after the upload is successful.
LCD1602 I2C Module Arduino05.png
This demo has been tested and run on Arduino uno development board and Arduino mega2560 development board.

Working With ESP32

Environment Setting

Install the ESP32 Plug-in in the Arduino IDE

1. Open the Arduino IDE, click on the file in the upper left corner, select Preferences:
LCD1602 I2C Module Arduino02.png
2. Add the following link in the additional development board manager URL, then click OK.

https://dl.espressif.com/dl/package_esp32_index.json

LCD1602 I2C Module Arduino03.png
Note: If you already have the ESP8266 board URL, you can separate the URLs with commas like this:

https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

Download the packages compressed package and copy the decompressed packages file to the following path:

C:\Users\xutong\AppData\Local\Arduino15

LCD1602 I2C Module Arduino04.jpg
Note: Replace the username: xutong with your own username.

Hardware Connection

When connecting to ESP32, choose to connect with a 4PIN cable, please refer to the pin correspondence table below:
If you are using a pin header or PH2.0 4PIN interface, you need to connect according to the following table.

ESP32 Pin Connection Correspondence
LCD ESP32
Pin No.
VCC 5V/3.3V
GND GND
SCL GPIO22
SDA GPIO21

Take the LCD1602 Module using the PH2.0 4PIN interface as an example, and connect it to the ESP32 according to the above table:
(Please connect according to the pin definition table. The color of the wiring in the picture is for reference only, and the actual color shall prevail.)
Connect to ESP32 as shown in the figure below.
LCD1602 I2C Module Arduino099.png

Use With Arduino IDE

Download this sample demo in the Resource, enter the ESP32 folder, double-click to open the test.ino file, Arduino IDE will automatically load the driver library under the same folder, select the correct driver board model and its corresponding port number, click the upload button to automatically Start compiling and uploading the demo, and the demo will run automatically after the upload is successful.