Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
1.44-inch LCD HAT, SPI interfaces.
PIN | Raspberry Pi Interface (BCM) | Description |
KEY1 | P21 | KEY1GPIO |
KEY2 | P20 | KEY2GPIO |
KEY3 | P16 | KEY3GPIO |
Joystick UP | P6 | Upward direction of the Joystick |
Joystick Down | P19 | Downward direction of the Joystick |
Joystick Left | P5 | Left direction of the Joystick |
Joystick Right | P26 | Right direction of the Joystick |
Joystick Press | P13 | Press the Joystick |
SCLK | P11/SCLK | SPI clock pin |
MOSI | P10/MOS | SPI data pin |
CS | P8/CE0 | Chip selection |
DC | P25 | Data/Command control |
RST | P27 | Reset |
BL | P24 | Backlight |
The ST7735S is a 132*162 pixel LCD controller, but the pixel of the 1.44-inch LCD HAT is 128*128. So we have made some processing on the display: the horizontal direction starts from the second pixel to guarantee the location of RAM in the LCD is consistent with the actual location at the same time.
This LCD accepts 8-bits/9-bits/16-bits/18-bit parallel interfaces, which are RGB444, RGB565, and RGB666. The color format used in demo codes is RGB565.
This LCD uses a 4-wire SPI interface for reducing GPIO, and the communication speed will be faster.
Note: Different from the traditional SPI protocol, the data line from the slave to the master is hidden since the device only has a 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 the SPI interface;
SCL works the SCLK pins of the 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 an idle state. When CPOL = 0, the level is Low. However, CPOL has little effect on the transmission.
CPHA determines whether data is collected at the first clock edge or at the second clock edge of the 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.
sudo raspi-config Choose Interfacing Options -> SPI -> Yes to enable SPI interface
Reboot Raspberry Pi:
sudo reboot
Please make sure the SPI is not occupied by other devices, you can check in the middle of /boot/config.txt
If you use bookworm system, only the lgpio library is available, bcm2835 and wiringPi libarary cannot be installed or used. Please note that the python library does not need to install, you can directly run the demo.
#Open the Raspberry Pi terminal and run the following command wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz tar zxvf bcm2835-1.71.tar.gz cd bcm2835-1.71/ sudo ./configure && sudo make && sudo make check && sudo make install # For more, you can refer to the official website at: http://www.airspayce.com/mikem/bcm2835/
#Open the Raspberry Pi terminal and run the following command cd sudo apt-get install wiringpi #For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required: wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v # Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error # Bullseye branch system using the following command: git clone https://github.com/WiringPi/WiringPi cd WiringPi . /build gpio -v # Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error
wget https://github.com/joan2937/lg/archive/master.zip unzip master.zip cd lg-master sudo make install #for more details, you can refer to https://github.com/gpiozero/lg
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 spidev
Open the Raspberry Pi terminal and run the following command:
sudo apt-get install p7zip-full -y wget https://files.waveshare.com/upload/f/fa/1.44inch-LCD-HAT-Code.7z 7z x 1.44inch-LCD-HAT-Code.7z sudo chmod 777 -R 1.44inch-LCD-HAT-Code cd 1.44inch-LCD-HAT-Code/RaspberryPi/
cd c sudo make clean make sudo ./main
For Raspberry Pi 4B and the system later than raspbian_lite-2019-06-20, you need to set it as follows, and the key can be input normally.
sudo nano /boot/config.txt #Add the following: gpio=6,19,5,26,13,21,20,16=pu
cd python sudo python main.py sudo python key_demo.py
PS: FBCP currently is not compatible with the 64-bit Raspberry Pi system or Bookworm, and it is recommended to use the 32-bit system.
The Framebuffer uses a memory area to store the display content and changes the data in the memory to change the display content.
There is an open-source project on github: fbcp-ili9341. Compared with other fbcp projects, this project uses partial refresh and DMA to achieve a refresh rate of up to 60fps.
sudo apt-get install cmake -y cd ~ wget https://files.waveshare.com/upload/1/18/Waveshare_fbcp.zip unzip Waveshare_fbcp.zip cd Waveshare_fbcp mkdir build cd build
If you are using 1.44inch_LCD_HAT:
cmake -DSPI_BUS_CLOCK_DIVISOR=20 -DWAVESHARE_1INCH44_LCD_HAT=ON -DBACKLIGHT_CONTROL=ON -DSTATISTICS=0 ..
If you are using 1.3inch_LCD_HAT:
cmake -DSPI_BUS_CLOCK_DIVISOR=20 -DWAVESHARE_1INCH3_LCD_HAT=ON -DBACKLIGHT_CONTROL=ON -DSTATISTICS=0 ..
Then
make -j sudo ./fbcp
sudo cp ~/waveshare_fbcp/build/fbcp /usr/local/bin/fbcp sudo nano /etc/rc.local
And then add fbcp& before exit 0, as the picture below.
Set the user interface display size in the /boot/config.txt file.
sudo nano /boot/config.txt
Then add the following lines at the end of the config.txt.
hdmi_force_hotplug=1 hdmi_cvt=300 300 60 1 0 0 0 hdmi_group=2 hdmi_mode=87 display_rotate=0
And then reboot the system
sudo reboot
After rebooting the system, the Raspberry Pi OS user interface will be displayed.
There is a joystick and three buttons on the panel of the module, which we can use to control the mouse of the Raspberry Pi.
#python2 sudo apt-get install python-xlib sudo pip install PyMouse wget https://files.waveshare.com/upload/d/d3/Mouse.7z 7z x Mouse.7z sudo python mouse.py #python3 sudo apt-get install python3-xlib sudo pip3 install PyMouse sudo pip3 install unix sudo pip3 install PyUserInput wget https://files.waveshare.com/upload/d/d3/Mouse.7z 7z x Mouse.7z sudo python3 mouse.py
sudo nano /boot/config.txt
And then add the following line at the end of the config.txt.
gpio=6,19,5,26,13,21,20,16=pu
Use the joystick to move up, down, left, and right, you can see that the mouse is moving.
Be careful not to add it to /etc/rc.local, because rc.local will be executed before the system enters the desktop, and if the PyMouse module runs on the command line interface, it will report an error that there is no mouse event, so we need to execute the following:
cd .config/ mkdir autostart cd autostart/ sudo nano local.desktop
And then add the following lines at the end of the local.desktop
#python2 [Desktop Entry] Type=Application Exec=python /home/pi/mouse.py #python3 [Desktop Entry] Type=Application Exec=python3 /home/pi/mouse.py
Reboot the system, you can use the buttons to control the mouse.
sudo reboot
For connecting to the game machine, you can refer to the following links:
https://www.sudomod.com/forum/viewtopic.php?f=11&t=5371&start=10
https://pi0cket.com/guides/tiny-software-for-tinypi/#more-99
gpio=6,19,5,26,13,21,20,16=pu
FBCP does not support 64-bit operating systems, please use 32-bit bullseye or 32-bit Buster image.
Monday-Friday (9:30-6:30) Saturday (9:30-5:30)
Mobile: +86 13434470212
Email: services01@spotpear.com