Difference between revisions of "LCD1602 RGB Module"

From Waveshare Wiki
Jump to: navigation, search
m (Text replacement - "==Support==" to "")
(5 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
}}
 
}}
  
<div class="tabber">
 
<div class="tabbertab" title="Instruction">
 
 
==Features==
 
==Features==
*Incorporates character LCD panel LCD1602
+
*I2C interface can be directly controlled with only two wires, which is convenient to connect to various control boards.
*Adjustable RGB backlight color, up to 16M (2563) backlight colors in theory
+
*Incorporates character LCD panel LCD1602.
*Can display up to 16 X 2 characters, support screen scrolling, cursor movement and other functions
+
*Adjustable RGB backlight color, up to 16M (2563) backlight colors in theory.
*Onboard AiP31068L LCD driver chip, PCA9633 RGB control chip
+
*Can display up to 16 X 2 characters, support screen scrolling, cursor movement and other functions.
*I2C control interface, only two signal pins are required, saving the IO resource
+
*Onboard AiP31068L LCD driver chip, PCA9633 RGB control chip.
*Compatible with 3.3V/5V operating voltage
+
*I2C control interface, only two signal pins are required, saving the IO resource.
*Comes with development resources and manual (Raspberry Pi/Jetson Nano/Arduino examples)
+
*Compatible with 3.3V/5V operating voltage.
 +
*Comes with development resources and manual (Raspberry Pi/Jetson Nano/Arduino examples).
  
 
==Specification==
 
==Specification==
Line 39: Line 38:
 
==Pinout==
 
==Pinout==
 
{|border=1; style="width:700px;text-align:center" align="center";  
 
{|border=1; style="width:700px;text-align:center" align="center";  
|-style="background:#0000ff; color:white;" align="center"
+
|-style="background:green; color:white;" align="center"
 
|PIN|||Description
 
|PIN|||Description
 
|-
 
|-
Line 50: Line 49:
 
|SCL||I2C clock line
 
|SCL||I2C clock line
 
|}
 
|}
 +
 
==Working Protocol==
 
==Working Protocol==
 
[[File:LCD1602_RGB_Module002.png|1000px]]
 
[[File:LCD1602_RGB_Module002.png|1000px]]
  
</div>
 
<div class="tabbertab" title="Guides for Raspberry Pi">
 
 
{{LCD1602 RGB Module Guides for Pi}}
 
{{LCD1602 RGB Module Guides for Pi}}
  
</div>
 
<div class="tabbertab" title="Guides for Pico">
 
 
{{LCD1602 RGB Module Guides for Pico}}
 
{{LCD1602 RGB Module Guides for Pico}}
  
</div>
 
<div class="tabbertab" title="Guides for Arduino">
 
 
{{LCD1602 RGB Module Guides for Arduino}}
 
{{LCD1602 RGB Module Guides for Arduino}}
 
</div>
 
<div class="tabbertab" title="Resources">
 
 
==Resources==
 
==Resources==
 
===Demo===
 
===Demo===
Line 72: Line 63:
 
===Document===
 
===Document===
 
[[File:LCD1602_RGB_Module.pdf|LCD1602 RGB Module datasheet]]
 
[[File:LCD1602_RGB_Module.pdf|LCD1602 RGB Module datasheet]]
</div>
+
==FAQ==
<div class="tabbertab" title="FAQ">
+
{{FAQ|When using the python sample program, why only the second line is displayed but not the first?
 
+
|It may be a problem of python firmware incompatibility, you can use the firmware version given by our sample program.
</div>
+
}}
<div class="tabbertab" title="Support">
+
{{FAQ|Do SDA and SCL of LCD1602 have pull-up resistors?
 
+
|Yes.
 +
}}
 
{{Service00}}
 
{{Service00}}
  

Revision as of 06:05, 18 July 2022

LCD1602 RGB Module
LCD1602 RGB Module

LCD1602 RGB Module, Adjustable RGB Backlight Color, I2C Communication, 3.3V/5V Compatible
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Features

  • I2C interface can be directly controlled with only two wires, which is convenient to connect to various control boards.
  • Incorporates character LCD panel LCD1602.
  • Adjustable RGB backlight color, up to 16M (2563) backlight colors in theory.
  • Can display up to 16 X 2 characters, support screen scrolling, cursor movement and other functions.
  • Onboard AiP31068L LCD driver chip, PCA9633 RGB control chip.
  • I2C control interface, only two signal pins are required, saving the IO resource.
  • Compatible with 3.3V/5V operating voltage.
  • Comes with development resources and manual (Raspberry Pi/Jetson Nano/Arduino examples).

Specification

  • Operating voltage: 3.3V/5V
  • Interface: I2C
  • LCD type: character LCD
  • Controller: AiP31068L PCA9633DP2
  • Display 64.5 x 16.0 mm
  • Dimension: 87.0 × 32.0 × 13.0mm
  • Operating current: 26mA (5V), 13mA (3.3V)

Pinout

PIN Description
VCC 3.3V/5V
GND GND
SDA I2C data line
SCL I2C clock line

Working Protocol

LCD1602 RGB Module002.png

Hardware Configuration

Enable I2C interface

  • Open terminal, use command to enter the configuration page
sudo raspi-config
Choose Interfacing Options -> I2C -> Yes  to enable I2C interface

RPI open i2c.png

And then reboot the system:

sudo reboot

Hardware Connection

You can directly attach it to the 40PIN GPIO of Raspberry Pi. Or you can wire it to Raspberry Pi with PH2.0 4PIN interface of the Module, please refer to the Pin definition below:

LCD Raspberry Pi
BCM2835 Board
VCC 5V 5V
GND GND GND
SDA SDA.1 3
SCL SCL.1 5

Take the LCD1602 RGB Module as an example, just connect it to the Raspberry Pi. The color of actual cable may be different with the figure here, please connect them according to the pins instead of color.

LCD1602 RGB Module007.jpg

If you are using Jetson nano, the connection should as bellow:

LCD1602 RGB Module012.jpg

Download the demo

Open the terminal of the Raspberry Pi, execute command to download demo codes:

cd ~
wget https://www.waveshare.com/wiki/File:LCD1602-RGB-Module-demo.zip
cd ~/LCD1602-RGB-Module-demo/Raspberry
sudo chmod 777 *
sudo python Choose_Color.py 
sudo python Discoloration.py 

Hardware Configuration

LCD PIN Pico
VCC 3.3V
GND GND
SDA GP4
SCL GP5

LCD1602 RGB Module006.jpg

Setup environment

Please refer to Raspberry Pi's guide: https://www.raspberrypi.org/documentation/pico/getting-started/

Raspberry Pi

  • Open a terminal of Raspberry Pi
  • Download and unzip the demo codes to directory Pico C/C++ SDK
#Note that the directory of SDK may be different for different users, you need to check the actual directory. Generally, it should be ~/pico/.
wget  -P ~/pico https://www.waveshare.com/w/upload/5/5b/LCD1602-RGB-Module-demo.zip
cd ~/pico
unzip LCD1602-RGB-Module-demo.zip

C

  • Hold the BOOTSEL button of Pico, and connect the USB interface of Pico to Raspberry Pi then release the button.
  • Compile and run the LCD1602-RGB-Module-demo examples
cd ~/pico/LCD1602-RGB-Module-demo/Pico/c/build/
cmake ..
make
sudo mount /dev/sda1 /mnt/pico && sudo cp LCD1602_RGB_Module_demo.uf2 /mnt/pico/ && sudo sync && sudo umount /mnt/pico && sleep 2

python

  • Refer to Raspberry Pi's guides to setup Micropython firmware for Pico
  • Open the Thonny IDE, and drag the demo to IDE and run on Pico as below. And save RGB1602.py to Pico's file system

Pico-10DOF-IMU005.jpg

Windows

C

  • Download and unzip the demo to your Windows desktop, refer to Raspberry Pi's guides to set up the Windows software environment settings.
  • Find the LCD1602-RGB-Module-demo.uf2 file under the build file under the demo directory, press and hold the BOOTSEL button of Pico, connect the USB of Pico to the PC with a MicroUSB cable, and drag the uf2 file into Pico, and then the Pico will run the demo directly.
  • 【Note】 If some users want to modify the demo, after debugging, you can use the following method to generate a .uf2 file:
    • 1. Copy LCD1602-RGB-Module-demo folder to your pico-examples file directory, and then modify the CMakelists.txt configuration file in the pico-example directory as shown in the figure below.
    • 2. Open Visual Studio Code, open your pico-examples folder, select LCD1602_RGB_Module_demo, click Generate, you can find the LCD1602_RGB_Module_demo.uf2 file in the build folder.
    • 3. Arag the uf2 file into Pico, and then the Pico will run the demo directly.

LCD1602 RGB Module010.png


python

  • Download and unzip the demo to your Windows desktop, refer to Raspberry Pi's guides to set up the Windows software environment settings.
  • Open the demo program in Thonnty, as shown in the figure below:

LCD1602 RGB Module004.png

  • Here you also need to save RGB1602.py to PICO, select RGB1602.py, save it as Raspberry pi pico, and name it RGB1602.py.

LCD1602 RGB Module005.png

  • And then run the demo under Choose_Color.py or Discoloration.py.
  • Code analysis

Choose_Color.py

#define color
rgb9 = (0,255,0) #cyan’
lcd.setCursor(0, 0) #Set the cursor position
# print the number of seconds since reset:
lcd.printout("Waveshare") #write characters
lcd.setCursor(0, 1) #Set the cursor position to the second row and the zeroth column
lcd.printout("Hello, World!")#write characters
lcd.setRGB(rgb1[0],rgb1[1],rgb1[2]); #Set the backlight

Discoloration.py

t=0
while True:
 
    r = int((abs(math.sin(3.14*t/180)))*255); #RGB changes over time
    g = int((abs(math.sin(3.14*(t+60)/180)))*255);
    b = int((abs(math.sin(3.14*(t+120)/180)))*255);
    t = t + 3;
    lcd.setRGB(r,g,b);#Reset the value of RGB
# set the cursor to column 0, line 1
    lcd.setCursor(0, 0) #Locate to the first row and the zeroth column
# print the number of seconds since reset:
    lcd.printout("Waveshare")#write characters
    lcd.setCursor(0, 1) #Locate to the second row and the zeroth column
    lcd.printout("Hello, World!")#write characters
    time.sleep(0.3)

Hardware connection

LCD PIN Arduino
VCC 3.3V
GND GND
SDA SDA
SCL SCL

The hardware connection as below:

LCD1602 RGB Module003.jpg

Library file loading for Arduino

  • Download the demo from the Resources, there is a Waveshare-LCD1602-RGB-master.zip library file in the Arduino folder.

LCD1602 RGB Module008.png

  • There are two methods to load the library:

Method 1: Unzip the entire .zip package to the libraries folder of the Arduino IDE.

LCD1602 RGB Module009.png

Method 2: Add this .zip package directly to the Arduino IDE.
Open the Arduino IDE->Choose 'Sketch' in the taskbar->Choose 'Include Library'->Add .ZIP library
Find Waveshare-LCD1602-RGB-mater.zip on demo folder and click to open it

Resources

Demo

LCD1602 RGB Module Demo

Document

File:LCD1602 RGB Module.pdf

FAQ

 Answer:
It may be a problem of python firmware incompatibility, you can use the firmware version given by our sample program.
{{{3}}}
{{{4}}}

{{{5}}}



Support

If you require technical support, please go to the Support page and open a ticket.