The King is dead. Long live the king!

For a while now, I’ve been playing with the super-cheap esp8266 WiFi module. It’s been a bit of an uphill struggle, mostly because of the poor documentation (actually, that’s not fair – the documentation may well be excellent, but my understanding of Chinese isn’t) and the lack of easy programming tools. Until now, there have been essentially three ways of using the module:

Serial for breakfast

The initial method was to control the module via a serial link. As supplied, it can communicate with an arduino (or anything else) using a simple serial connection, using AT-style commands which will be familiar to anyone who has worked with modems, especially GSM ones. It works, but it’s a bit clunky. By and large, I think people have stopped doing this.

C for elevenses

Pretty soon after it became available, smarter people than me figured out that the module is powered by a general-purpose microprocessor (and a pretty powerful one at that). It also became apparent that you could reprogram this directly, and use its spare capacity (and spare I/O pins). Thanks to the manufacturer’s release of an SDK, it became possible to write code directly on the module, without the need for an arduino or any other processor. For less than five pounds, you could have a general-purpose microcontroller with build in WiFi.

Of course, there’s a catch. The tool chain required to do this programming is hard to set up and complicated to use. It also means programming in C and understanding a pretty complex SDK. It’s not particularly friendly. There were some valiant efforts to make this easier, notably Mikhail Grigorev’s bundling of everything into the eclipse IDE. This works well, but it still requires you to program at quite a low level.

lua for lunch

More recently, there has been nodemcu. This is a new set of firmware for the esp8266, which builds in an implementation of the lua language, with the SDK functions wrapped and easy to use. Nodemcu allows you to write programs in lua, upload them to the esp8266 and run them on it. This works pretty well. I’ve had temperature sensors in my house using it for a while, It has some drawbacks, principle amongst which is that the nodemcu firmware takes up quite a lot of the available memory, leaving fairly little for your programs. Add to this the fact that your programs are sent to the device as source code, and interpreted (or compiled) in place, and you find that there really isn’t much space to write more than simple programs. This shouldn’t be an issue for small sensor nodes, but I found myself scratching around trying to save a byte here and a byte there just to get my code to run.

Arduino for dinner

What everyone has been secretly waiting for, of course, is the ability to program the esp8266 like an arduino. And now we can. There’s a new version of the arduino ide 1.6.1 which gives you the ability to program the esp8266 using familiar arduino code. The wifi functions are easily available, as are most other arduino functions. It’s insanely easy to write something which connects to a wifi router, gets an ip address and sends data to a server. Or indeed to run a server on the device. Because the arduino language is compiled to native code before being uploaded, there’s loads of space for programs. Some of the normal arduino libraries have not been ported yet, but I’m sure they will be in the coming weeks. I won’t be going back to any of the other methods. Long live the king!

It’s worth repeating that the esp8266 gives you a tiny board with a 32 bit processor running at 80MHz, at least half a megabyte of memory (my recent olimex ones have 2MB), multiple IO pins and wifi for less than five pounds. If I were arduino (whichever half of arduino you care to pick) I’d be worried.

Printed lathe parts online

Since I posted a video of my 3D printed lathe on YouTube, the video has now been viewed over 100,000 times. If a typical working day is 8 hours, and the working year is 250 days or so, then it’s the equivalent of about two solid years of someone watching it. That’s not a job I’d want.

assembly2

Anyway, a number of people have asked for the STL files so they could make one themselves. I’ve finally got them in some sort of order, and you can now download a zip file with them all from here

.

If you haven’t seen the video, here it is: