We’ve had a very busy weekend – a friend of mine, Jonathan who’s another gadget guy stopped over and while the girls went shopping we spent the weekend been buried away in the man-cave experimenting. Firstly – a link for you – if you have an LG TV – here’s how to control it from the command line – and hence if you like, from Node-Red.
Jonathan brought some kit over including a Seeed Studio WIO board and a couple of peripherals.
For beginners: Seeed do a series of products under the name of WIOLINK – one larger board and one tiny one with ESP8266 WiFi controllers, together with various peripherals. Together they make a nice playground with a very clever cloud-oriented setup whereby you can use a mobile phone to set up the board and peripherals are set up via the cloud. Once in place you can call an API to do your own control.
For example – you need a controller for an RGB LCD Display? Dial up the display from their list of covered products (their own – usually small peripherals with a common 4-way connector) – press go – and the software on the board is updated to handle the new peripheral – which you can now access via an http POST. In the case of their larger board with several connectors, the APP even tells you which connector to plug the peripheral into!
Now this cloud-based approach is all very nice but originally this was based in China… my first thoughts were that I would not put it past the Chinese government to have a back door to such systems – imagine if millions of us were controlling our homes using their servers – what a powerful tool for disruption that could be – well, they now have a server in the USA and I believe you can do your own at home if you want but I’ll leave you to look up their info on that subject. For me this is just something new to play with and get ideas from.
NOT for beginners: Armed with an original WIOLINK board and a couple of peripherals, we set about this weekend to see how well this worked. The phone APP all works well, their hardware seems to work well but when it comes to using the API once you’re all set up, the only Node-Red node we found has not been updated in a while and does not seem to work well.
So this is aimed at people who don’t want to get the soldering iron out and would prefer not to program either. And that’s fine.
But we wanted to see how this worked and see what we could do with it – and importantly what others who read this blog might want to do – so we took a bog-standard ESP-12 module, programmed it up with the Seeed code and… well, read on…
So you have a standard ESP-12 module, preferably with prototyping pins – and you want to make your own WIOLINK board - firstly if you don’t have it, you may wish to get the Espressif flasher. Then you need: Assorted binaries, and two bin files user1.bin and user2.bin.
Put them all in a directory somewhere, maybe called \wio.
Flash the software as such:
And that’s it - you have all you need to get started. Grab the WIO app for the phone and get a free account.
If using an ESP-12 module instead of a genuine WIO board, where Seeed refer to using UART, then RX on the ESP8266 is D1 on their boards which is the outer connection opposite ground and TX is the inner connector next to RX – of their standard 4-wire connector. Vcc is 3v3 except in the case of their RGB LCD which needs 5v (that will be to keep the LEDs happy). Make sure you don’t use 5v on other peripherals.
If using their I2c port – SCL is GPIO5 and SDA is GPIO4 (some boards may be reversed on some ESP-12 boards).
We tried this out using the excellent Grove LCD RGB Backlight (which I’ve since managed to get running on my own ESP8266 code as it is very pretty), magnificent if only because you can make the backlight any colour you like!! Everything just worked once we figured out the pins. YES you can get alternatives to this board for less money – but until I can get my hands on one – I can’t tell you if they are compatible. In particular, you can set the backlight on this board to any colour your heart desires, using RGB values. Want a light purple or an ice-green, or pink etc. – no problem. This actually transforms an otherwise utterly boring 16 character by 2 line display into something far more useful.
To set these up, Attach a LED+resistor to GPIO2 as an indicator with the other end grounded. The programming pin is GPIO0 – equivalent to the setup button on the real WIO device. Hold this to ground for a few seconds to go into setup mode – which is shown by a softly undulating light on GPIO2. Note that all my general purpose ESP8266 boards have 1k pull-ups on GPIO0 and GPIO2 to 3v3. In this case you might want to consider adding similar pull-ups to GPIO4 and 5 as if you are using I2c then you do need pull-ups. Some peripherals have them, some don’t – a bit of a mess really as you really should just have the one set of pull-ups.
So basically you end up with an API call to their server with a unique code and some parameters – which control your board. There are a variety of ways to use this – and in the case of Node-Red there is even a set of nodes to do the job – but when we tested them we came up with various issues and the code looks like it has not been updated for a while – so you might be on your own there.
And so, taking the above into account it is quite easy then to try out the various Grove peripherals – at least those supported by WIO. The App itself makes it easy for you to fire out commands.
Up to now, the RGB_LCD display has proven to be the most fun which is why I’ve adapted the code for my own ESP code, along with the visible/uv/ir light sensor. Other devices less so – as they don’t use I2c. Seeed do a 4-channel 7-segment LED display – and a 10-channel level meter, both of which are 2-pin control but are NOT I2c – this means they have to use a separate set of leads – they chose the serial port (I personally prefer to leave that for debugging). If you need the latter – i.e. 10 variable intensity level lights – you’re better off (unless size is important) buying the display and the PWM controller I covered in an earlier blog with 16 outputs. https://tech.scargill.net/16-channels-of-pwm-for-esp8266/