Sometimes I forget things. In particular, I forget to transfer my clean but wet laundry from the washing machine to the dryer. When this happens, I have to waste time, detergent, electricity, and water to re-wash the clothes. My wife's sister has an expensive race-car-red washing machine that plays a few cheerful musical notes when the cycle is finished. That reminder is helpful, and my better half likes the little tune, but I figured I could get crafty and make the dumb old washer and dryer whisper in my ear through the internet. Here's how I did it.
My survey of the internet for ideas revealed a number of people with the same problem and a wide range of solutions for it. Other forgetful individuals have built laundry monitors using optical sensors that look at an indicator light on the washer's control panel. My appliance had no such light. Some tied into end-of-cycle signals inside the appliances' control circuits. I wanted a design that could be replicated cheaply and was compatible with any washer and dryer pair without voiding the warranty, so I got to work devising my own sensor package. As one might with any home-brewed approach, however, I ran into some false starts.
First off, I tried using some piezo-based vibration sensors, but none were sensitive enough to pick up the subtle dancing of the washing machine. I thought I could brute-force the problem and use an Arduino and a couple of Hall-effect-based Allegro ACS712 current-measuring sensors to see if power consumption was in a high or near-zero state. The approach worked reliably, but the materials needed to build a robust, safe housing for the 220VAC portion of the dryer-activity-sensing circuit were too expensive. The sacrificial 220VAC power cord cost a couple times more than the Arduino, both current sensors, and the ENC28J60 Ethernet interface.
After that dead end, a little dialogue with The Tech Report editorial staff turned up Jamie Navarro's laundry monitor system. Jamie's system used an ESP8266 Wi-Fi-enabled microcontroller along with a pair of Adafruit LIS3DH three-axis gyroscopic sensors. The gyro sensors measure acceleration, but they can also report "taps" to a microcontroller. A certain number of taps in a given period of time suggest that a machine is running, and when no taps are detected over a period of time, the machine is probably finished. The sensors attach to the body of the appliance with neodymium magnets.
Navarro's general hardware design seemed like a good match to my goals of low cost and near-universal compatibility, but I had my own ideas for the software. His approach kept track of timing on the device itself, then used SMTP2Go's free service tier to send notification emails. I wanted to log the data and apply logic on my server. I also wanted to receive SMS messages. My mobile carrier will convert emails to SMS, but for some reason the carrier consistently rejects messages from SMTP2Go. I wanted to keep the hardware simple, so I left out the physical buttons and the indicator LEDs from Navarro's plan.
With those basics in place, I started writing some software to make my ideas work. My solution incorporates some elements of Navarro's code, but I also wrote some of my own to take advantage of the lightweight, fault-tolerant MQTT publisher-subscriber-broker protocol used in many remote-sensing applications. I wanted the monitor gadget to connect to my Wi-Fi at boot-up and "publish" MQTT messages with the number of washer taps and dryer taps detected in a ten-second period. If 100 consecutive vibration-free periods elapse, the gadget stops transmitting until it detects new vibrations.
So that the monitor wasn't screaming into the void, I installed the Mosquitto open-source MQTT broker software on my home server. Mosquitto includes a bare-bones MQTT subscriber binary, but it lacks any ability to act on the messages. I did a little more research and put my meager Python skills to work writing a simple MQTT "subscriber" using the Paho MQTT Python library. The subscriber program accepts messages, adds date and time information to each message (the ESP8266 lacks a real time clock), and logs all data to a file. I didn't want to get false alarms when my dog's tail slaps against the washing machine or someone unloads the dryer, so I added some simple logic to determine whether the appliances were really running. If the subscriber script thinks one of the machines has started running, it sends a quick email. When the conditions match the signature of the end of a cycle, the software sends an email and an SMS via IFTTT. If one machine finishes while the other is running, no message is sent. I don't care if the washer is finished if the dryer is still running.
With all that groundwork laid, I set up a cron job on my server for the Python script to run at boot time and restart in the event of a crash. I made some mistakes in this step that led to receiving 50 emails when the dryer started and stopped, but I eventually figured it out. It took a few days to accumulate enough dirty clothes to get the sensitivity for each sensor dialed in—at one point I had the dryer sensitivity dialed in so high I was receiving emails when the furnace kicked on—but the gadget is now working reliably. The device reliably sends alerts when the washer and dryer run, and the usage of the MQTT protocol allows me to keep precise logs of washer and dryer operation. With my new setup, laundry cycles will be wasted only through willful laziness.
Over the course of developing the system, I learned plenty about microcontrollers, programming in the Arduino IDE, and working with the MQTT protocol. I would like to give credit to Jamie Navarro for the general design. Nick O'Leary's Arduino Client for MQTT code, with its excellent example files and API documentation, was also instrumental in creating a working system. An even greater reward for me was the way the ESP8266 brought past and future together. When I first became interested in computers in the mid-1990s, Wi-Fi didn't exist at all, and a 32-bit chip running at 80MHz was impressive. The ESP8266 packs 802.11n capability that was cutting-edge a few years ago into a board that costs less than $4. At the same time, programming the little chip is like taking a time machine into an era where 100KB was a lot of memory and the only way to tell if a program was working was to watch blinking lights. The community surrounding the Arduino and the ESP8266 is lively and helpful.
I have more ideas for similar sensors in my home, including an ESP8266-based sous vide water bath controller that uses MQTT to receive a target temperature and logs current conditions on my server, a device that uses a ultrasonic distance sensor to track the depth of water in my house's sump pump well, and another vibration detector that will track the activity of my HVAC system. For now, though, I'm just happy to know when my clothes are clean. If you suffer from the same absent-mindedness, the code for the ESP8266 and the Python MQTT subscriber client are both available on GitHub. The code works, but I'm sure you gerbils can point out many elements that could be improved.
|Nvidia teams with Oculus for a VR game bundle||1|
|SK Hynix fires up its foundries for 16 Gb/s GDDR6||15|
|Corsair's K95 RGB Platinum gaming keyboard reviewed||0|
|EK shows its first waterblock for an AMD Ryzen mobo||5|
|Porsche and AOC present the PDS241 and PDS271 monitors||13|
|HyperX's Pulsefire gaming mouse reviewed||6|
|HP DreamColor Z31x and Z24x displays are ready for the movies||8|
|Intel's 32GB Optane Memory storage accelerator reviewed||78|
|Akitio Node Lite is a small aluminum home for PCIe devices||11|
|Love the packaging. For the love of god - this minimalism and colour scheme on regular people cards, please.||+37|