1 Introduction
The Sonoff Panel is a Nextion touchscreen with an ESP32 on the back, making it an interesting tool for developers. We took the panel and prepared it to work with VANPI.
2. Adjust hardware 12V-5V (Optional)
The touch panel was developed for home technology and works with 230V. This must be changed first.
First, loosen the mounting plate with a flat-head screwdriver and then remove the cover cap as shown.
The voltage converter and the relays are located underneath. After loosening the four fastening screws and the screws of the connection terminal, the circuit board can be removed.
We remove everything from the board that is on the terminal side. Then we can solder a DC/DC converter of our choice in between. We use the two lower pins as the voltage input for our 12V system and connect them to the VIN of the converter. We solder the 5V output and the ground to the capacitor points above as shown. The left (hatched) is ground and the right is plus. This means we can connect 12V directly to the screw terminals and use them to operate the panel. The assembly is carried out in reverse order. We packed the buck converter in a shrink tube, and by removing the 230V relays there is enough space.
3. Flashing Tasmota
To flash the open firmware Tasmota, we have to separate the actual display from the circuit board. To do this, loosen the two cover screws and open the ribbon cable connector to the display.
After exposing the ESP32 board, a USB-UART adapter can be connected and programming can begin.
The programming connection is at the top. As usual, you connect 3.3V (IMPORTANT! Not a 5V level) TX with RX, RX with TX and GND. You have to set the GPIO0 pin to GND when booting. You can easily do this with the pins on the lower pin header.
The two pins at the bottom left are ground and the two pins at the bottom right are 5V. With these pins you can operate the board directly after flashing if you have not installed a buck converter as described above. The display absolutely needs the 5V. The system does not work with 3.3V.
To flash, it is best to use the Chrome browser: https://tasmota.github.io/install/
There, select "Tasmota32 Sonoff-NSPanel(English)". Now you just need to enter the correct port and the chip will be flashed.
4. Configuration
After the system has been flashed, it can be started.
An open WLAN "Tasmota-xxxxx" is displayed. You connect to this and use Explorer to go to the IP address 192.168.4.1. There you will find the WLAN settings for Tasmota. It is now important that you connect the touchscreen to the WLAN of the VANPI (i.e. the access point). All the necessary files are onboard from version 1.1.0 and are downloaded directly from the system.
After starting, you probably wondered why the screen remains black. This is because we first have to set the correct template. To do this, we go to the Tasmota config.
The display should have received an IP from the VAN PI system 192.168.4.x, the DHCP leases can be found in the VAN PI web interface in the config, you can look there or use a network scanner.
After you have found the WiFi touchscreen and opened the Tasmota page, you have to make the following settings:
Config -> Other -> Template
{"NAME":"NSPanel","GPIO":[0,0,0,0.3872,0,0,0,0,0.32,0,0,0,0.225,0.480,224,1,0, 0,0,33,0,0,0,0,0,0,0,0,0,0,4736,0],"FLAG":0,"BASE":1,"CMND":"ADCParam 2 ,11200,10000,3950 |.Sleep 0 |.BuzzerPWM 1"}
-> Click the checkbox "Activate".
The display will restart and the normal user interface of the NS Panel should be visible.
MQTT
As usual, we use MQTT for communication.
So set the following MQTT settings in Tasmota:
Host: pekaway.local (or the IP address of your VANPI)
Topic: WifiTouch
Port: 1883
In Node-RED there is a flow called "WifiTouch" in which the data is transferred to the display.
5. Upload TFT file and Berry driver
We have provided the necessary files on the VANPI image and you can load them via the console.
The Berry Driver ensures that we can flash the Nextion display via the ESP32, so we have to install it first.
a. Berry Driver:
Consoles -> Console
"Backlog UrlFetch http://pekaway.local/autoexec.be; Restart 1"
Now we load the actual display file onto the device:
b. Upload Display File:
Consoles -> Console
"FlashNextion http://pekaway.local/nspaneltft "
COMPLETE!
As of VANPI v1.1.2, all required files are stored on the image by default and can be loaded onto the touch panel via the web interface in the System Update area. Manually, the whole thing works as follows:
(Before VANPI v1.1.2:)
The installation currently only works manually. This means you have to copy the TFT file to the VAN PI system using WinSCP or a similar tool. With the new version 1.1.2 there will be a function that will allow you to do everything via the system.
→ Start WinSCP → Select IP from system → pi:raspberry access data → Copy .tft file to home/pi/pekaway → Rename .tft to VanPI_NSPANEL.tft → Call web interface (Tasmota) from NS PANEL → Console → "FlashNextion http://pekaway.local/nspaneltft "
The new WifiTouchFlow is also attached below and only needs to be swapped into Node-RED.
___________________________________________
Two more important functions.
Disable RecoveryMode:
Since the system resets itself when switched on and off seven times, and this can happen quite quickly when using a battery, the function should be deactivated. This can be done in the Tasmota console with
"SetOption65 1"
Use internal temperature sensor:
The NS Panel has an analog temperature sensor that is connected via MQTT. However, the values here do not match. Therefore, the parameters in the Tasmota console should be adjusted.
"ADCParam1 2,12400,8800,3950"
The WifiTouch Flow has an example below for receiving temperatures via MQTT. All it needs is a connection and then the temperature from the display would be set to the first temperature value. Remember to then deactivate the first sensor in the Temp Flow. In the Logging menu you can also set the telemetry data rate from 300s to 60s or less. Otherwise the sensor updates will be very slow.
VanPI_NSPANEL1.0 .tft – file:
https://share.12-s.de/s/zXQAczY3Mj8RwWX
Wifi touch panel .json file: