7.9inch DSI LCD

From Waveshare Wiki
Revision as of 01:37, 10 August 2022 by Eng52 (talk | contribs)
Jump to: navigation, search
7.9inch DSI LCD
7.9inchLCD.jpg

400 x 1280, RPI, DSI
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Feature

  • 7.9inch IPS display with capacitive touch panel, hardware resolution is 400 x 1280.
  • Capacitive touch, supports up to 5-point touch.
  • Toughened glass capacitive touch panel, 6H hardness.
  • DSI interface, refresh rate up to 60Hz.
  • Working with Raspberry Pi, we provide the driver for Raspberry Pi OS.
  • Brightness is adjustable by software.
  • Support Pi 4B/3B+/3A+, CM3+/4 ,must be used with adapter cable.

Working with RPi

Hardware Connection

1. Turn the DIP switch on the back of the LCD to I2C0 or I2C1 mode, the Bullseye branch uses I2C0, and the Buster branch uses I2C1. The default is I2C0 mode.
7.9inchCD001.jpg
2. Use a 15PIN FPC cable to connect the 7.9inch DSI LCD to the DSI interface of the Raspberry Pi.
3. Fix the Raspberry Pi to the screen with screws, and pay attention to the alignment of the ejector pins. The final connection is shown below:
7.9inch DSI LCD2.png
Note: If you don't know the difference between the two branches of Raspberry Pi OS, you can check the following #Raspberry Pi OS branch introduction.
4. If the Raspberry Pi and the screen are not locked in the back lock as described above, an additional Dupont cable is required to provide power and I2C communication through the Raspberry Pi.

Software Debugging

1) Download image from the Raspberry Pi website.

2) Connect the TF card to the PC, use SDFormatter software to format the TF card.

3) Open the Win32DiskImager software, select the system image downloaded in step 1, and click ‘Write’ to burn the system image.

4) After the programming is completed, connect the TF card to the Raspberry Pi, start it and log in to the terminal of the Raspberry Pi (you can connect the Raspberry Pi to an HDMI display or log in remotely with ssh).

git clone https://github.com/waveshare/7.9inch-DSI-LCD.git
cd 7.9inch-DSI-LCD
#Check the bits of the current system. If your system is 32 bits, then it will enter 32 directory. If your system is 64 bits, then your system will enter 64 directory
cd 32
#cd 64
#Enter uname -a in the terminal to view the kernel version and enter the corresponding file directory
cd 5.15.32
sudo ./WS_7_9inchDSI400x1280_MAIN.sh
sudo reboot

Note: The above steps need to ensure that the Raspberry Pi can be connected to the Internet normally.
5. Wait for the system to restart, it will be able to display and touch normally.

Rotation

Method 1

In the start menu, select: Preferences->Screen Configuration->Configure->Screens->DSI-1->Orientation, select the corresponding angle in it, click "√", select Yes, and restart.
4inch-DSI-LCD-Manual-02.jpg

Method 2

Display Rotation

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
#Enter the command corresponding to the display rotation angle at the end of the autostart file, and it will take effect after restarting
#display rotated 90 degrees
xrandr --output DSI-1 --rotate right
#display rotated 180 degrees
xrandr --output DSI-1 --rotate inverted
#display rotated 270 degrees
xrandr --output DSI-1 --rotate left

Touch to Rotate:

sudo nano /boot/config.txt
#Modify the instruction of the touch rotation angle at the end of the config.txt file, and it will take effect after restarting (there is a 0° touch direction instruction by default)
#90°:
dtoverlay=WS_7_9inchDSI400x1280_Touch,invertedy,swappedxy
#180°:
#dtoverlay=WS_7_9inchDSI400x1280_Touch
#270°:
#dtoverlay=WS_7_9inchDSI400x1280_Touch,invertedx,swappedxy
#0°:
#dtoverlay=WS_7_9inchDSI400x1280_Touch,invertedx,invertedy

Backlight Control

Method 1

Put dtoverlay=WS_7_9inchDSI400x1280_Screen in the /boot/config.txt file.

Change to: dtoverlay=WS_7_9inchDSI400x1280_Screen,Backlight=x # (x is 0-255, 0 is the darkest, 255 is the brightest, the default is the brightest).

Such as: dtoverlay=WS_7_9inchDSI400x1280_Screen,Backlight=255.

You can restart it at reboot.

Method 2

Corresponding application is provided (this program is only used for raspbian system), users can download, install and use in the following ways:

cd 7.9inch-DSI-LCD
cd brightness
sudo ./install.sh

After the installation is complete, you can open the program in the Start menu - "Accessories - "Brightness, as shown below:
7-DSI0000 iSpt.png

How to Use CSI in Buster

Note: If you don't know the difference between the two branches of Raspberry Pi OS, you can check the following #Raspberry Pi OS branch introduction.

  • Description

When the DSI LCD is used, the KMS display driver needs to be loaded, which will clash with the default camera subsystem raspicam of the Buster branch.

The libcamera camera subsystem needs to be compiled and installed before the CSI camera related to the Raspberry Pi can be used normally.

If you use the Bullseye branch, no operation is required and you can use the Raspberry Pi related CSI camera directly.

  • Hardware Connection

Turn off the Raspberry Pi first, connect the Raspberry Pi camera, and power on the Raspberry Pi.
Note: It is not allowed to plug and unplug the Raspberry Pi camera when power is on, otherwise it may cause the related circuit to burn out.

  • Update and open the camera interface

The libcamera-apps application supports Pi3 and Pi4. Before installing, you need to update your Raspberry Pi software:

sudo apt update

Set the correct dtoverlay in /boot/config.txt according to the actual camera.

sudo nano /boot/config.txt

Add at the end of the document:

# Take RPi Camera V2 as an example, the photosensitive chip is Sony IMX219, then add the following code:
dtoverlay=imx219
#Similarly, OV5647 chip:
#dtoverlay=ov5647
#IMX477 chip:
#dtoverlay=imx477

Open the camera interface and execute the following commands:

sudo raspi-config

Select 3 Inteface Options -> P1 Camera -> Enter -> Yes -> Finish -> Yes, then the Raspberry Pi will restart.

Install Libcamera

Method 1

Note 1: It is recommended to use Pi4 to install and compile libcamera-apps instead of Pi3, because Pi4 has stronger performance and compilation is not prone to errors. The compiled image can also be used on Pi3.

Note 2: In the process of installing libcamera, it is very likely that some steps will go wrong. If you are a novice, it is recommended to directly burn #Method 1: Use a pre-installed driver image, in which we have installed libcamera.
Install all required dependencies for libcamera:

sudo apt install libboost-dev -y
sudo apt install libgnutls28-dev openssl libtiff5-dev -y
sudo apt install qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5 -y
sudo apt install meson -y
sudo pip3 install pyyaml ply
sudo pip3 install --upgrade meson

Now we can download and build libcamera:

git clone git://linuxtv.org/libcamera.git
cd libcamera
meson build
cd build
meson configure -Dpipelines=raspberrypi -Dtest=false
cd ..
ninja -C build
sudo ninja -C build install
  • libepoxy

Libcamera-apps requires libepoxy to be installed. First, install its prerequisites:

sudo apt install libegl1-mesa-dev

Then download and build libepoxy:

cd
git clone https://github.com/anholt/libepoxy.git
cd libepoxy
mkdir _build
cd _build
meson
ninja
sudo ninja install
  • libcamera-apps

Libcamera-apps further operates as follows:

sudo apt install cmake libboost-program-options-dev libdrm-dev libexif-dev

To build libcamera-apps, enter:

cd
git clone https://github.com/raspberrypi/libcamera-apps.git
cd libcamera-apps
mkdir build
cd build
cmake ..
make -j4

Finally, use the libcamera-hello command to open a 5-second preview camera screen:

./libcamera-hello

Introduction to related instructions:

libcamera-still # can be used instead of raspistill.
libcamera-vid # can be used instead of raspivid.
libcamera-raw A version of #libcamera-vid that saves uncompressed raw video files.
libcamera-hello #Startup command, run it to see the camera image on the display.
libcamera-jpeg # A stripped-down version of libcamera - can still run preview and capture JPEG, uninterrupted by other options.

Note: After installing libcamera-apps, the original DSI driver will be overwritten. In order to make the DSI LCD work normally, you need to reinstall the driver:

#For 7inch DSI LCD (C) use:
cd 7inch-DSI-LCD-C
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_7inchDSI1024x600_MAIN.sh
sudo reboot
#For 4inch DSI LCD use:
cd 4inch-DSI-LCD
cd xxx/xxx #Different kernels and interfaces require different directories
sudo ./WS_4inchDSI480x800_MAIN.sh
sudo reboot
#For 2.8inch DSI LCD use:
cd 2.8inch-DSI-LCD
cd xxx/xxx #Different kernels and interfaces require different directories
sudo ./WS_2_8inchDSI480x640_MAIN.sh
sudo reboot
#For 7.9inch DSI LCD use:
cd 7.9inch-DSI-LCD
cd xxx/xxx #Different kernels and interfaces require different directories
sudo ./WS_7_9inchDSI400x1280_MAIN.sh
sudo reboot
#For 11.9inch DSI LCD use:
cd 11.9inch-DSI-LCD
cd xxx/xxx #Different kernels and interfaces require different directories
sudo ./WS_11_9inchDSI320x1480_MAIN.sh
sudo reboot

Method 2

Since there are many steps to install libcamera, it takes a long time. So we provide a script for direct installation.

The specific operation steps are as follows:

1. Update the list of available packages.

sudo apt update

2. Download the libcamera-install file and install it.

git clone https://github.com/waveshare/libcamera-install.git
cd libcamera-install
sudo chmod +x install_libcamera_all.sh
sudo ./install_libcamera_all.sh

3. When echo "install Succeed" appears, the installation is successful. When echo "install Fail" appears, the installation failed.

After successful installation, three folders, libcamera, libcamera-apps and libepoxy will be generated in the libcamera-install directory. If you need to reinstall, you should delete these three folders first, and then reinstall.

Affected by the network, the installation may be unsuccessful if you run it once, and you can run it several times.
Note: After installing libcamera-apps, the original DSI driver will be overwritten. In order to make the DSI LCD work normally, you need to reinstall the driver:

#For 7inch DSI LCD (C) use:
cd 7inch-DSI-LCD-C
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_7inchDSI1024x600_MAIN.sh
sudo reboot
#For 4inch DSI LCD use:
cd 4inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_4inchDSI480x800_MAIN.sh
sudo reboot
#For 2.8inch DSI LCD use:
cd 2.8inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_2_8inchDSI480x640_MAIN.sh
sudo reboot
cd 7.9inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_7_9inchDSI400x1280_MAIN.sh
sudo reboot
#For 11.9inch DSI LCD use:
cd 11.9inch-DSI-LCD
cd xxx/xxx #Use different kernels, different interfaces, need to enter different directories
sudo ./WS_11_9inchDSI320x1480_MAIN.sh
sudo reboot

4. Reboot

sudo reboot

5. Test, and display 5 seconds camera image.

cd /home/pi/libcamera-install/libcamera-apps/build
./libcamera-hello
  • Advanced

For more instructions on using libcamera, please refer to:

https://www.raspberrypi.org/documentation/linux/software/libcamera/README.md

https://github.com/raspberrypi/libcamera-apps/blob/main/README.md

https://www.raspberrypi.org/documentation/linux/software/libcamera/rpi_SOFT_libcamera_1p2.pdf

Resource

Software

Support

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