Categories
Idle Tech

Tweeting washer and dryer for Arduino with Ethernet

My tweeting washer and dryer have been running great for a bit now and I’ve done some code cleanup to make it less embarrassing to share. The code attached to the post  is designed to use an Arduino Ethernet shield, not the WiFly module from the original example. If you already changed your tweeting dryer to use an Ethernet shield you can probably just download this code and upload it with little-to-no modification.

Download the Arduino code, circuit diagram and PHP files from my Git repo: WasherDryerMessenger

I’ve added a number of things to my code which weren’t in the original. I have, however, put them behind configs so I believe you should be able to use the code without hardware changes.

Here are two relevant configs at the top of the code:

  1. #define WASHER 0: In the sample code I have tweeting for the washing machine turned off. If you add another current sensor to your hardware you can turn this on to get tweets from your washer too.
  2. #define WEBMSG 0: This setting enables pulling the pithy tweets from a database on the web. Before enabling this there is some setup required, see: Getting a random string from MySQL for Arduino

If you want to have a tweeting washer as well as dryer, the hardware change you’ll need to make is to duplicate the current sensing circuit already in place for the dryer and add a third LED. In the diagram below left I have recreated the original circuit from Thomas’s Dryer Messenger in breadboard format (click for full size). On the right I show the added washer circuit (note: Ethernet shield not shown for simplicity).

Breadboard circuit diagram  Circuit diagram for washer and dryer

When you finish the modified circuit you can test it by plugging the dryer into the new transformer jack and updating the dryer pin setting in the code. Only after you’ve tested the hardware should you plug in both appliances and turn on the washer tweeting using the WASHER define (see the configuration notes earlier in this post). If you want the same account to tweet both washer and dryer status you can duplicate your dryer OAuth token for the washer on line 103. I elected to have separate handles for my washer and dryer and obtained a second OAuth token from Arduino-tweet.appspot.com.

At this point you should have a tweeting washer and dryer but you’ll notice the tweets are the same every time and rather boring. To add variety back to your tweets you should follow my instructions for enabling the WEBMSG for getting random tweets from a database on the web: Getting a random string from MySQL for Arduino.

Have you added a washer to your setup? Share your washer’s twitter handle in the comments below.