Clothes Dry messaging with the SSP-x
How often have you started the clothes dryer and continued with other chores. Later that day you remember that load of laundry in the dryer but it's too late. The laundry long since cooled into a tangled clump of wrinkled shirts. What if the dryer could notify you when it's done! Never again will you forget the laundry! Well, it's possible using the SSP-x and a Raspberry Pi.
The Raspberry Pi is a simple Linux computer based on a Broadcom BCM2835 SoC and is intended for students, hobbyist and hackers. The SSP-x is GCDC's simple serial port interface to a 16g sensor. Together, the Pi and the SSP-x monitors the dryer.
We installed Python and mail utilities to the Pi by typing the following into a terminal window:sudo apt-get update
Once those were installed we ran sudo easy_install -U distribute to update the Python distribution. We then created a python script to monitor the dryer vibration using the SSP-x accelerometer. The script captures a few seconds of data from the serial port and analyzes the vibration detected by the accelerometer. A certain level of vibration indicates the dryer is turning. When the vibration stops, the clothes are done and a text messsage (or email) is sent to your phone. The python script is available here.
The script is easily configured using the config.txt file placed in the /home/pi directory. This file allows easy access to some of the variables used in the python sript such as num (the email address or phone number to send the notification to), laststate (the last know state the dryer was in 1 = dryer on, 0 = dryer off), calBad ( 1 = redo the calibration, 0 continue using the current numbers, calx, caly and calz (used to store the calibration values), and threshold (determines the point we think the dryer is on). An example configuration file is available here.
The script is scheduled to run every five minutes using a cron job. You do this by adding in:
sudo crontab -e
*/5 * * * * /home/pi/DryerMoniter.py to the crontab file. Modify the /home/pi/DryerMoniter.py to the location you saved the DryerMonitor.py script. An example of what the crontab looks like can be seen in the picture below. We also redirected the output of the DryerMoniter script to /tmp/out.txt so we could verify that the cron job was running
To help with determining the correct threshold for your dryer we created the dryer test script. This script will continuously display the magnitude values from the SSP-x accelerometer. Run the script and watch the values reported while the dryer is off and on. This will help establish the appropriate threshold level for vibration. Press cntrl+c to exit the script.
The Pi runs continously and checks the dryer every 5 minutes as part of a scheduled task. Therefore, there is no need to start the script before starting the laundry - it's always monitoring. You can be anywhere in the world (within cell coverage) and know when the clothes are dry. A second SSP-x and script can be used to monitor the washer too. No more excuses for forgetting the laundry now!