2.1inch-USB-Monitor

From Waveshare Wiki
Jump to: navigation, search
2.1inch-USB-Monitor
2.1inch-USB-Monitor.jpg
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Working with PC Windows

Hardware Connection

Desktop Secondary Screen: USB Type-C Connection

2.8inch-usb-monitor-hard.jpg

PC Case Secondary Screen: 4PIN Interface Connection

2.8inch-usb-monitor-hard02.jpg

Software Setting

  • 1. Download Waveshare PC Monitor.
  • 2. Install the player driver "K-Lite_Codec_Pack.exe" in the PCMonitor directory:
① Select "Fresh install"

5inch-USB-Monitor Software-1.png

② All select "Next"

5inch-USB-Monitor Software-2.png

③ Click on "Finish" to end the driver installation

5inch-USB-Monitor Software-3.png

  • 3. Double-click to open PCMonitor software, "Connected" on the top left corner, choose your favorite theme on the right side, and click "Run" to display it.

2.8inch USB Monitor05.png


Working with Raspberry Pi Bookworm System

Support Raspberry Pi's latest Raspberry Pi Bookworm 64-bit system:
As the image file prepared is for Windows PC by default, you need to do the following to burn the RPi-specific image!

Raspberry Pi Use Video

RPi-USB-Monitor Image Programming

1. Click to download 2.1inch-USB-Monitor-RPi image.
2. Download the compressed file to the PC, and unzip it to get the .img file.
3. Remove the TF card, use the SDFormatter software to format the TF card.
4. Open the Win32DiskImager software, select the system image prepared in Step 1, and click "Write".
5. After programming, insert the TF card into the card slot of the screen.
6. Using a USB cable to connect the Type-C interface of the screen to the USB interface of the Raspberry Pi.
7. Power on the Raspberry Pi, after waiting for a few seconds, you should see the screen light up with the logo pattern, indicating that the image has been successfully burned.

Python

  • Install the function library:
sudo apt-get install libqt5serialport5 
sudo apt-get install libqt5serialport5-dev -y
  • Run the sample demo:
wget https://files.waveshare.com/wiki/2.1inch-USB-Monitor/2.1inch_USB_Monitor_RPi.zip
unzip 2.1inch_USB_Monitor_RPi.zip
cd 2.1inch_USB_Monitor_RPi/Demo/
sudo python main.py

Set Auto-start

sudo mkdir .config/autostart
sudo nano .config/autostart/local.desktop
#Add the following content to the file:
[Desktop Entry]
Type=Application
Exec=python /home/pi/2.1inch_USB_Monitor_RPi/Demo/main.py t
# /home/pi/2.1inch_USB_Monitor_RPi/Demo/ is a reference path and needs to be changed to the location where you have stored the files. Otherwise, it will not auto-start

Displaying Customized Interfaces

  • 1. Download the Waveshare RPi Monitor software.
  • 2. Make themes/videos/images, see #Theme Customization for specific use of the OP.
  • 3. Change the initialization variables in main.py to the software settings of the host computer. For more information about the code, please #Demo Function Explanation.
  • 4. Copy the made theme/video/image to the corresponding folder for the demo, for example: the made theme must be placed under the 2.1inch_USB_Monitor_B\Demo\theme\480x480 path, if it is not placed in this path, it will not be readable.
  • 5. Run the demo in the terminal.

Demo Function

  • 1. We set 5 functions for the demo:
#Display the theme:
python main.py x    (x could be t/T/theme/THEME, optional)
#Display video:
python main.py x    (x could be m/M/mp4/MP4, optional)
#Display images:
python main.py x    (x could be p/P/png/PNG, optional)
#Display the theme, video, and images:  
python main.py x    (x could be a/A/all/ALL, optional)
#Delete the specified file:
python main.py x    (x could be d/D/del/DEL, optional)

#If there is an input error, the demo will be exited automatically, so please run the demo again.

Main Function Parameters

Parameter Function
NETWORK Set to test the network card
GET_SYSTEM_DATA Check whether to get system data, True for getting, Flase for not getting
ROTATE Setting Screen Flip 1: Flip 180 degrees 0: No flip
BACKLIGHT Set the brightness, 0 is the darkest, 255 is the brightest
Monitor_Is12hour 0: 24-hour system 1: 12-hour system
Monitor_Language 0: Chinese; 1: English (The language settings here need to be consistent with those used when creating the theme on the host computer; otherwise, anomalies may occur in the display.)
Monitor_WeatherTempUnit 0: degrees Celsius 1: degrees Fahrenheit
File_num The number of cycles for display

Function Library Introduction

Monitor.py

Variable Introduction

  • "Custom_data_num" defines the data number.
  • "Custom_data" defines the number of file pointers for storing custom data names (support ASCII only).

Interface

  • def __init__(self,SYSTEM_PATH,NETWORK,GET_SYSTEM_DATA,IS12HOUR,LANGUAGE,WEATHERTEMPUNIT)

Initialization:

SYSTEM_PATH: Set the user path
NETWORK: Set the network card for speed testing
GET_SYSTEM_DATA: Check whether to get system data  
IS12HOUR: Setting the time representation (0: 24-hour system 1: 12-hour system)
LANGUAGE: Language setting (0: Chinese, 1: English). The language setting needs to be consistent with the one used when creating the theme on the host computer; otherwise, anomalies may occur in the display.
WEATHERTEMPUNIT: Setting temperature expression (0: degrees Celsius 1: degrees Fahrenheit)
  • def SetRootDir(self,rootDir)

The Python environment needs to set the directory where the scripts are located.

 rootDir is the directory
  • def SendSystemData(self,key,buff,num)

Send the customized data to the screen:

key: the data name to be sent to the system
buff: the data value to be sent to the system
num: customized the data numbers  
  • def Delete(self)

Delete the specified resource.

  • def Download(self,files,num,time,rotate,backlight)

Download the specified resource and display it on the screen.

files: the file path  
num: the total number of the files
time: cyclic display interval
rotate: display angle, 0°or 180°
r: screen backlight 0~255
  • def start(self)

Set up a timer for sending system parameters.

  • def handle_interrupt(self)

Timer callback function.

Gain_Param.py

  • def GET_IP(self)

Get the IP.

  • def GET_Temp(self)

Get temperature.

  • def net_speed(self,interface, is_download)

Get network speed.

  • def RX_speed(self,network)

Get the current download speed.

  • def TX_speed(self,network)

Get current upload speed.

  • def GET_CPU_Used(self)

Get CPU usage rate.

  • def GET_Memory_Percentage(self)

Get memory percentage.

  • def GET_System_Disk_Used(self)

Get system hard driver usage rate.

Theme Customization

1. Enter "Theme Edit" Interface

2.8inch USB Monitor06.png

2. Video Setting

① Click "+ Video", and set up the original (X, Y) and video size.
② Set the correct video path, save the created video file into the "/video/480x480" file directory, and select it. (PS: H264 encoding format file is required).
③ Click "Save", and the corresponding video is previewed. (you can edit it by right-clicking on the layer). For example, if the original coordinates are set as (0,0), and the video size is 480x480, then the theme will present a full-screen effect.
2.8inch USB Monitor07.png

3. Images Setting

① Click "+ Image", and set up the centered coordinates as (X, Y) and the centered position is (240, 240) by default.
② Set the correct image path, save the created image file into the "/image/480x480" file directory, and select it.
③ Click "Save", and the corresponding image is previewed. (You can edit it by right-clicking on the layer).
2.8inch USB Monitor08.png

4. Clock Setting

① Click "+ Clock", and place the images corresponding to "hour," "minute," and "second" in the "/image/480x480" directory and select them.
② Set the relative positions of three-pointer images and rotate them around the central origin.
③ Open system data and set them separately as "hour," "minute," and "second".
④ Set the maximum values for system data, with "hour" set to 60, and "minute" and "second" set to 60.
2.8inch USB Monitor12.png

5. Text Setting

① Click on "+ Text" to set the text's coordinates ((240,240) is centered by default, and draggable using the mouse).
② Set the text content, FgColor, and font, then click "Save" to apply.
③ After checking "System Data", the corresponding dynamic values of the system data will be displayed.

2.8inch USB Monitor13.png

6. Circular PrgBar Setting

① Click "+ Circular PrgBar " to set up the basic parameters of the circle such as the coordinates, diameter, arc width, and arc spacing.
② Set the color, and it supports three gradient colors (or display one color).
③ Set the starting and ending angles of the arc to control the display direction and arc length.
④ After checking the system data and setting the upper and lower data limits, the corresponding system data will be converted into the dynamic effect of the Circular PrgBar.

2.8inch USB Monitor09.png

7. HOR PrgBar Setting

① Click on "+ HOR PrgBar" to set the basic parameters of the horizontal progress bar, such as its coordinates, width, height, corner radius, and border width.
② Set the border color, the BgColor of the HOR PrgBar, and the FgColor of the content, supporting gradient foreground display. (If not selected, it will display the same color.)
③ After checking 'System Data,' the corresponding system data will be converted into dynamic effects for the HOR PrgBar.

2.8inch-USB-Monitor 10.png

8. Audio Arc Setting

① Click "+ Audio arc" to set the basic parameters such as the circle coordinates and the diameter.
Sound Column Ring Width: The carrier for all sound columns will be displayed in the outer ring of the audio circle.
Sound Column Width: Indicates the width value of each individual sound column, value = 7 is recommended.
Sound Column Width Interval: Indicates the width interval value of each individual sound column, value = 2 is recommended.
Sound Column Max Height: Indicates the max height value of each individual sound column, value = 50 is recommended.
Display Direction: Set the rotation direction of the sound column ring, clockwise or anticlockwise.
Start Position: Set the starting position of the sound column ring, up/down/left/right.
Sound Column Start Color: All column colors are generated by gradient colors, and the starting color represents the gradient starting color of the first independent sound column.
Sound Column End Color: All column colors are generated by gradient colors, and the ending color represents the gradient ending color of the first independent sound column.
Sound Column Ring Color: Indicates the color of the outer sound column ring.
Audio Solid Lines Color: Indicates the middle solid line of the sound column ring.
Audio Dashed Lines Color: Indicates the solid line of the internal sound column ring.
Start Frequency: Set the starting frequency of the microphone or .wav file spectrum; (spectrum range: 1-20000).
End Frequency: Set the ending frequency of the microphone or .wav file spectrum; (spectrum range: 1-20000).
Mic Gain: Sets the degree of amplification for the microphone to acquire the ambient sound input signal and controls the sensitivity to the sound signal; (gain value range: 0-31).
Audio Path: Set the path of .wav audio file, and only take effect when the audio data source is "wav file".
Audio Data Source: Set the data source of the audio signal for the audio circle.

  • "randomNumbers": use the random data frequency.
  • "audio mic": use the mic to get the ambient sound frequency.
  • "wav file": use the frequency band of the .wav audio file.

9. Set up Customized Data

Note: This function is only available in RPi Monitor.
The custom data written in the demo can also be set in the host computer software, see the following figure (the data name only supports ASCII):
2.8inch-USB-Monitor60.png

Resource

FAQ

 Answer:
Due to the software compatibility, it does not support macOS currently. Compatibility for future updates can be achieved through firmware upgrades. Please stay tuned for further information.

{{{5}}}


 Answer:

Supported device: PC and tablet
Supported systems: Win10 and Win11 (Requires a system version from 2021 or later).
Note: the tablet may be not compatible with the fan or other components, it is recommended to analog use before downloading the software.
Secondary development device: Raspberry Pi;
Secondary development system: Raspberry Pi Bookworm;

{{{5}}}


 Answer:

For storing the image, the factory TF card burns the image file by default and places it in the TF slot, so customers can use it when they receive it.
You can also follow the #Working with Raspberry Pi Bookworm System to modify the image file to realize the Raspberry Pi USB interface use.

{{{5}}}


 Answer:

Please check and install the K-Lite.exe driver, restart the Windows computer, and try it again.
How to install K-Lite.exe: keep selecting "Next" until it "Finish".

{{{5}}}


 Answer:

Changing the bootlogo.bmp inside the TF card to a customized image will enable you to modify the boot logo.

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)