From Let's Control It
Revision as of 13:53, 27 May 2018 by BertB (talk | contribs) (Screen preparations)
Jump to: navigation, search



This page is under contruction.
The OLED page is being used as a donor.


This is not an ordinary display. You cannot simply write data to it, but first have to create an appropriate interface.
This is a very easy process, when using the free Itead IDE (Just search for Nextion on the web).
It has some good tutorials and once you have created your own display, it is very easy to present data and control devices with it.

The ESP8266 module can be used to control an Serial Nextion Display. Due to its on-board intelligence and the presence of a touch panel, the display can be used to control devices.



The board is connected to a controller by means of 4 wires


Connect the Nextion Display to a serial port and to +5 V and ground. The Nextion software module provides the use of a Software Serial port. So, it is not required to use the 'native'Tx and Rx ports of the controller. This display works with 5V and can be connected directly to the ESP module.


 VCC    	VCC
 Tx		GPIO port acting as Rx
 Rx		GPIO port acting as Tx

In order to get those displays to work properly you need to activate the pull-up of the Tx pin. A quick test is to set the pin to high (1) but for long turn you should enable the pull-up instead. If the pin is missing a pull-up you can add one yourself by soldering a 10k resistor from 3.3V to the pin.


Screen preparations

Although this is not the place to go into too much detail of the Nextion Editor, the examples help to explain the possibilities of the plugin.

Let's assume you would like to have a control panel with several pages. Below is example with three pages. A front page, an info page and a switch page. To make switching between pages run smoothley, without having to wait for data, Variables can be used. Several of them are declared and made global on the front page. One or more timers make sure the control panel dims its backlight and go back to its start screen.


During pre initialisation, the timer is set and enabled. The backlight is set to faint with dim=10.









ESP Easy

Use the device tab on the ESP Easy webinterface and create a new task by editing one of the available tasks. Select "Display - Nextion" from the dropdown box.

Now you first need to prepare your display. It needs to contain textboxes, numerical boxes etc. In the example below, I created variables vHO, vSold and vSolt. Data retrieved from a MQTT tasks can be written to it with:


where page0.vHO.txt describes the variable in the Nextion display, that I created beforehand.

Check this sample on how to get it done:


In the second example


The idx and value fields are used to communicate button presses etc.

This info can be handled in the Rules:


(The upper (MQTT) IDX field will be stuffed with '1', because it's needs a value. But nothing will be send with this device the second one is to write to a debug text box in Domoticz, but could also be 1)


Command Value Extra information
Nextion, - Write text messages to OLED screen, ROW for row, COL for starting column, and Text for text.
Nextion,<value> Switch on or off the OLED or to clear the display. During the off state, the content will be updated according to the latest values or states.

= Special characters =