This is a continuation from my prior WIoT weather station.   I decided to upgrade to a Nextion TFT LCD due to issues I was having with SPI comms between the Adafruit Huzzah ESP8266 and the RA8875 Controller.  After some research I discovered that this is a common issue with the ESP8266 and SPI communications.  So, what is WIoT-2?  Well, it’s lots of things…  I use it as a cloud-connected (IoT) info center of sorts that resides at our front door.  This is a culmination of information my wife or I often ask ourselves either heading out, or when we come home.  It displays current/forecast weather, weather outside the house, date, time, the waste collection schedule, currency, and even allows our kids to check-in when the get home.

Latest Version

Pop-Up Window

Earlier Version


I came across the Nextion display over a year or so ago during their Indiegogo campaign.  I decided to pass it by as there was not enough information at the time.   In hindsight I regret that decision.  Itead hit the nail on the head with this display as far as I am concerned. It uses simple serial commands to communicate between the MCU and the display – which is perfect for my needs.  They also use a HMI editor (below) that allows you to layout all the elements on the TFT, and setup the display using pages etc. Refresh rates are fast as well.  An example of the simplicity. To change the icon of one of the days, you issue “pDay1Icon=6” from the MCU.

editor capture


There are many other advanced features of the Nextion that I won’t get into here as this is not the purpose of this post.   With that, onto details about my WIoT-2 project.  As with my prior project the intent was the following:

  • Display current and forecast weather information.  This time around, I used the Weather Underground API to pull both current and forecast data in JSON format.
  • Display weather data generated outside the house via another ESP unit.  It polls temp, humidity and battery info (it’s solar powered) – Integrated with Blynk
  • Poll and display the temperature of the hot tub – Integrated with Blynk
  • Poll and display the status of garage doors (open/closed) – complete. will be integrated in the future – Also integrated with Blynk
  • Allow our kids to interact with the unit – sends notifications via Blynk
  • Polls waste collection calendar information to show us which waste items are being collected on a weekly basis.
  • Show the current date and time – uses Blynk RTC widget
  • Shows up-to-date currency conversions CAD>USD, CAD>GBP.
  • I also added a picture viewer which shows family photos (for those times when people are bored standing at the door waiting for others…) You know.. like that always happens, right? 😉


Latest HMI – Jan 17



Main display at front door

MCU unit on backside of wall. Contains NodeMCU, power supply and connectors.

NodeMCU controller unit on backside of wall

Garage door status icons

Garage door status added.  Allows monitoring and control of doors.

Option to selection weather reporting location

Option to change weather reporting location


Pin-Outs & Connections:

I’m using the NodeMCU, so your connections may be different.   This project takes advantage of both Serial ports. Serial is used for comms between the PC and NodeMCU, Serial1 is used for comms between MCU and Nextion.  Well, not exactly.   The Node’s Serial RX line is shared on both sides.  More on that in a bit.    The connections are Node RX to Nextion TX, and Node D4 to Nextion RX.  The sketch uses hardware serial using Serial1 (TXD1) to transmit to the Nextion, while return data comes over Serial RX.  In the sketch, both Serial and Serial1 have been created.  The only trick is that you cant have the Nextion powered when uploading sketches to the Node.  This can be done by simply disconnecting the power to the display when uploading a sketch.

Important:  Don’t fall into this trap!  If you are powering your MCU and Nextion by different sources their GND connections must be common!   Also ensure you are supplying ample current to the Nextion.

Blynk Integration:

The project also uses Blynk extensively to allow me to view the status and control the various devices I have throughout my house from my phone and tablets.  I also use it to debug the devices to ensure they are still sending data at their defined intervals.

Outside data is also logged to Blynk. Temp, Humidity and Battery are tracked.  Data also reported to WIoT. The Hot Tub controller monitors the temperature and allows the RGBW NeoPixels to be set.  Data also reported to WIoT. The Garage Door Monitor allows for monitoring and controller both garage doors.  Data also reported to WIoT.

Outside Data Logging Unit

Outside Data Logging Unit

Hot Tub Temp and LED Controller

Hot Tub Temp and LED Controller

Garage Door Controller / Monitor

Garage Door Controller / Monitor


Libraries & Resources:

  • Nextion Library – Note there is an official Nextion library as well, but this one was sufficient for my needs given it allowed for me to send and receive information from the Nextion.  Be sure to read the notes and links (link, link) provided as they give great samples.  Note: You can use software or hardware serial.  I used hardware serial in my code.  If doing this you have to comment out a line in Nextion.h   //#define USE_SOFTWARE_SERIAL //Comment this line for use HardwareSerial
  • Blynk Library –  I use the app to control and monitor the hot tub, garage and others components.
  • Arduino IDE – I used 1.6.13, but others should work fine as well.
  • Node MCU firmware – comes as part of the ESP package.  Google is your friend if you need help. Just google setting up NodeMCU in Arduino.
  • Arduino JSON for parsing the JSON data.
  • Nextion forums –  (a big shoutout to Patrick and Steve for being so helpful in getting me up and running).
  • Arduino Source Code & Nextion HMI file – see bottom of page.


I had my first challenge with the NodeMCU when trying to both display debug messages using the standard Arduino Serial window and trying to communicate with the Nextion.  After some digging and help from Steve and Patrick on the Nextion forums, I was able to get both Serial debugging and comms with the Nextion.  It uses a simple trick in that the Nextion uses the NodeMCU’s D4 pin (Serial 1 TX) to send comms and Serial RX to receive.  For those with a keen eye, you can see that this is a problem when uploading sketches – which is easily solved by either disconnecting the pin, or powering down the Nextion display during sketch uploads.

Tips n Tricks:

Changing IDs in the HMI editor.  Part of the app watches for incoming messages from the Nextion that look like this “65 0 2e 1 ff ff ff”“. Where 2e represents the component ID being clicked/or sending a message from the display.  You can see the message output in the HMI.  One of the issues is if you are making changes and removing images/components, the HMI re-numbers the ID’s.  This is a problem if you write code to interpret them.  Solution – wait until you are done your project design and have the HMI correct before writing statements to interpret messaging.   If you have to edit it later, that is fine. Just make sure you check all output values and ensure they updated in the matching receive statements in the sketch. Code sample:

 String message = listen2Nextion(); //check for message
  if (message != "") { // if a message is received...
    //Serial.println(message); //...print it out
    //if (debug) {Serial.print(F("*****Nextion Msg: "));}
    //if (debug) {Serial.println(message);}
    Serial.print(F("*****Nextion Msg: ")); Serial.println(message);

    //Refresh the data.
    if (message == "65 0 2e 1 ff ff ff") 
    if (message == "65 0 33 1 ff ff ff")  //photo icon clicked - run photo show
      myNextion.sendCommand("dim=60");  //brighten the screen
      myNextion.sendCommand("page photo");


Nextion TFT LCD Models: 2.4 3.2 4.3 5.0 7.0



Inside view of MCU case and unit


Nextion HMI Template View


Source Code Arduino Sketch / Nextion HMI:

I’ve decided to take a different approach on sharing for this project.  I have spent well over 100 hours and nearly a year developing this project.  A lot of hard work has gone into the Arduino source (56+ versions) as well as the Nextion HMI.  For a small PayPal donation of $5 or more (c’mon, it’s a Starbucks coffee… :-), I will share the Arduino sketch and it’s HMI file.

What you can expect:

  •  Arduino sketch (libraries are your responsibility – links above).
    • This code contains various functions and tricks working with strings and char arrays.  It’s a result of many hours researching how to do specific tasks.
    • Connecting to Weather Underground and parsing JSON data
    • Blynk connectivity including interfacing with 2 other IoT devices.
    • Communicating with the Nextion display.
    • I will use this code as reference for future projects due to the vast variety of working with string/char array data and manipulation of it.
  • Nextion HMI file (developed in v0.42)
    • Note – I will not share my source graphics as many are copy-write and some are custom.  You will only get the HMI and graphics/fonts embedded.  It’s up to you to create your own graphics if you want to change what is in there.
    • This version is for the 5″ regular Nextion. You should expect to have to modify it in the Nextion Editor if you don’t have the same model.  I’ve provided links above to where you can buy one at a good price and reliable seller. I use them all the time.
  • Setting Expectations
    • If you use this in a project, please give credit where due to those who wrote the libraries as well as this site.
    • You will have to make changes to the nextion library for your Serial connection.  Read the details above (scroll up).
    • You will also need to ensure the Serial1 value is set to the right baud of your nextion.  Refer to the ‘bauds’ command in, find the Nextion baud, and set the value for (Serial1.begin(9600);) in the sketch.
    • This is a stable version of the HMI and sketch.  I am constantly updating this project, so you may not have the latest code as shown in the pictures.
    • The intent of this code is NOT to provide you with a plug-and-play solution.  It does work, but you have to know what you are doing and have a firm understanding of coding. The intent here was to share useful functions and ideas that you can use in your own code.  If you choose to try to re-create WIoT-2, that is great, but please don’t expect free support.
    • Note – the sketch is built for a NodeMCU v1.0 ESP8266.  It may work with other MCUs, but you are on your own if you go that route.  That said, it uses the ESPs 2 hardware serial lines.  One for serial debugging and the other (Serial 1) for Nextion comms.
    • Do not expect this code will be plug-and-play. It uses Blynk,  the Nextion ans sensors.
    • You may also notice some experimental features that may not entirely work correctly, and should not expect these to work.  However, the core features do work.
    • Sketch and Nextion HMI will be sent within 24 hrs  or less of receiving notification from PayPal.
    • Donation will appear to dast****
    • I am happy to provide some basic guidance, but this project requires an intermediate skill level.  The intention of this donation is to get access to a wide variety of useful functions.  This donation is for code, not support 😉 There are plenty of resources online – Google is your friend! 🙂