1.28inch LCD Module
- 1 Introduction
- 2 Specification
- 3 Pinout
- 4 LCD and the controller
- 5 Working Protocol
- 6 Hardware connection
- 7 Enable SPI interface
- 8 Install Libraries
- 9 Download Examples
- 10 Run the demo codes
- 11 python
- 12 Hardware Connection
- 13 Run the example
- 14 Hardware Coonnection
- 15 About the examples
- 16 Resources
- 17 FAQ
- 18 Support
1.28inch LCD Display Module, IPS Screen, 65K RGB Colors, 240×240 Resolution, SPI Interface
- Operating voltage: 3.3V/5V
- Interface: SPI
- LCD type: IPS
- Controller: GC9A01
- Resolution: 240(H)RGB x 240(V)
- Display size: Φ32.4mm
- Pixel size: 0.135（H）x0.135（V）mm
- Dimension: 40.4×37.5(mm) Φ37.5(mm)
|VCC||3.3V/5V Power input|
|DIN||SPI data input|
|CLK||SPI clock input|
|CS||Chip selection, low active|
LCD and the controller
- The driver used in this LCD is GC9A01, with a resolution of 240RGB×240 dots and 129600 bytes of GRAM inside. This LCD supports 12-bits/16-bits/18-bits data bus by MCU interface, which are RGB444, RGB565, RGB666.
- For most LCD controllers, the communication method of the controller can be configured, they are usually using 8080 parallel interface, 3-line SPI, 4-line SPI, and other communication methods. This LCD uses a 4-line SPI interface for reducing GPIO and fast speed.LCD
- If you are wondering which point is the first pixel of the screen (because the screen is round), you can understand it as a square screen with an inscribed circle drawn in it, and it only displays the content in this inscribed circle. The pixels in other locations are simply discarded (just like most round smartwatches on the market)
Note: Different from the traditional SPI protocol, the data line from the slave to the master is hidden since the device only has display requirement.
RESX Is the reset pin, it should be low when powering the module and be higher at other times;；
CSX is slave chip select, when CS is low, the chip is enabled.
D/CX is data/command control pin, when DC = 0, write command, when DC = 1, write data
SDA is the data pin for transmitting RGB data, it works as the MOSI pin of SPI interface;
SCL worka s the SCLK pins of SPI interface.
SPI communication has data transfer timing, which is combined by CPHA and CPOL.
CPOL determines the level of the serial synchronous clock at idle state. When CPOL = 0, the level is Low. However, CPOL has little effect to the transmission.
CPHA determines whether data is collected at the first clock edge or at the second clock edge of serial synchronous clock; when CPHL = 0, data is collected at the first clock edge.
There are 4 SPI communication modes. SPI0 is commonly used, in which CPHL = 0, CPOL = 0.
Please connect the LCD to your Raspberry Pi by the 8PIn cable according to the table below
The color of actual cable may be different with the figure here, please connect them according to the pins instead of color.
Enable SPI interface
- Open terminal, use command to enter the configuration page
sudo raspi-config Choose Interfacing Options -> SPI -> Yes to enable SPI interface
Please make sure that SPI interface was not used by other devices
- Install BCM2835 libraries
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz tar zxvf bcm2835-1.68.tar.gz cd bcm2835-1.68/ sudo ./configure sudo make sudo make check sudo make install #For more details, please refer to http://www.airspayce.com/mikem/bcm2835/
- Install wiringPi libraries
sudo apt-get install wiringpi
For the version of the Raspberry Pi system after May 2019 (the OS version earlier than this date doesn't need to be executed), an upgrade may be required：
wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v #You will get 2.52 information if you install it correctly
- Install Python libraries
#python2 sudo apt-get update sudo apt-get install python-pip sudo apt-get install python-pil sudo apt-get install python-numpy sudo pip install RPi.GPIO sudo pip install spidev #python3 sudo apt-get update sudo apt-get install python3-pip sudo apt-get install python3-pil sudo apt-get install python3-numpy sudo pip3 install RPi.GPIO sudo pip3 install spidev
Open Raspberry Pi terminal and run the following command
sudo apt-get install p7zip-full sudo wget https://www.waveshare.net/w/upload/a/a8/LCD_Module_RPI_code.7z 7z x LCD_Module_RPI_code.7z -O./LCD_Module_code cd LCD_Module_code/RaspberryPi/
Run the demo codes
Please go into the RaspberryPi directory (demo codes) first and run the commands in terminal
- Re-compile the demo codes
cd c sudo make clean sudo make -j 8
This examples are made for multi-dusplay, you can input the type of the LCD when using.
sudo ./main <
Use the command according to LCD:：
sudo ./main 0.96 sudo ./main 1.14 sudo ./main 1.28 sudo ./main 1.3 sudo ./main 1.54 sudo ./main 1.8 sudo ./main 2
- Enter the python directory and run ls -al
cd python/examples ls -l
|0inch96_LCD_test.py||0.96inch LCD example|
|1inch14_LCD_test.py||1.14inch LCD example|
|1inch28_LCD_test.py||1.28inch LCD example|
|1inch3_LCD_test.py||1.3inch LCD example|
|1inch8_LCD_test.py||1.8inch LCD example|
|2inch_LCD_test.py||2inch LCD example|
- Run the example
# python2 sudo python 0inch96_LCD_test.py sudo python 1inch14_LCD_test.py sudo python 1inch28_LCD_test.py sudo python 1inch3_LCD_test.py sudo python 1inch54_LCD_test.py sudo python 1inch8_LCD_test.py sudo python 2inch_LCD_test.py # python3 sudo python3 0inch96_LCD_test.py sudo python3 1inch14_LCD_test.py sudo python3 1inch28_LCD_test.py sudo python3 1inch3_LCD_test.py sudo python3 1inch54_LCD_test.py sudo python3 1inch8_LCD_test.py sudo python3 2inch_LCD_test.py
The examples are tested in Arduino UNO, if you want to use other versions of the Arduino, you need to change the connection according to the actual boards.
Run the example
Run the project according to the actual display type
For examples: 1.54inch LCD Module. Enter the LCD_1inch54 directory and run the LCD_1inch54.ino file
Run the project and choose Arduino UNO as Board
Select the COM Port according to your Device Manager
Compile and download it to your board
The examples are based on STM32F103RBT6 as well as the connection table. If you want to use other MCU, you need to port the project and change the connection according to the actual hardware.
Use Waveshare XNUCLEO-F103RB as examples
About the examples
|LCD_0in96_test()||0.96inch LCD example|
|LCD_1in14_test()||1.14inch LCD example|
|LCD_1in28_test()||1.28inch LCD example|
|LCD_1in3_test()||1.3inch LCD example|
|LCD_1in54_test()||1.54inch LCD example|
|LCD_1in8_test()||1.8inch LCD example|
If you require technical support, please go to the Support page and post a tickets.