Modal Title
Edge Computing / Tech Life

Off-The-Shelf Hacker: Refining the Yard-Guarding Sensor Prototype

Oct 22nd, 2016 6:38am by
Featued image for: Off-The-Shelf Hacker: Refining the Yard-Guarding Sensor Prototype

Prototyping physical computing hardware is labor intensive. You are starting out with a blank slate and add parts and experiment with the design until you get a working device. Some of it is educated trial and error. Other times, it seems like pure magic, especially to the layperson. Hacking through the initial unknown, “Will it work?” stage takes patience, persistence and strong troubleshoot skills.

Getting even a simple project, like the ESP8266-based passive infrared sensor (PIR) yard sensor going that I’ve been working on over the past month, simply takes time to develop.

I began by hacking out the circuit on the ubiquitous experimenter’s breadboard using an ESP8266-07 module. Once that circuit worked, I moved it over to the simplified ESP8266-01 model, with appropriate wiring mods. Along the way, I also documented both circuits and parts lists in Fritzing. Keeping track of progress on what you’ve done and what you plan to do is all part of the game. You frequently have to go through several iterations, before reaching a workable design.

Today we’ll move out of the “temporary” breadboard stage into the “practical” prototype realm. “Practical” here means the device is more or less ready for realistic testing and can likely be used as a demo piece. In other words, it actually functions reliably and is presentable for conference talks, funding pitches, demo to fans/friends/family and so on.

From Temporary to Practical

Readers may recall the jumble of wires and components at the top of last week’s “Off-The-Shelf Hacker: Guard the Yard with Passive Infrared Sensors” story. Although I initially thought the “wires and parts” approach would save time, it turned out to be problematic for troubleshooting.

Take note, this is a pretty simple circuit. I bit the bullet and pivoted to a traditional breadboard (blank board with holes) and point-to-point wiring technique. Better to neatly lay everything out and make it simple. Wiring up with point-to-point took about two hours and I only omitted one jumper, which was easily spotted and fixed when I first applied power.

Here’s a depiction of the experimenter’s version:

ESP8266-01 - PIR Experimenter's Board

ESP8266-01 – PIR Experimenter’s Board

And, here are front and back views of the traditional breadboard layout with point-to-point wiring:

Front of traditional point-to-point breadboard, with components

Front of traditional point-to-point breadboard, with components.

Back of traditional point-to-point breadboard, showing connections

Back of traditional point-to-point breadboard, showing connections.

I purchased the 4.5” x 6.5” phenolic breadboard locally from Radio Shack. You can cut out the shape you need with a fine-toothed hacksaw, a Dremel with a cut-off wheel or just score it and break it over a sharp edge. Guess which technique I used?

Point-to-point is much cleaner than freeform hardwiring components together. With freeform hardwiring, it’s difficult to keep track of wiring and connections. Securing parts to a board also makes the circuit much more robust. You need solid hardware for rigorous testing and reliable demos. You may have seen electronics from the 1940’s and 1950’s that used “terminal strips.” Now those were stout! Wires were physically attached to the terminals and then soldered. Point-to-point is still a valuable construction technique for prototyping, onesy-twosy and one-off or quick turn-around projects, especially when using an inexpensive phenolic breadboard.

Adding Components to the Board

I also decided to omit the 4 x 2 socket, this time, since I was under deadline for this story. I have to build stuff fast and then write it up each week, so making compromises are a fact of life. Pushing the 8 pin ESP8266-01 header pins through the board and then soldering the wires on is quick and strong.

Here’s a closeup of the 8266 and its wires:

Closeup of the 8266 Connections.

Closeup of the 8266 Connections.

Once, this project is completed and I’m finished with testing/analysis, I may design a printed circuit board (PCB) for duplicating the sensor and recycle this board as an ESP8266-01 programmer. In that case, I’ll replace the current 8266 with a commercial 4 x 2 socket.

Readers will also notice that there is a 5-volt to 3.3-volt level converter on the breadboard. The 8266 runs on 3.3 volts and my current USB-TTL cable, used for programming and power, is a 5-volt version. I probably should invest $20 in a 3.3-volt model. Level converters take my 5-volt cable pins down to the 3.3 level needed for the ESP8266s. I only needed one channel for USB to serial communications with the 8266. Once the prototype is hammered out, production 8266/PIR yard sensor boards, don’t need a level converter since you’ll just program the ESP8266-01 on a programming board and then solder it onto a finished printed circuit board.

There’s also the ever-present 3.3-volt regulator power supply to provide juice to the 8266. The PIR sensor itself requires 9-12 volts for reliable triggering. If I use a 12-volt re-purposed home landscape lighting power supply or wall wart, the little 3.3-volt regulator is there to keep the 8266 happy while the main 12-volt input can power the PIR sensor. Everybody wins.

One additional technique I employed is the use of “header-jumpers.” When programming the 8266’s you need to disconnect the TX line, then ground the “Reset” pin, in order to reset the board before a firmware upload. I used a 2-pin header in the RX line from the level converter to the TX pin on the 8266. There’s also a 2-pin header between the 8266 Reset pin and ground.

It’s then easy to pull the little white jumper on the RX line, temporarily plug and unplug the jumper onto the “Reset” header, watch for a quick blue LED blink indicating a successful reset, then replace the jumper on the RX line. You can then hit “Upload” in the Arduino IDE to move the firmware from your Linux notebook to the 8266 board.

I also used a 3-pin header (with a 2-pin jumper) to be able to choose to connect the GPIO 00 pin either to ground, for programming or +3.3-volts for regular operation. Simply move the jumper back and forth as needed.

The new board works, although I still have to test powering it from a 9-12 volt input, instead of just the 5 volts, supplied by the USB cable. The PIR sensor works at 5 volts, although triggering is much more reliable with 9 to 12 volts.

Wrap up

For next week’s ESP8266-PIR yard sensor article, I’ll button up the device housing, cover device deployment out in the yard and talk about how I’ll gather the data for analysis. In a few weeks, I’ll return with a report on sensor logs and a run down on any interesting or mysterious activities I see outside at 3:15 AM.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Shelf, Simply.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.