BMC Primary

ESP8266 and ESP32

Over the past year or so, I've been diving more into designing micro systems for home automation and just for general tinkering. I've made several small project items, from switches to light detectors for various uses around the house.

While I used to work on the MC 6800 series (6809 and 68HC11 especially) in my youth, currently I've been working mainly with ESPressif based chips. There are a number of low cost pre-fab systems on the market that offer a lot of bang for the buck, but the ESP8266 and ESP32 based modules have a lot going for them. Both have a native Wifi chip, serial service, several GPIO lines, and at least one ADC onboard, as well as plenty of flash memory and a reasonable amount of ram. The ESP32 line adds more horsepower in the same form factor, but also adds in lots of additional options, from camera linkage to bluetooth and various I2C devices.

For environment, I'm generally preferring PlatformIO using VSCode as the main editor. It's still a little quirky, but offers flexibility that Arduino Studio simply can't match when it comes to more complex tasks.

Mail detector

One of the more interesting items I've made involved a small ESP8266 stamp, a lithium charging board, two 18650 cells, and some misc components. This little invention, about the size of a pack of cigarettes, sits in my mailbox and uses a phototransistor to detect when the box is opened. When it sees light (it's normally pretty dark in the mailbox) it resets the ESP8266. The software then connects via wifi to the home network and updates my local MQTT server with a new timestamp and status. It also checks to see if there is an OTA update waiting, applies it if there is one, and re-enters sleep mode when there's nothing left to do. Since the circuit only catches the edge of the signal, it can go back to sleep no matter the state of the actual door. It ran about 4 to 5 months before it needed a recharge, which took about 2 hours. The system draws under 80uA when in standby, peeking at 150mA during wifi bursts, mainly during initial connection setup. Rough uptime per cycle is about 3 seconds, with a max of 2 cycles per day (adding mail and taking mail).