Our touch display is the central control element for our control system and replaces the mostly confusing and not particularly attractive control elements from other manufacturers. The core task of our developments was to combine devices and sensors from different manufacturers in one system. This means that we can now display and control this information in a bundled manner via the web interface or the touch screen. However, we are taking a different approach to most manufacturers and are not using an HDMI touch screen, but rather a standalone device that has to be specially programmed. Why we do this and how you can build something of your own can be found in this tutorial.
Countless hours of development went into our display before we got it to this point, so it is anything but trivial.
But since many of you have asked for an open file, we have created a short summary here. This tutorial is a kind of overview of how it works and a guide for enthusiasts to get started.
1. Hardware
First of all, we have to ask ourselves why we are not using an HDMI display with a touchscreen and have decided to develop our own device that still needs to be programmed separately. At first glance, this sounds like a lot more work, so why do we go to this trouble?
First of all, we save ourselves the trouble of laying three cables and reduce it to one network cable. We do without HDMI, USB and power and provide both the power supply and communication via the network cable. This is not a network standard and has nothing to do with networks. In terms of thinking, it is similar to Power-Over-Ethernet, but we only use the widely used RJ45 connections. The communication is via the first serial interface of the Raspberry PI, which is the same on both the 3 and 4. But more on that in a moment when we look at the circuit diagram.
Another reason is the very fast response time of the display and especially the very fast wake-up time from standby. We can also very easily switch this display to a real standby mode to save power. This is hardly the case with any HDMI display.
This technique of a separate input device that communicates with the main computer is often used in industrial equipment and medical devices.
To be precise, we use displays from Nextion and program our user interface with their editor. These displays are very popular in the maker scene and you can find lots of tutorials and examples. We use the 7 capacitive display in the "INTELLIGENT SERIES". Our displays are provided with copy protection on the software side. This means you can't just buy a display and upload our image. The displays we buy can be programmed with your .TFT without any problems.
2. UART ADAPTER
The display requires a voltage level of 5V. Since we cannot maintain this over a very long cable, we use the so-called UART adapter.
Its job is to regulate the Vin (system voltage) on the RJ45 connector to 5V and output the serial interface (UART1). The adapter could also be used for other serial devices, for example you could connect a GPS module there if you don't want to use a display.
The signal level is 3.3V and is therefore suitable for the voltage of the Raspberry.
Here you can see the pin assignment of the relay board again. UART1 is connected to PINS 8 and 10 of the Raspberry.
3. Editor
Since we use Nextion displays as described above, we also use their editor.
You can download the editor directly from the Nextion website.
The entire interface is built with this editor and uses a command set developed by Nextion.
https://nextion.tech/instruction-set/
With these commands you can build and customize your entire UI. We recommend that you watch lots of videos on YouTube and start with small steps.
Update:
Using the editor, you can program the display directly via a serial connection or you can have a .TFT file created, which you can flash onto the display via an SD card. Just like you do with our updates.
4. Protocol
As described, the display communicates with the VanPI OS via a serial connection. Unlike most Nextion projects, however, we do not work with strings that we send (only very sporadically), but with hex buffers. This allows us to greatly reduce the data to be transferred and thus have a faster connection to the system.
https://github.com/Pekaway/VAN_PI/wiki/touchdisplay
The documentation describing the interface is also attached here.
In principle, the process is as follows. The display sends the VANPI OS which page it is currently on and the VANPI OS responds with the data relevant to that page. You will find an HMI file in the appendix. We will use this to explain the communication flow in the example. through.
5. Example
To explain this example, I have recorded a short video for you.
PekawayNextionExample .HMI file: