Nextion TFT LCD – Why you need one!
I’ll start this by stating that I don’t work for iTead, and nor am I getting any sort of kickbacks… I just really like this TFT LCD. I stumbled upon the Nextion (which is a slick easy-to-use TFT LCD with a HMI editor) when they had their first crowdfunding campaign a year or so ago. I ignored it as there was not a lot of documentation, and frankly, I really didn’t understand the concept of graphics work done on the TFT, and the rest on the MCU. Wish I had taken a gamble at the time. Instead, I went down a path building projects using SPI-based TFTs which require a lot of work to draw and manipulate graphics and text. They are also generally slow at drawing as they require the MCU (an ESP8266 in my case) to do the graphics processing work and send them pixel-by-pixel to the TFT.
The Nextion Approach:
The Nextion approach consists of a TFT LCD that has brains and memory built in, and a Windows editor (HMI) to develop your graphical interface by placing images and text on a screen and designing how they will interact. You can even do some programming on the base device and more so on the enhanced version (which has GPIO pins). You could, for example do an entire project solely on the Nextion screen (enhanced model) by connecting a temperature and other sensors directly and reading the results. What I (and most others do) is connect it to an Arduino or EPS8266. These MCUs become the brains to process input from sensors etc and simply need to send commands over serial to display results graphically. You can see this in action with my WIoT-2.
The general idea is you develop your interface (HMI) on the Nextion. Lay out all the graphics, text, buttons etc and assign them variable names. You can then develop your sketch which procesess sensor and other data and sends the commands over serial to update the values in the interface. You can also control the interface (i.e. change a page, force a button click etc etc). In the HMI, you lay out your graphics, buttons and text, compile it, transfer the .tft file to a Micro SD card, then load the card into the back of the Nextion, and power it up. This will load the tft file into the firmware of the Nextion. Once complete, disconnect power, remove the card, then power it back up. You will see your screen with graphics and default values you created. You compile the sketch and upload that to the MCU and you have a project! Then, connect +5V, GND and the TX/RX lines to your MCU and you’re done. Easy peasy! My WIoT-2 project provides lots of info and as well as a sketch and HMI file.
About the Cost:
There’s no question that the Nextion TFT’s are more expensive than other TFT’s out there. However, you have to consider the total cost of ownership. What is your time worth? How complex is it to draw graphics to other TFT’s? Prior to the Nextion, I was using other TFTs that used SPI to communicate. They require graphics and font processing code to be written in your MCU and pushed from the MCU to the screen when displaying content. You have to do this for each element. For example, to place some text you have to send separate commands to define which font to use, which size, it’s colour, and x/y placement. It also requires many debug runs to ensure you have the placement correct. This is very time consuming. Over 80% of my time coding the original WIoT was dedicated to writing code to manipulate graphic / button elements to send to the RA8875 TFT controller and LCD I had. Considering this, is that extra ~30% cost of a Nextion worth the many more hours you have to put in coding your project? I can safely say definitely not. I estimate that I put in more than 50 hours writing code to interface with the RA8875 driver and coming up with the screens/graphics/fonts for my original WIoT. It was a lot of work. The Nextion and HMI Editor made this easy and slick (used in WIoT-2). I haven’t even mentioned the time it took me to learn how to create custom fonts and then integrate them into the libraries. The Nextion has a tool built-in and does all the heavy lifting automatically. Again, don’t forget – after doing all this, the other methods require the MCU to draw graphics by sending pixel-by-pixel over the SPI line. The Nextion has all graphics and fonts in memory, so all your MCU has to do is issue serial (text) commands to set pictures and change text – which makes things very zippy. As an example, it takes 3-5 seconds to update 1 weather icon with the RA8875 in my original WIoT. My MCU is sending a 100x100px image over SPI each time the weather refreshes. In WIoT-2, the Nextion does an entire page with all graphics/text (including background graphic) in 1-2 seconds. The reason is all graphics are already in memory. So changing a weather icon can be done by simply stating pic=2, and BAM it’s updated in a flash. That’s a huge improvement. Switching one graphic for another is a split second action and a single command.
Easy Debugging: You can do most of the screen feature debugging within the Nextion Editor and it’s debug window. You can simulate commands from the MCU and look at results. All without even having an MCU / sketch running.
MCU debugging: You can even connect your MCU with running sketch to your PC, open the HMI editor and allow it to push data over serial to the Editors’ debug window to see actual results. You don’t even need a physical Nextion screen. So you can develop your project while you wait for your Nextion to arrive in the mail… Oh, and the Editor is a free download (link below).
Font Generation: The Nextion Editor comes with a font tool that allows you to select any system font that you have and convert it for use on the Nextion. There is no ugly creation or modifications to font libraries etc, it automatically makes the font available (by ID) and embeds it in the TFT file package.
- Itead’s Nextion Page
- HMI editor download. You can play with it before you buy a screen. You can even debug your MCU with it to try it out.
- Where to buy: Nextion TFT LCD 5” (Other sizes: 2.4“, 3.2“, 4.3“, 5.0“, 7.0” ). Note – Although Banggood has a funny name, I use them all the time. Prices are competitive, free shipping and the best customer service from an overseas site.