Off-The-Shelf-Hacker: My New Obsession, the ESP8266
Let’s move off of Steampunk for a bit and talk about my crazy new obsession. The ESP8266 WiFi module.
The device has a 32-bit processor, a generous program space, up to 16 general purpose input/output pins, integrated WiFi and a low price. It’s secured a place with Off-The-Shelf Hackers the world over. It showed up from China in 2014 and had no usable documentation. Within short order, hardware hackers began translating the spec sheets and sharing their knowledge. The Arduino IDE recently started including 8266 libraries, so it’s pretty easy to upload your own firmware from that de facto industry standard environment.
The big question is, what do you do with it?
That’s simple. Here are a few of my current projects.
WiFi Presentation Clicker
You remember my wired clicker on the presentation machine?
The WiFi version lets me control the slides in a LibreOffice Impress presentation over a network link. It uses an ESP8266 model 07, a couple of push buttons and a battery. When powered up the wireless clicker connects to my LAN and starts a simple TCP server. At the LibreOffice Impress (Raspberry Pi or Linux notebook) end, a Python client program then connects to the clicker. Running the wireless clicker as the server seemed a little more secure than the other way around. Pushing a button on the clicker moves forward or backward through the presentation.
The prototype works great, and I’ll soon build a hand-held enclosure for actual use during my tech talks.
Plans call for powering up the wireless clicker in AP mode and then connecting the Pi or Linux notebook, without the need for a LAN, at all. There’s always the risk of mischief whenever using public WiFi at a conference.
Still, I think it’s an interesting project and could be a proof-of-concept for other follow-on systems.
I’ve probably watched way too many tech-oriented action movies because I feel the strong need for a network of intrusion detection sensors around the outside of my house.
The ESP8266 chip is perfect for the job.
My plan is to use a passive infrared sensor to watch defined areas around my yard, then track/log movement with an ultrasonic range finder and send the data to a server, on my LAN, for threat data consolidation and analysis. The software will then notify me accordingly, perhaps via an SMS message on my smartphone, an alert on my desktop or by ringing an alarm bell.
An infrared “trip wire” could also be used around choke points to add another dimension to the data stream. That sensor is just an infrared LED and photocell combo on one side of an opening and a reflector on the other side.
The beauty of using the 8266 the chip only needs power to work, whether supplied by a wire or solar cell/battery combo. All the data is transmitted wirelessly through my network. A standard Arduino solution requires power AND a data connection. The range is not a concern either with the 8266, although the “07” model has a connector for an external antenna if needed. It shouldn’t be a problem anyway, on my palatial ¼-acre estate.
Software on the server will also collate the data, so I’m aware of developing behavior patterns. For example, if the activity occurs at 3:30 in the morning a few days in a row, that might indicate somebody is looking for a way to get into my house. Or, it’s a raccoon rummaging through the trash.
The bad guy, or animal, won’t even know that I know they’re there. Advantage, Dr. Torq. Bad news for the intruder.
Local Temperature Sensor
A few years ago I built a temperature sensor with an Arduino and a Dallas DS18B20 digital thermometer. It worked well and could detect temperature changes down to about 1/10 of a degree F. If you looked at a graph of the temperature inside my house over 24 hours, air-conditioner cycling was clearly obvious.
I even put the device in the fridge and freezer to check that the settings were correct. By-the-way, regular lead-acid batteries lose a lot of power as they get colder.
My new design calls for an ESP8266 in place of the Arduino. I’ll likely just need to add a couple of WiFi-related lines of code, to the original sketch to get the thing working. Depending on the application, readings will be selectable from about once per second to one reading per minute. In between readings, the 8266 can be put into deep-sleep mode to minimize power requirements, if it is running on batteries.
One cool thing about using the DS18B20 is that you can chain several together on a two-wire bus. They call them one-wire devices, although you really end up with one wire and a ground. Three or four temperature sensors on a 30-foot piece of 22-gauge cable is a no brainer. Each sensor has a unique ID code built in that’s keyed to the data, so sorting values out in code, is easy.
Like the intrusion sensor, data can be collected on a local server and analyzed in various ways. You might call it a local Internet of Things.
Go Forth And Build
WiFi-enabled microcontrollers are becoming ubiquitous, and the barriers to entry keep falling. Here’s an “07” model for 3.39 USD with free shipping to the US. Five devices are only 13.51 USD, with free shipping included.
Watch out, though, building 8266 projects just may become your new obsession.