Issue No. 163
- 1) WF0200BTYAJDNG10 – 2 inch IPS TFT with PCAP Touch
- 2) WF22GN5AB2DNN0 – 2.13 inch Mono TFT with LPRD (Low Power Reflective LCD)
- 3) WF101JSYFHLHBV – 10.1 inch HDMI Signal IPS TFT LCD with PCAP Touch
- 4) WL0F00050000FGAAASA01 – 5 inch Smart Display High Brightness CAN TFT
- 5) SmartDisplay RS485 Introduction
WF0200BTYAJDNG10 is a 2-inch Portrait Mode IPS TFT-LCD display with a Projected capacitive touch panel (PCAP) resolution of 240×320 pixels. This TFT module is built-in with ST7789VI driver IC; supports MCU and SPI interfaces; the PCAP touchscreen is built-in with GT911 IC, which communicates via the I2C interface. The WF0200B TFT series has without touch panel option; please check the Winstar webpage of WF0200BSYAJDNN0 (with high brightness) for more detailed information.
WF0200BTYAJDNG10 is adopted IPS panel which is having the advantage of wider view angle of Left:80 / Right:80 / Up:80 / Down:80 degree (typical), contrast ratio 800:1 (typical value), brightness 400 nits (typical value), aspect ratio 3:4, the supply voltage for analog 2.4V to 3.6V, typical value 3.3V. This TFT module can be operating at temperatures from -20℃ to +70℃; its storage temperatures range from -30℃ to +80℃.
WF22GN5AB2DNN0 is a 2.13-inch Portrait Mode Mono TFT display with an LPRD (Low Power Reflective LCD) resolution of 122×250 pixels, built-in ST7306 driver IC that supports 8-bit MCU, 4-line SPI/3-line SPI interfaces. This WF22G Mono TFT series adopted a Reflective type LCD, which has the below advantages:
- Sunlight readable; Reflective LCD is suitable for outdoor applications
- Vivid Color, visible on cloudy days or early morning, reflective displays improve visual quality
- UV Resistance (Glass LCD base)
- Extra Low power consumption; slim and light
- Mono TFT; looks like electronic paper
- Fast refresh rate, suitable for dynamic information display
- Eyes care; remove backlight (blue light) to reduce eye hazards
WF22GN5AB2DNN0 adopted mono TFT with LPRD technology featured of view angle of Left:65 / Right:65 / Up:65 / Down:65 degree (typical), the supply voltage for logic (VDDA) is 2.55 to 3.6V, with the typical value of 3.3V, aspect ratio 18:9, anti-glare glass. This Mono TFT module can be operating at temperatures from -20℃ to +70℃; its storage temperatures range from -30℃ to +80℃.
The LPRD (Low Power Reflective LCD) can be used in smart retail, such as shelf labels, sports health, such as bicycle recorders, fishing rod reels, handheld devices, transportation, such as EV charging, wearable or portable devices, etc.
WF101JSYFHLHBV is a 10.1-inch high brightness version IPS TFT display with resolution 1024×600 pixels. WF101JSYFHLHBV has a PCB board featuring an HDMI connector that supports HDMI signal (only for DVI) interface and has a 40-pin GPIO connector designed to make Raspberry Pi usage easy. This module featured four studs for the backlight, and the PCB adopted the locking method attached to the module. WF101JSYFHLHBV is adopted IPS panel which has a wider viewing angle of Left:85 / Right:85 / Up:85 / Down:85 degree (typical value). This TFT model is built-in with EK79001HN and EK73215BCGA driver ICs, high brightness of 950 nits (typical value). This TFT model is built-in with ILI2511 touch panel driver IC on the module, which supports USB interface, and single-touch or multi-touch (option) detection points.
The supply voltage for LCM (VDD) of WF101JSYFHLHBV is 4.7~5.3V, typical value 5V, glare surface glass, aspect ratio 16:9, contrast ratio 800:1 (typical value). It can be operating at temperatures from -20℃ to +70℃ and storage temperatures from -30℃ to +80℃.
WL0F00050000FGAAASA01 is a 5-inch high brightness TFT Smart Display CAN series display that is running CANopen protocol via CAN bus command to render display content on the screen and return touch event data with protocol objects. WL0F00050000FGAAASA01 features Winstar high brightness IPS TFT WF50FSWAGDNG0 and a 4-layers FR4 PCBA built-in firmware code developed by the Winstar RD team. This 5″ CAN series TFT is an easy-to-use product that allows you to create projects rapidly and cost-effectively.
Winstar already developed Windows Apps (GUI & GUI Builder) for Smart Display GUI design. This 5″ IPS TFT Smart Display can use a computer with USB2CAN dongle or Raspberry Pi (+PiCAN2) or even an MCU scale like Arduino (+CAN adaptor) as a HOST platform. Winstar GUI builder software is designed for customers to simulate their UI design in advance using the drag-and-drop Widget preview function. Furthermore, customers can create their ideal UI objects using this software and then go through simulation to check UI design without a hardware module. Winstar GUI builder software only supports the Windows system; it can fulfill What You See Is What You Get (WYSIWYG).
There are many essential features and functions for this newly released Smart Display IPS 5″ TFT as below:
- CAN interface with long transmission distance & anti-noise
- Supports CANopen protocol, default baud rate at 250KB
- WF50FSWAGDNG0 with CTP Module
- Built-in flash memory (16MB) to store the font and Object Dictionary Data
- DC 5V working voltage
- Built-in Buzzer
- Power-On Splash screen (Customer can replace it by themselves)
- Demo set HOST can be used on multiple platforms, such as Computer (with USB2CAN Dongle), MCU, Single Board Computer with Linux OS, or Raspberry Pi (with PiCAN2).
- Design the UI without writing a line of code by Winstar GUI builder! (►Link to GUI Builder Introduction)
Winstar developed a Windows app. for Smart Display GUI design. Winstar GUIbuilder software allows customers to simulate their GUI design in advance using the drag-and-drop Widget preview function; customers can also create their ideal GUI. Winstar GUI builder software supports Windows systems only; it can fulfill What You See Is What You Get (WYSIWYG). The upgraded version of built-in software is a 3-in-1 APP; we combined three application templates for optional, including industrial, vehicle, and medical applications. Please press the preferred application and hold power on for 3 seconds the first time. Customers can change to another template by using GUIbuilder to change the application.
The concept of control methods for cross-platform
Smart Display has been widely used in various fields such as medical, industrial control, and automotive after products launched. Simply put, it is a display combined with a microcontroller, which can handle complex graphics loading, setting, display, and even input, and the outside device (host i.e.) can perform interactive operations with simple commands, so it is very suitable for various needs. Various types of applications displayed or controlled.
Smart Display supports a variety of communication interfaces. Currently the most commonly used ones are CAN/CANopen, RS485/Modbus, and more choices will be provided in the future. Among them, RS485/Modbus is a popular communication interface in the industry, and various RS485 devices at reasonable prices are easily available on the market. The line structure is simple, as long as two wires (RS485_A/RS485_B) can communicate, and the communication interface is usually presented in the form of “Serial Port” on an operating system, and each platform has a corresponding development function library. In addition, the Modbus protocol is quite easy to understand, so we put it as an example as following for experiments and explanations.
This article will introduce how to control Smart Display from simple to deep, understand its control principle, and finally introduce how to make cross-platform applications. Whether you are an industrial equipment expert or a DIY player, welcome to the world of Smart Display with us!
A Smart Display that supports RS485 interface is required for connecting test.
Since a host like PC/Raspberry Pi normally does not have RS485 port, we can utilize various USB to RS485 dongle if necessary.
When reach the above requirements, then can choose a test bench execution environment as a Host. The only condition for a host device is to be able to read and write the series port of host no matter the OS is Windows, MacOS, various Linux (including Raspbian for Raspberry Pi), or the platform is Single Board Computer, Arduino etc.
We create a single-board computers have built-in RS485 of Demo.set for convenience, which can be used as a host device as below picture directly.
III. Simple test for control interface:
Get the control code
In order to understand how to collaborate in Smart with a host. First issue we need to get the control code. The easiest way is to get it from Smart Display GUI Builder. GUI Builder is an excellent support software for Smart Display. It can help us learn, operate, design, and display user interface without hardware physical device, design UI without writing any program at all. With the WYSIWYG feature, user interface design can be done by dragging or clicking buttons or objects. In addition, there is a built-in simulator that shares source code with Smart Display, thus ensuring the same appearance and behavior as the physical device. Even better, it’s free!
Double click GUI Builder to run the app in Windows OS, open a project. Here we choose the 5″ RS485 Smart Display WL0F00050000FGDAASA00, and the default scenario below is Vehicle. Input the project name, press Create button to create project. If it has been created before, you can also select project directly from the menu on the right.
When the project is opened, select the interface first
Select RS485 for the Interface, and the RS485 Port of host should be set as the actual port of the connected port for RS485 dongle. If there is any doubt, you can check the port name in the device administrator (repeatedly unplug it and see that it disappears or shows which one is displayed). Baudrate can keep the default value of 115200.
However, if there is no Smart Display RS485 device yet, it does not matter, as long as the Interface selects RS485, the RS485 Port can be ignored for now, because now we will just utilize the simulator, and will not connect to the Smart display device practically.
Click Simulator/Simulator with GUI to run:
After execution, you can see the simulation screen, the control items of each object; and the communication data record on the right side of the screen. Change the value of any object to see the content of the command accordingly:
Every action will see two commands TX/RX, because the display device (even if it is actually an emulator now) will send back the same command as acknowledge after receiving the command to indicate that it has been received.
We record several different values for different objects, and the next step can be used to control the physical device.
RS485 uses the differential pair to transmit & receive signals, so as long as these two wires can be connected, even the ground wire is not needed. The name of the signal line of RS485 is A/B, just follow it (A connect A, B connect B).
How is a host to transmit control codes from itself? As long as it can write to a serial port. However, there are two things to keep in mind before go ahead for testing.
1. Since the names of the Com Ports on different operating systems are different, please check and confirm before testing. For examples the following table:
2. The permission of the Com Port of some operating systems is not open by default. It must be set before using it. Taking Linux/Ubuntu as an example, if the name of the Com Port is ttyUSB0, just execute it in the terminal:
sudo chmod 666 /dev/ttyUSB0
Below two test methods are provided:
Serial Port Terminal Control
Use the serial port terminal software that supports hexadecimal input, and directly input the hexadecimal control code after connecting:
If it is normal, you should be able to see that the objects on the device act according to different control codes.
But this method is only used to test whether the connection is successful, and it is not very convenient in practical application. To achieve the best results, it has to be done through the program. As for which language? In fact, we can, let’s try it first with the popular cross-platform programming language python.
The following programs are executed using python3. The program structure is quite simple, just directly write three sets of control codes into the serial port every one second, so that the instrument on the device continues to rotate.
from time import sleep”””
The name of Com Port varies according to the operating system, For example:
Raspberry Pi: /dev/ttyUSBn (e.g. /dev/ttyUSB0)
Windows: COMn (e.g. COM22)
# Raspberry Pi / Rasbian
# COM_PORT = ‘/dev/ttyUSB0’
COM_PORT = ‘COM22’v000 = bytes.fromhex(‘7B06000600006251’)
v050 = bytes.fromhex(‘7B0600060032E384’)
v100 = bytes.fromhex(‘7B060006006463BA’)
ser = serial.Serial(COM_PORT, 115200)
The python source code can be executed on a variety of platforms, so as long as the serial port is named correctly, it should work fine with the appropriate connection test bench.
However, these fixed control codes as example must not be in line with practical applications, so we need to understand the content of these instructions in order to give full play to them.
IV. control code analysis
Compare commands with different values for the same object:
It is not difficult to find that the blue part is the value of the object we set.
Compare different objects, the same value command:
The blue part obviously refers to some kind of index or address to the object.
As for the data of the last two bytes, it seems that there are no rules. What are those messages meaning though? Let’s explain in following.
Control code analysis
In fact, the content of these 8 bytes is the so-called Modbus message. Simply use a picture to illustrate the meaning of each field:
Each Modbus device must have an identification code. Smart Display’s identification code is 0x7B = 123
Function code, indicating the purpose of this message, for example, 06 here is Write Single Register, which also writes a value to the specified place.
The register address, which is the destination to be written to (that is, the address of the object).
What to write (that is, the value of the object)
The result of CRC (Cyclic Redundancy Check) on the first 6 bytes is used to check whether there is an error in the data during the transmission process.
Do you have some concepts? If you want to know more, you have to look at what Modbus is.
V. Modbus Introduction
The Modbus protocol is actually a data format. It basically defines the communication content of a master-slave architecture. Since it is only the definition of the data structure, it can communicate through various physical interface, such as RS232, RS422, RS485, and even the network.
Since there are already many teaching and explanatory documents on the Internet, Modbus will not be described in detail here. In fact, as long as you know some concepts, you can use Modbus freely.
Modbus regards data transmission as “Register” access. Each device must define its own register type and address for external reference. The so-called transmission of data to the device is to write to the specified register, and to read the data is to read the specified register, which is simple and clear. In addition, the value stored in each address register is 16-bits.
According to the characteristics of the data, Modbus defines several methods of reading and writing, which are specified by the function code in the message.
For Smart Display control programs, the most commonly used are 06: Write single register (write a 16-bits value) and Read holding registers (read the value of multiple registers).
The last 2 bytes seems the most mysterious part is actually not difficult. It’s just a CRC (Cyclic Redundancy Check) to insure the communication data. We don’t necessarily have to study its principle in depth (but in fact, it is just a table lookup and bit operation, and finally a 16-bit check code is obtained), as long as we understand how to use it.
VI. Control Smart Display objects
As mentioned earlier, each Modbus needs to define the type and address of the register, and now we will discuss this topic.
Smart Display registers can be roughly divided into three categories:
Device information (e.g. version, device name, etc.)
Use 04: Read Input Registers to read. These data will only be changed when the firmware is updated, usually when it is just connected, to obtain the device characteristic parameters.
Object properties (eg kind, location, etc.)
Use 03: Read Holding Registers/16: Write Multiple Register to read and write. These data affect the appearance of objects and usually do not change outside the design stage. To change the content, the Smart Display must be temporarily turned off before it can be updated.
Object Values (values that the object represents, such as RPM, on or off, percentage, etc., varies from object to object)
This is the main change item in the operation. Each element uses a 16-bit value, so it is set with 06: Write Single Register.
The following is an organized list of these registers:
Early Smart Display supports only 10 objects, so the widgetID range is 0 ~ 9 (inclusive). The new version of the firmware has been expanded to 64, but the addressing method has been changed, which will not be discussed here.
With these data (although not complete, but enough for now), we can package the control instructions and send them to Smart Display for control. As for how to pack and how to add CRC code, it will be explained in the following chapters.
VII. User Interface
In order to put Smart Display into practical application, a suitable human-machine interface (especially Graphics User Interface, GUI) is still needed to maximize its effectiveness. At present, there are many choices for the cross-platform GUI development platform, and we use Qt to implement it here.
Many people think that Qt is just a GUI library, but in fact it is a fairly complete development framework. If the application is implemented entirely through its class library, the project can be easily ported to other platforms (PC/Windows, Mac/MacOS, Raspberry Pi/Raspbian, Android, iOS, Embedded, etc.) with little modification. The program is a development tool software that is worth investing in learning.
The newer version of Qt actually already supports the Modbus class library. But here for illustration, and to facilitate everyone to rewrite into other languages, we still implement this test program from the most basic serial port reading and writing.
In addition to providing he function of selecting the serial port and transmitting the control code used in the previous example, this example further provides a horizontal lever in users interface of app window, which can set the value of the specified object. If you choose COM for the serial port, remember to fill in the actual number.
The following picture shows the execution screen of this program on Raspberry Pi and Ubuntu. The program does not need to be modified at all.
The CRC operation is actually not complicated. It is probably like below codes with Qt:
|QByteArray SetWidgetValue::calculateCRC(QByteArray data)
uint16_t crc = 0xFFFF;
for(int idx = 0; idx < data.length(); idx++)
uint8_t i = (uint8_t)crc ^ data[idx];
crc >>= 8;
crc ^= crcTable[i];
ba.append(char(crc & 0xFF));
ba.append(char(crc >> 8));
The contents of crcTable are:
|const uint16_t crcTable =
0X0000, 0XC0C1, 0XC181, 0X0140, 0XC301, 0X03C0, 0X0280, 0XC241,
0XC601, 0X06C0, 0X0780, 0XC741, 0X0500, 0XC5C1, 0XC481, 0X0440,
0XCC01, 0X0CC0, 0X0D80, 0XCD41, 0X0F00, 0XCFC1, 0XCE81, 0X0E40,
0X0A00, 0XCAC1, 0XCB81, 0X0B40, 0XC901, 0X09C0, 0X0880, 0XC841,
. . .
0X8801, 0X48C0, 0X4980, 0X8941, 0X4B00, 0X8BC1, 0X8A81, 0X4A40,
0X4E00, 0X8EC1, 0X8F81, 0X4F40, 0X8D01, 0X4DC0, 0X4C80, 0X8C41,
0X4400, 0X84C1, 0X8581, 0X4540, 0X8701, 0X47C0, 0X4680, 0X8641,
0X8201, 0X42C0, 0X4380, 0X8341, 0X4100, 0X81C1, 0X8081, 0X4040
Not every codes are listed here. There is complete information in github that users can do download by themselves if interesting on programming, in this article we just know how to operate with the data format.
The following is the key function that calculates the control code according to the UI and sends it to Smart Display:
|void SetWidgetValue::on_sbValue_valueChanged(int value)
int id = ui->edWidgetID->text().toInt();
}void SetWidgetValue::sendWidgetValue(int id, int value)
uint16_t addr = (uint16_t)(id * 100 + 6);
msg.append((uint8_t)addr >> 8);
msg.append((uint8_t)addr & 0xFF);
msg.append((uint8_t)value >> 8);
msg.append((uint8_t)value & 0xFF);
QByteArray msgToSend = msg.append(calculateCRC(msg));
If you are already familiar with Qt, the above code should not be difficult to understand. If you are not familiar with it, take a moment to study it, some of its concepts are actually quite good and worth studying in depth. After getting familiar with it, it is a good choice for developing cross-platform applications or quickly prototyping a system.
VIII. Advanced example
The previous example is only for a setting of the object value. There is a more complete example SmartDisplayConsole application program for interested readers to learn more about. The following picture is the execution screen on the Raspberry Pi:
There is a github URL at the end of the article, and everyone is welcome to refer to and study together.
We have explained every step of controlling the Smart Display, and also provide a variety of control methods. Using this knowledge and rich imagination, I believe that various sparks can be stirred up and more diverse products can be produced. Let’s create a better future with Smart Display together!
Serial Terminal Basics
XI. Sample source code
► Link to Technology web page