Wifi Nextion

Regular readers will remember me ranting about a little board we were making to fit on the back of a Nextion to make it wireless.

NextionWell yesterday was a very productive day – the boards came back from China.  Somehow they’d managed to disconnect the top floor layer from earth – hence the keen eye will notice a little extra soldering and a wire in this prototype – but we’ve had a good learning experience out of it.

So the basic idea was to make a very small board that would sit on the back of a Nextion – and using a soft UART, talk to the Nextion, allowing MQTT control of output to the board and similarly MQTT output from buttons etc.  I got all of that working some time ago but wanted a board to play with to test and that is the purpose of this one.

Nextion[6]In the process we’ve realised that this very small board is good as a general purpose one and immediately we sat down and looked at the board, knowing fine well they’d have to do another batch – we came up with ideas for improvement, implemented them – so the next version (maybe a couple of weeks or so) will actually bring out all of the IO to that side connector together with more ground pins.

Funny how you do things without thinking because you always have. On our last boards (Home control 2016) we had a button on GPIO2 for setting the web interface (WIFI and MQTT setup)  – this time we put a button on GPIO1 for resetting and forgot all about the web interface – and then of course the obvious thought occurred – why not do both on one button – hold before power up to program, hold after powerup for web interface. Makes sense really!

Display controller boardI’ve just made a VERY simple demo on the Nextion display itself – a line of text and 2 buttons – currently the display has been sitting overnight updating the time from Node-Red on my Pi every second… and I’ve tried hundreds of button presses and not lost any yet – the text in the button is a variation of an MQTT command using a tilde as a separator between topic and payload… so for example the buttons turn on of my modified SONOFFS on and off directly (in actual use the commands will talk to Node-Red which will then do the control but this was easy for testing).

So the Nextions can output text on a button press – the text I put in was for example

print “sonoff1/toesp~out0:1”

That is split up by the software in the backboard (same software I use elsewhere with a new “nextion” mode).

Of interest the serial software came straight off github, modified to remove a GPIO setup routine which interfered with other GPIO settings. Interrupt-drive serial comms – I’m running at 56k baud and it is working a treat. This of course leaves the normal serial available to program the little board via the FTDI connector holes (6 way connector).

That’s an ESP12 incidentally.

DisplayThe board has it’s own 3v3 regulation and the 4 way connector for power and serial simply wires through to the Nextion directly  – in the photos I used the smallest available Nextion board but of course this could be used with any of them.

For programming the Nextion, all we have to do is hold down the programming button on powerup and that tristates the ESP IO pins – allowing normal Nextion serial programming. Amazing the functionality you can get out of one button.

This prototype could well end up as a secondary heating display and control panel – don’t be put off by the simple test display- amazing what you can do with a little Powerpoint graphics.

I’ll do a more in-depth article soon when we get replacement boards and I’m waiting for a new board from Itead – might even make the backboard available. All we need now is a decent bezel (don’t say “just run one off on your 3d printer”) – cream – slim with wall fixings – yeah, good luck with that, I know.

Update 18/02/2016

Nextion[1]Spent a little while chatting with a pal of mine, Peter Oakes – and at the end of that, the purpose of the cropped image option in Nextion becomes obvious and does to some extent get over the lack of ability to handle transparent PNGs – here;s the current version – the buttons turn a lovely green when you press them – the next step is to add haptic feedback to the Nextions.

Watch this space for drastically improved display and new ideas. I’ve always wanted a decent low-cost WIFI touch display.. and now… it is within sight.

Nextion[3]Ok, I said watch this space – so here it is – note the picture up on the top right – the crappy little Nextion button and text box… well, thanks to the use of the image cropping facility, Powerpoint and some external imagery I’ve moved on – in addition I’ve added haptic feedback with a little sub-£1 self-adhesive vibrator that (just) works straight off a port bit!!!

More on this elsewhere.


11 thoughts on “Wifi Nextion

  1. I have been reading your blog posts for about a year and today felt the need to register to post this question for assistance. You mentioned in this article that you had written a small test program to test the sending of MQTT out from a button. I would never ask for the amount of code you had already shared on the automation project with the Nextion displays, but I am not too shy to beg for this little button test code snippet.

    I have MQTT status on adafruit.io that I would LOVE to see on my Nextion displays, I am not asking for tech support as I enjoy sorting through code myself in an effort to learn, however could you please point me in the right direction to either your code or some similar way to get the data I am looking for onto my displays? Thank you for all your contributions as well as the great writing!

    1. It actually says in the article..

      print “sonoff1/toesp~out0:1”

      On a button – that is handled at the other end in my ESP software (see article on blowing the home control code) to fire out the MQTT…. the above it a notation I developed – the tilde separates the MQTT topic from the payload… hence

      topic: sonoff1/toesp
      payload: out0:1

      The software at the other end will put the {} wrappers around the payload.

  2. Yes I suppose it would be a tight fit for the 2.4″ display, the only way around it would to make it in two parts and glue it together, I believe this printer can also print ABS successfully even though it hasn’t got an heated bed.

    1. Sadly while that is a great idea – the 80mm by 80mm printing area is just a tad too small for many of these boards….. a shame.

  3. It would be good to have such a service, there was talk a couple of years ago about having local maker centres where people could go and use things like 3D printers and lathes etc. but it never seemed to get anywhere.
    there is a site on the web that people register their details if they have a 3D printer and are looking for work, you just enter your location and the nearest 3D printer is shown and you can send your design for a quote, I”l try to remember the site and post it there.

    BTW if you want a bezel printing let me know the size and I will print you one, ridges and all 🙂 maybe a swap for a nextion PCB? no presure 😉 I’ll do you one anyway if you like.

  4. “just run one off on your 3d printer”
    Why not ….. well if you haven’t got one you could always use http://www.shapeways.com.
    Seriously, I know from earlier comments your not a fan of the ridges in 3D printed parts and I don’t disagree but there are a few people out there who get good results post processing their parts and painting them and they look pretty good.

    You could try a design out with Shapeways their process uses powder materials that are hardened using lasers (not tying to teach you to suck eggs ;-)) and therefore the finish is very good you can also request further processing to give a better finish and although the cost per case will be a lot higher it’s probably better than the alternative.

    1. Thanks for that Phil – keep em coming – I think actually that people could do a nice side business of making cases for other people – I’ve been in electronics all my life and cases have been a pain in the bum since I was about 12!! Raspberry Pi are 10 a penny – like $4 in America or China or £25 here in the UK by people buying stuff from China (note the slight sarcasm) – but most of the other boards – no cases – would be great to have a service in the city centre you could go and get cases made cheaply while you wait.. ok, I’m dreaming now.

Comments are closed.