This blog page is a bit of a waffle on how I found out about the ESP8266 and my process for getting it working for me.
If you want a technical description on connecting one up and getting code running, then the ESP8266 Getting Started Guide should help.
My introduction to ESP8266’s
Some time ago, I supported a kickstarter for a product to help automatically reset WiFi routers. This was called WiReboot and took the form of a small unit that plugged in between the power supply and the router itself. The idea was that if it saw the WiFi could not connect to the internet then it did a reboot (by removing power) of the router. To me this seemed a great idea, and especially for my parents home where their (ISP supplied) router was quite temperamental.
As things go with most things Kickstarter, the item took a lot longer to arrive than anticipated and I ended up making a similar device using a Raspberry Pi and a relay hat.
Eventually the WiReboot did arrive and I gave it a try for myself. The units looked quite nice and were (much) smaller than my homebrew version, however as with many IOT devices they relied on an app and a connection to an external server to operate. For me I am not a big fan of this approach as it suffers from both End Of Support issues by the vendor and worse leaves an open tunnel into your home network, which could theoretically be misused. Add to that, the setup seemed very hit or miss and didn’t seem reliable. With all that in mind, the units (I had ordered the developer kit of 5) sat in their original packaging on a shelf for a while.
Flash forward to a few weeks ago and I was tidying up my work area and came across the bag of bits. I very nearly threw them out but something made me decide to look inside the units to see what was there.
Opening them up, I saw that the circuitry was actually two boards soldered together.
The core appearing to be a small sub board with a large (relatively) metal case component and what appeared to be a PCB track antenna. This interested me, and so out came the soldering iron and after a while I managed to separate the two boards and was able to read the designator on the bottom of the board, which identified itself as ESP-12E. A quick bit of duckduckgoing (or googling if you prefer sharing your information) and I found that this was a quite common module for the Ai Thinker ESP8266 microcontroller.
A bit more duckduckgoing and it became clear that you can use these with the Arduino IDE. So that seemed a good place to start, but how to connect it and how to program it. More searching and a lot of varying information later I had a plan to solder up a unit to a serial port and get started.
Let’s just say it didn’t work to begin with and infact it took quite a while to get running, pull ups, pull downs, power on configurations and power issues abounded. Eventually I started to get things happening (not necessarily correctly, but at least doing something). A bit more work and I got to the point I could make it program and provide output. If you are interested it making it work yourself, then go read the ESP8266 Guide which will let you set it up yourself.
A quick few program tests to see if it can work, and yes I can blink the LED. Next test WiFi, and also quite easy to get going.
While doing this I did also order a few new units (of the ESP-12F ) this meant I could keep a few of the WiReboots assembled as I think these might be useful as they are. But that’s another blog for another time.
Next step was to see how I could program these units without having to do all the direct wiring each time.
My first idea was to use PCB test pins and have a mini programmer unit, I built this as a 3D model in Blender (I really must get around to learning fusion360) and then 3D printed it on my Sonic Mini. It kind of works…… Kind of.
Actually I did 2 versions, the first used an elastic band to hold the unit in place, but I found that although there were only 6 of the test pins used, and they are 1mm diameter they still had too much force to reliably make contact. So the 2nd version had a locking clamp to hold the board in place. This one does work (most of the time), but still seems like the pins do not make enough of a contact for the power pins.
There is also the issue of needing 4 resistors on the board to make it operate in normal mode.
For the original testing I had been using normal 1/4W resistors (4K7) and these were quite large compared to the board itself. So next pass was to try surface mount resistors and solder them directly to the PCB (but vertically). This is a bit fiddly to say the least, but allowed quite a compact setup.
If you are planning to make these, and program them, then assemble them into a unit, this would probably be a good approach. But for me, I would want more in-system programming capability and this seems to imply a plug/socket arrangement.
Not wanting to make a custom PCB (well not at this point) I deceided to see if I could make a small daughter board using 0.1” plated hole prototype board.
Using a 6×4 hole board and a 6 pin header, 4 1206 SMD resistors and some wire, I was able to make a small board that I could then fix to the top of the ESP-12F board and use it to connect to the relevant pins on the board.
Not the tidiest, but does keep the unit small, and allows it to plug into a programmer for upload/testing and then can be used with separate power for remote operation.
I think there is a more hybrid combination that might be more compact, using the direct connected Resistors and then a floating pin header, but that’s for the next batch.
For now this gets me to a working and stable unit that I can experiment with.
First demo project
One test I did of this is to use the ESP board with a small OLED display and a battery pack (with boost/buck converter) to make a small NTP clock display.
This also runs a WebServer with gives it’s time and voltage back.
Nothing too fancy, but this allows me to test battery life along with a few other experiments.
I have tried a hybrid arrangement with the resistors mounted directly to the pads, and a JST connector used as the programming header. This seems to work and does give a smaller overall size to the unit, but I have suffered from temperamental startups. This appears to be power related as soldering a 10uF capacitor directly to the board seems to fix it. I now have some Surface mount 100nF and 10uF items on their way, so will see if the 100nF is enough.
Meanwhile I have been doing some power testing to see what current is drawn by these units in differing operational modes. The results of which can be found here.