• sales

    +86-0755-88291180

Raspberry pi 2inch LCD 240x320 User Guide

【Download】

[] Image: 2inch-240x320-230822.img

[] schematic diagram: 2inch LCD 240x320 with buzzer-230426.pdf

[] Key program: key_test.py

[] Display drive: lcd2.dtbo


【Configuration display】

[] Download lcd2.dtbo copy to /boot/overlays/

Increase display configuration

sudo nano /boot/config.txt

And add that follow code in the configuration file:

dtparam=spi=on

dtoverlay=lcd2:rotate=270

hdmi_force_hotplug=1

max_usb_current=1

hdmi_group=2

hdmi_mode=1

hdmi_mode=87

hdmi_cvt 480 320 60 6 0 0 0

hdmi_drive=2

display_rotate=0

Attention! In the configuration file of Raspberry Pi, please comment out two lines of code dtoverlay=vc4-kms-v3d and max_framebuffers=2:

#dtoverlay=vc4-kms-v3d

#max_framebuffers=2


【Download, compile and install fbcp】

sudo apt update

sudo apt-get install git -y

sudo git clone https://github.com/tasanakorn/rpi-fbcp.git

cd ./rpi-fbcp/

sudo mkdir -m 777 ./build

cd ./build/

sudo apt install libraspberrypi-dev -y

sudo apt-get install cmake -y

sudo cmake ..

sudo make

sudo install fbcp /usr/local/bin/fbcp


【Set auto-start startx and fbcp】

sudo nano ~/.bash_profile


Note: If there is no .bash_profile file, create one yourself


【Add the following code to the bottom of the .bash_profile file】

if [ "$(cat /proc/device-tree/model | cut -d ' ' -f 3)" = "5" ]; then

# Raspberry Pi 5B configuration

export FRAMEBUFFER=/dev/fb1

startx 2> /tmp/xorg_errors

else

# Non-Raspberry Pi 5B configuration

export FRAMEBUFFER=/dev/fb0

sleep 20

fbcp &

startx 2> /tmp/xorg_errors

fi


【Set CLI automatic login】

sudo raspi-config nonint do_boot_behaviour B2

Noto: This command has optional parameters

B1 - Boot to console, requiring login

B2 - Boot to console, logging in automatically

B3 - Boot to desktop, requiring login

B4 - Boot to desktop, logging in automatically

Note: Make sure the username of the Raspberry Pi is pi, otherwise it will not log in automatically


【Switch to X11】

sudo raspi-config nonint do_wayland W1

Note: This command has optional parameters

W1 - Use the X11 backend

W2 - Use the Wayland backend


【The above configuration will take effect after restart】

sudo reboot

Note: After setting all the above configurations, the system will become longer during each restart, and SSH also needs to wait for a while to enter;


【Configure speakers】

Edit configuration file:

sudo nano /boot/config.txt

Add to the configuration file

dtoverlay=audremap,pins_18_19

Save to exit, and then restart:

sudo reboot


Enter the command at the terminal after restarting.

sudo raspi-config

Select system options-> audio->' headset' and restart again.


Enter the system interface, just find an mp3 file and double-click it to play it. If it can play normally, it will be fine.


【Key code test】

Download key_test.py Running code:

sudo python3 ./key_test.py

Press the module button at this time, and the terminal will output a prompt message.


TAG: SpotPear Arduino Board Managers Tutorial User Guide Mobile Robot Wiki Electronic EYE 0.71 inch Round Double LCD Display Dual Screen For Arduino Raspberry Pi ESP32 Pico STM32 Raspberry Pi Pico 2 RP2350 ETH CH9120 TCP/UDP Ethernet Network For Arduino Raspberry Pi 12.3 inch LCD HDMI /Type C Display In-Cell Capacitive TouchScreen 1920x720 For Jetson Nano/mini Computer PC MPUUART Raspberry Pi 5 PCIe to ISO 2-CH RS485 /2-CH RS232 / USB /UART / TTL ESP32 S3 2.1 inch Round LCD Development Board 480x480 TouchScreen Display LVGL HMI With QMI8658C 6-Axis Sensor Industrial Isolated Converter Jetson Orin Nano UGV Beast PT ROS2 AI OpenCV Robot Car MediaPipe Raspberry Pi ESP32 S3 AI 0.85inch Development Board 0.85 inch DeepSeek RGB surround light 240x240 ESP32 S3 4.3inch LCD (B) 800x480 Captive TouchScreen Display Board LVGL with Sensor CAN I2C RS485 ESP32-S3 AI 3.97-inch e-Paper Ink Screen 3.97inch Display AIoT Development Board Deepseek Install Espressif IDF Plugin Tutorial User Guide Core3566102000 Raspberry Pi SIM7670G LTE-4G-Cat-1/GNSS/USB-HUB Expansion Board ESP32-S3 Development Board 4 inch LCD TouchScreen Display 480x480 RS485 /SHT20 /Relay For Arduino LVGL 86 TVbox