I keep putting the washing on late at night and having to check it every few minutes to see if it’s finished so I can throw it in the dryer and go to bed. Not too much of a big deal by itself, but I live in a 3 story townhouse and after the fourth or fifth trip down the stairs and up again, I tend to get get lazy.
Most people have said “But if you always put it on a certain setting you know how long it’s going to take.” While this is true, I have not timed this setting and I don’t plan to. I have the capability to do something ridiculous instead and I’m damn well going to do it. No, I’m not going to put a webcam in the laundry on ground floor! Amateur. I’m going to make my washing machine tweet me when it’s done. That’s right….twitter!
So a while back I had a Raspberry Pi (the original one) and it went bad. I thought it was cooked, so I bought another. Then I worked out that there was an issue with the SDCard reader and if you applied pressure to the SDCard in the right spot it worked again. Now I had 2 Pi’s. So, one I can do pointless crap with.
Let’s make this bitch tweet. The switch itself seemed trivial, so I started with getting something linux ish on the internet in preparation for tweeting. That means wifi (none of this wired ethernet caveman crap) and a switch hanging off it at some point. Raspberry Pis (even the old ones) run a nice version of debian linux called Raspbian. So I downloaded that and installed it to the Pi.
Lucky me, the thing comes with a snazzy set of generic wifi drivers and it was able to enumerate and use my wifi usb adaptor out of the box. So a quick edit to the boot system fires that sucker up automatically whenever it boots and signs into my wifi. With that covered, I just need to tweet. First things first, I set up a Twitter API interface on the twitter side, then installed Twython. It’s basically a python powered tweeting app for linux. One little python script is all that’s needed to send a tweet and I can just ssh in and call it from the terminal.
Twitter doesn’t like getting the same tweet twice and rejects the second tweet if it’s not original. So to make it original I just tacked a date/timestamp on the end of it and that satisfied the narky little app. All that’s left now is to get a switch to trigger this command and we’re ready to deploy. Initially I used a microswitch and using the IO interface on the python set up a C program to loop through monitoring the IO header for the switch event then trigger the command to tweet. Throw that into the boot sequence and we’re ready to go.
When it came to attaching this thing to the washing machine (I have an old dial type one) placing a microswitch so it didn’t get int the way of the dial but would still trigger was a pain in the ass, so I went with an optical switch and piece of black cardboard taped to the top of the dial. This let’s the dial continue to rotate through the optical sensor, triggering it, and continue on it’s merry way without knocking into things. I’ve attached an old blackberry charger to the Pi to supply power and used double sided tape to stick it to the washing machine and wall nearby.
Now it sends me a fancy tweet when the washings done and I can go downstairs ASAP to put it in the drier and go to bed. Overdone? Yes. Ridiculous? Yes. Mission accomplished.
Side Note: One night I thought it would be funny to sign into the washing machine’s twitter account and start it following the official twitter account of North Korea. So that’s happening now.