To implement any projects, be it a smart home, production automation, a device for outputting computer boot systems, or a simple clock, you will need an output device. A simple option - seven-segment LED indicators. But such an implementation would be inconvenient to use.
For the system to be modern and convenient - you need to use full-fledged LCD displays. In this article we will talk about Nextion displays, what it is, how and for what they can be used.
What is Nextion?
The manufacturer positions the Nextion touchscreen display as an HMI - Human-machine interface. This is the name of any device with the help of which human-machine interaction takes place: parameters monitoring, control of actuating mechanisms, data entry, and so on.
In practice, this is not just a display, but a device with a 32-bit ARM microcontroller on board, which “can” not only display data but everything that the microcontroller must be able to. The presence of a powerful microcontroller involves the use of a port to connect to it - on the Enhanced series there is a GPIO with 8 pins, and half of them (from 4 to 7) support PWM.
There is an API for creating software for Nextion (although ITEAD calls it IDE, in the first approximation there is not much difference). To put it in simple terms, it’s a pun, but this is true: for these displays, there is a program for creating programs without programming knowledge.
Devices can be paired with popular platforms for the development of Arduino, Raspberry Pi, Raspberry Pi A +, B +, as well as Raspberry Pi 2/3, Rpi Zero support is not stated, but most likely it is possible to organize interaction via a serial interface.
They are designed and manufactured by ITEAD, it is known for another product - SonOff Relay Wi-Fi for a smart home, which is in demand and success both among ordinary people and among enthusiasts.
ITEAD studio is located in Shenzhen in China. According to the information from the official website, the ideology of the company is that people should be given the means to develop and design in order to “make innovation easier.”
What are the models and their technical characteristics
The range of Nextion displays is divided into two groups:
- Basic - basic and simple models;
- Enhanced - advanced models with some additions.
As you can see, on all models there is a display with 65k colors, on board, there is a core with the architecture of ARM 7, with FLASH, RAM-memory.
The main differences between Basic and Enhanced are that the latter have on board:
- RTC - Real-Time clock (real-time clock chip);
- EEPROM - non-volatile memory;
- In the lineup there is 1 display with a capacitive sensor;
- Larger FLASH and RAM memory;
- There are 8 pins GPIO;
- Microcontroller with a higher operating frequency.
The differences are reflected in the official English video:
It is pointless to consider the device of each model, there are “datasheets” for this, but for clarity, let's analyze the Nextion stuffing using the example of the Enhanced model NX4832K035.
Let us consider the elements of the board:
- GD32F103 is the heart of the board, the ARM CORTEX-M3 microcontroller is analogous to the similar SMT32 label, namely ST32F103.
- PCF8563 is a real-time clock chip from NXP. In the upper right corner, you see the CR1220 battery slot, from which they are powered in the absence of an external source.
- The AT24C08BN is an electrically erasable non-volatile EEPROM memory chip with a capacity of 1024 kb. The last two positions “communicate” with the I2C microcontroller.
- The LR6209 is a low-drop linear regulator (LDO), its parameters are 3.3V and 250mA, and other models of displays can use pulse converters.
- W25Q256FV - 32 MB flash memory from Winbond.
- XPT2046 - touchscreen controller.
- A slot for an SD card is needed for firmware (download files with the extension * .TFT to the root of the card). The card must be formatted in fat32, be no more than 32 G b. There should be only 1 firmware file on the card.
- GPIO-connector under the cable with 1mm pitch, comb 2.54mm.
An expansion board is connected to the GPIO connector using a loop (supplied, but specify when ordering, in case the package is changed). On the expansion board, there are buttons, a piezo emitter (the so-called buzzer) and a LED.
For communication with the BASIC environment, models use a serial port, and for models with GPIO, they can communicate directly through it. What makes it possible to use the device yourself, without additional modules. Below is a picture with the designation of display elements without GPIO, in fact, everything is the same.
Schemes, connection, communication
To connect the power to the display Nextion has a special adapter for micro USB.
With it, you can apply power to the module, for example, to start the demonstration mode or to connect from a separate power source, independent of the device connected via the serial port.
There is a four-pin connector on the display board, and 4 wires come out of the plug to connect to it:
- Red - “+” power;
- Blue - TX (Serial Interface Output);
- Yellow - RX (Serial Input);
- Black - GND aka "-" power.
The serial port is connected to the computer, microcontrollers and so on, as usual - Rx to tx, and tx to Rx. Below is an example of a display connected to the Raspberry Pi via the serial port.
Connection to Arduino is no different.
To communicate with a computer or flashing the display, you can use a USB-UART adapter, for example, as shown below. Note that you can use the ARDUINO boards not for their intended purpose, but as a USB-UART converter, to connect various devices to the computer and their firmware.
As already mentioned, there is special software for working with displays - Nextion Editor. You can download it from the official site.
After installing and turning on, you will see the following:
To start working you need to press the “new” button, specify where to save the new document and select the display model.
In the figure, the numbers denote:
1. The tool pane (text, numbers, buttons, input fields, sliders, etc.).
2. The area where the fonts and pictures you downloaded are displayed.
3. Compilation output window.
4. The window for displaying the code of elements and events (shown in the figure below using the slider example).
5. Display attributes of elements.
6. List of pages (a page is a group of items displayed on the display.)
7. Screen display area.
8. Run the code compilation.
9. Download to display via UART
To find a file for firmware using a micro SD card, you need to click the File-open build folder, a folder with them will open. Pay attention to the address. The .TFT file will be named like the HMI project file.
The program has the ability to simulate the work of the project, with the support of connecting an external controller with which it will work. That is, for designing and interfacing with external controllers, you do not even need to buy a display - you can try whether this device is free for your needs.
Examples of using
Consider a small selection of projects in which this display is useful! A great example of use would be automation for a smart home with temperature sensors, humidity, leaks, and actuating relays. Here the Nextion display works in conjunction with the Arduino.
Simple alarm clock:
The project of the weather station, which works on Wi-fi using ESP32:
The mobile phone from the display and Arduino:
As you can see, the Nextion displays are not just an output device, but a full-featured device. When paired with any microcontroller using a serial port, you can implement projects of both amateur and completely industrial applications. The spoon of tar is their relatively high cost - the cheapest version of the BASIC line costs $ 16.4, and the most expensive ENHANCED is $ 88-108. Although, it depends on what to compare because the operator panels from manufacturers of industrial equipment are much more expensive.