Noob’s Guide to Nextion Displays with ESP8266 | NodeMCU | WeMos D1 Mini

Software Serial support has been added. Now connect Nextion HMI display to any two pins of ESP8266. Check out our Github Repository for modified Nextion library for ESP8266 (Tutorial work is in progress).

Nextion is a Seamless Human Machine Interface (HMI) solution that provides a control and visualization interface between a human and a process, machine, application or appliance. Nextion is mainly applied to IoT or consumer electronics field. It is the best solution to replace the traditional LCD and LED.

Nextion includes hardware part (A series of TFT boards) and software part (Nextion editor). The Nextion TFT board uses only one serial port to communicate. It lets you avoid the hassle of wiring. Nextion editor has mass components such as button, text, progress bar, slider, instrument panel etc. to enrich your interface design. And the drag-and-drop function ensures that you spend less time in programming, which will reduce 99% of your development workloads. With the help of this Nextion editor, designing a GUI is a piece of cake.

Interesting? So let’s make the working combination of Nextion and ESP8266, Just FOLLOW ME  😛

Hardware Needed:

Software Needed:

Nextion Editor:

Nextion Editor is a Windows based drag and drop tool for creation Nextion GUI in real time, as you can see what you are building. Here is the fun begins, so let’s get started  😎 . Download Nextion Editor and install it. Download Nextion HMI file for current project and open it with Nextion Editor. Follow the video tutorial for rest of demonstration.

editor

Arduino IDE:

Download Nextion Library and install it. Download .ino file from Nextion Example Sketch zip file. If you are using your own sketch, use the baud rate of 9600 in “void setup” function i.e.  Serial.begin(9600); Follow the video for rest of the demonstration.

Connection Diagram:

 

Demonstration Video:

Youtube: A Noob’s Guide to Nextion Displays

5 3 votes
Article Rating
Subscribe
Notify of
guest

28 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
fabio
fabio
7 years ago

hello friend,
great tutorial!
Could you write code for nextion display enhanced and arduino controller for me?
I have an existing project to modify

[LINK REMOVED]

I would help to adapt it to my use.
Hope you can thanks, Fabio

ibrahim
ibrahim
7 years ago

could you share node-red flow codes?

sam
sam
7 years ago

Hi Ahmed , would you be interested in writing code for this display plus gui ?

MUHAMMAD LOKMAN
MUHAMMAD LOKMAN
7 years ago

assalamualaikum ahmed..
nice tutorial from you. everything completed.
if you dont mind, can u share the node flows code?
Really interested to know so that i can simulate all those thing as a completed tutorial/example.

thanks n regards
Lokman

Naveen Shetty
Naveen Shetty
7 years ago

Hi Ahmed,
A query , you have put a link for Nextion library here, but there is another linked termed as Nextion-master ; which of these would work with nodemcu 1.0 .
Also can we connect the tx , rx of nextion with rx,tx of nodemcu which is gpio3 and gpio1 as compared to yours as you are using a software serial.
can i connection without level shifter to gpio3 and gpio1 if using hardware serial.
can i connection without level shifter to gpio5 and gpio4 if using software serial.
thanks

gustavo
gustavo
6 years ago

the display outputs 3.3v ttl signal rx tx, don’t worry

Ovaltineo
Ovaltineo
6 years ago
Reply to  gustavo

The Nextion output level is 3.3v? OK, so that means a level shifter is completely unnecessary and should be deleted from the diagram above.

Naveen Shetty
Naveen Shetty
7 years ago

Thanks Ahmed for your valuable input, will try it out

CLAUDIO RAMOS DE LUNA
CLAUDIO RAMOS DE LUNA
6 years ago

how do I define in which pin Rx and Tx will my nodemcu communicate with the nextion display?

Bob Cohen
Bob Cohen
6 years ago

Good afternoon gentlemen, Thank you for you nextion library adjusted to be used with NodeMCU. All looks fine but there’s no .cpp or .h code for Dual State Buttons. I’ve been using the original itead version on a Mega with great success but when I use your library the DS Button code is missing. I copied the code across from the original itead library but still problems …error: ‘NexDSButton’ does not name a type. Just wondering if this should work (Ie just copying DS Button across or am I missing something? Would a solution be, to use the original itead… Read more »

virendra
virendra
6 years ago

i tried your setup it up as instructed on a nodemcu 1.0 and nextion screen.. and got the below compile error pls help..

C:\Users\Ginger Brown Design\Documents\Arduino\libraries\Nextion-master\NexHardware.cpp:18:25: error: conflicting declaration ‘SoftwareSerial Serial’

SoftwareSerial nexSerial(5, 4); // TXblue, RXyellow

^

In file included from C:\Users\Ginger Brown Design\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/Arduino.h:260:0,

from C:\Users\Ginger Brown Design\Documents\Arduino\libraries\Nextion-master\NexHardware.h:17,

from C:\Users\Ginger Brown Design\Documents\Arduino\libraries\Nextion-master\NexHardware.cpp:15:

C:\Users\Ginger Brown Design\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/HardwareSerial.h:146:23: error: ‘Serial’ has a previous declaration as ‘HardwareSerial Serial’

extern HardwareSerial Serial;

Javier
Javier
6 years ago

Hello, the link Nextion Project File (HMI) is wrong, you can repair it, thanks

Cezar Tayoun
Cezar Tayoun
5 years ago

hello, the link for HMI is not for the shown weather station forecast. can you give us link for the weather forecast.thanks

Glenn Pearston
Glenn Pearston
6 years ago

Hi – thank you for the work you have done on this. The Nextion UI can consume a lot of a person’s time trying to work through it. Your efforts have helped. Question – I am using an ESP8266-12E and a Nextion (obviously). My code works using SoftwareSerial and your library (I can put stuff on the Nextion display). When I go in to NexConfig.h and comment (disable) the debugging (//#define DEBUG_SERIAL_ENABLE) enable I no longer get any Serial.print to my console (Serial.println(“Hello World”). #define DEBUG_SERIAL_ENABLE Nextion debug Messages Regular Serial.print Messages Not Commented Out YES YES Commented Out NO… Read more »

Glenn Pearston
Glenn Pearston
6 years ago

Thanks for getting back to me. My sketch has/had the Serial.begin(115200) command and it had no impact. What is very odd is that the call to nextInit() actually overrode the Serial.begin(115200) setting and set Serial to 9600. The monitor screen’s baud rate had to be changed to see the incoming messages. That led me to believe that somewhere Serial and Serial1 were tied together – could not find that. I finally found that if I changed the #ifdef DEBUG_SERIAL_ENABLE statements I could get Serial (at 115200 even) and no Nextion db output, which is what I wanted. The changes I… Read more »

diyglenn
diyglenn
5 years ago

I believe the Nextion logic is 3.3V, the only 5V device is the backlight.
AFAIK the logic converter is not necessary for connection to the ESP8266 which is also 3.3V.

Cezar Tayoun
Cezar Tayoun
5 years ago

hello, i cannot connect to MQTT server despite that i am connected to internet. please help

Aman Gupta
Aman Gupta
5 years ago

we have to use nexserial or serial command to communicate with nextion display

28
0
Would love your thoughts, please comment.x
()
x