Raspberry Shake
Table of Contents
Please consider leaving a small gesture of your appreciation.
Ever got yourself so absorbed in an evenings TV binge that you’ve accidentally forgotten about a load of washing, and left it to fester in the machine overnight? Need a subtle reminder to take the towels out of the dryer? Wishing that you could connect your dishwasher to the Internet of Things? Then the Raspberry Shake is for you!
The basics #
This project boils down to a simple accelerometer hooked up to a Raspberry Pi Zero, put inside a case that can stick to a washing machine/dishwasher/dryer or anything else you can think of! A simple Python script runs on the Pi to monitor the forces being exerted on the accelerometer, and send notifications when it determines that the appliance has started and finished. In this build I’ve just made it light up some LEDs and then send a notification via Pushover, but you could easily hook up a buzzer or other components to really make a noise! This is a very cheap and simple build, requiring only a few components and the most basic building, programming and electronics knowledge.
The components #
- Raspberry Pi Zero
- LIS3DH 3-axis accelerometer
- Green/ Red LEDs
- Small food container
- Magnetic Strip with Adhesive
- USB WiFi dongle
- Micro-USB power supply
- USB to Micro-USB adapter
- M2 size screws/nuts/washers
I had most of the components for this project lying around already, so I don’t know the exact cost, but I’d estimate it to be under £20 (~$30USD) - it’s a cheap enough build that I’ve made two, with plans to make a third.
The build #
I recorded myself putting together my second Raspberry Shake (the first involved too much swearing and a little bit of fire) - the video can be viewed here
The software #
The hardest part of this project was getting access to the data from the LIS3DH sensor in Python, since there wasn’t a pre-existing library. However, I’ve already solved that problem! You can read about that
part of the project here, and find the resulting code
on GitHub. I’ve also published the Python code for monitoring the sensor and sending notifications - it’s available
here. You may find the shaker.py
code useful, it contains a thread that monitors an instance of the LIS3DH library described above, and a class that can interpret the results of that into “hot” and “cold” (appliance running and not-running) states, making the appropriate callbacks. The Appliance.py
file is designed to be run from the command line, or through something like
Supervisord, and contains the callbacks to send notifications on my network - they won’t be much use to you!
The future #
I don’t think there’s much more tweaking I want to make to the units I’ve already put together - I’m very happy with them being “set and forget” type sensors. However, there are plenty of opportunities for expanding this, such as:
- Connecting a speaker/buzzer to make noise when the appliance finishes
- Connecting a button to silence the noise-maker
- Using different types of sensor (such as heat to check if an oven is on, light to check if the fridge door is open, and many more)
Once your appliances are part of the Internet of Things then the only limit is your imagination!
The conclusion #
While this project was nowhere near as involved as the AlarmPi I made previously, I thoroughly enjoyed putting this together - and I think it would make a fantastic (and cheap) introduction for anyone wanting to get started playing with the endless possibilities for GPIO development on the Raspberry Pi. I’d love to hear about any projects inspired by this - please leave links and details in the comments below!