Tag Archives: The Nextion Display

Nextion Displays and the ESP8266

the Nextion boxSo a parcel arrived for me this morning in the post. A Nextion display. And what is that, you may well ask?

Think of something like a thermostat or really any home control situation, at some point you have to stop sending text commands from an expensive PC and reduce the operation down to neat and tidy button pushing so that everyone else in the house can actually participate in your invention!

This is where things often fall down, the “Heath Robinson” home-made-looking box with pretty awful buttons telling everyone you have “amateur” status.   Now of course, today, you could choose to use a second hand phone or tablet for your wall-mounted family-friendly display and control panel… OR you can use a touch-sensitive display.

These are REASONABLY cheap – for example….  http://www.banggood.com/UNO-R3-ATmega328P-Board-2_4-Inch-TFT-LCD-Screen-Module-For-Arduino-p-945755.html

So this is an Arduino + touch display for under a tenner. You have to sort out libraries and basically write everything from scratch – and that’s fine – but time consuming.

Te Nextion PCBAnd so it was that my friend introduced me to the Nextion displays. This is a display board that isn’t too expensive – and which has everything built in. Essentially, on a PC you run a free editing program, tell it where you want buttons, text and images and what should happen when you press the buttons.  A button lets you download that to the Nextion board and “Bob’s your uncle”.

The board has only 4 pins – power (5v), ground, serial in, serial out. Press a button and stuff comes out of the serial pin at logic levels and 9600 baud.

You really can’t get any easier than this. Perfect? No, far from it. In my initial trials. the editor has some polishing to do, my first attempt at running the font convertor on a Windows SANS font produced a pretty awful output and I’ve clearly got a learning curve ahead of me – but after 15 minutes I have a display running with serial output on button press – that is one HELL of a lot faster than any other way I can think of.

Nextion displayThe board has another advantage over alternatives – the whole thing is very THIN and so will easily fit into a nice slim wall mounted case.

You could choose to run the board serially – OR via something like an ESP-01 and that is almost definitely what I will be doing.

I’ll have the EXP capture button outputs and send MQTT commands back to base – and accept MQTT commands and send them to the display.

Welcome to NextionWhen you first power up the unit, it comes up with a nice display and responds to button presses… so that gives you a feel for how things will work – that’s before you do any programming – just power the board up.

All you have to do is use the PC software to drop  in some screens, some buttons and some dials and off you go.

So that’s the theory – what is the board like in practice. I have to say that my first experience suggests that the translations have some way to go.  The simplest thing you can do is have a button send something out of the serial port when you press it.

GaugesThat is a 5 seconds job to implement – but it took me nearly an hour to realise because my friend who has already done this showed the use of an on-press function called PRINT which on his board works on it’s own. With the new software you build up commands and add a special command at the end to send everything out of the buffer. Until I found that command, mysteriously named “com_star” which I’m going to assume means “comms_start” – I was lost.

So commands tend to end with a binary zero for reasons I’ve not yet figured out… and at the end of any command, incoming or outgoing, you have 0xff 0xff 0xff  (i.e. 3 bytes each one binary 255).  That in itself makes testing interesting as a simple ASCII terminal might have difficulty with the terminating characters. Not sure what’s wrong with a simple carriage return myself – but I’m sure they have their reasons.

Now that I KNOW – it’s easy. Kind of – the manual needs a lot of work – but I guess it is early days yet – as long as they keep improving things, this little display could well be a winner.

The thing that stuns me the most – looking around the web – is people using this with an Arduino – with an ESP8266 stuck on the end for WIFI! Seems like major overkill to me not to mention the cost.  An ESP-01 talking to one of these devices, with 512k programming space on the ESP, it seems to me one could accomplish one hell of a lot!

Right now  I have the Nextion sending out instructions when a button is pressed, via it’s serial – at 115,200 baud. The text is encoded to be the same as my home control. My home control boards are of course ESP8266 and I’ve used a resistive divider on the serial input…  All good fun.

UPDATE: See comments in here – lots of issues with the software right now – this is not going to be as easy a ride as I thought…. comparison operations that just don’t work – we’ve been writing to the designers all day and I hope that our issues will be sorted. Right now you may want to consider this a work in progress – SO many possibilities but not without pain it would seem. More as we get responses to our questions.