Just trying to untangle the threads

A couple of good (ESP8266) examples…

Anyone who’s ever done a web search for “esp8266” will have come across some of Martin Harizanov’s work at some point. Martin has been playing with these modules since they first became available and, importantly, publishing his experiences as he went along. His blog, Martin’s corner on the web, is one of those sites worth checking out on a regular basis, to see what he’s come up with recently. A couple of months ago, he started teasing us with the promise of a mains power control board based on the ESP8266 and had the first prototypes (including schematics and board design) on the web, but no code. In replies to comments, Martin admitted that things were taking a wee bit longer than expected, but a few days ago he finally made his code available on GiHub. And it was worth the wait.

For those of us who learn best by picking apart example code, rather than reading the SDK manual pages (cough! If there are any. cough!), Martin’s work is the go-to reference. He’s managed to shoehorn so much stuff into there that there’s pretty much something for everybody to learn from. It’s true that he has taken a whole bunch of code written by others (Sprite_tm and TuanPM both get honourable mentions here) to create his baby, but basically that’s pretty much what we all do with Open Source projects; we take existing code as a starting point or inspiration and develop from it (Martin has a list of attributions on his Three Channel WiFi Relay Board page). What he has created is basically a complete product, both hardware and software, which has a web enabled front end where you can not only switch the state of the power relays or read the values from sensors, but also configure the network settings of the ESP8266 itself (for instance, changing the IP allocation from DHCP to a static address, changing the netmask and configuring a gateway) and then, still from the web, reboot the ESP8266 to have the changes take effect. The web stuff is all built on top of Sprite_tm’s ESP8266_httpd server. Then there’s the MQTT implementation from TuanPM, which allows the unit to communicate seamlessly with a server running an MQTT broker service. There’s an sntp service in there too, so your timestamps should always be accurate, a JSON parser so you can pass complex messages to your unit and have it decode and select specific data, a ThingSpeak interface and a weekly scheduler for heating control. There’s probably a ton of other stuff in there that I’ve forgotten to mention (or haven’t discovered yet), so you should wander over to Martin’s GitHub repository and clone yourself a copy to explore at your leisure.

Along the same lines, the current go-to blog for real world (ie:- “this doesn’t work, what am I doing wrong?”) ESP8266 development is Pete Scargill’s tech blog. I can identify with Pete; we’re both “mature” (read: “past sell-by date”), we both have a background which includes electronics and PIC micros, we both roll our Rrrrrrrr’s and we’re both struggling with the ESP8266. The main difference is that Pete is succeeding in his struggles, while I’m still flailing around in a fog. Pete’s blog attracts a lot of visitors (it’s well written, witty and informative) and each post generally generates quite a few comments, which are usually just as informative as the blog itself. Pete publishes titbits of code, pin-outs for new modules, tips on installing support software and tons of other stuff as he discovers it, so his blog is one of those daily-reads which you really shouldn’t miss if you’re working with the ESP8266. Recently he’s been working on getting the WS2812B series of controllable LEDs to work reliably when driven directly from the ESP module itself (no Arduino or other microcontroller involved), so if you’re into blinkenlights, pop over and take a look at his “ESP8266 WS2812B LEDs on a Plate” article.

One thought on “A couple of good (ESP8266) examples…”

[…] Martin Harizanov, who’s work I mentioned in a previous blog, has a slightly different method for the includes. He ships an extra include file, include/espmissingincludes.h, with his projects, which has all of the missing function prototypes defined in it. […]