Hook up your child’s ball path (or anything else) to Twitter

I wanted my son to know whenever I leave work to come home. With a fairly simple Arduino setup the ball of his ball path will be set into motion as soon as one of my tweets contains a certain hashtag.

The code is based on the Pachup example that you can find in O’Reilly’s Arduino Cookbook by Michael Margolis in chapter 15.15 (Download the example code at oreilly.com). To learn more about the wiring you could start at the Analog Input to Servo-Sketch at fritzing.org.

Parts:

  • Arduino Uno (Sparkfun’s SKU: DEV-09950)
  • Arduino Ethernet Shield (Sparkfun’s SKU: DEV-09026)
  • Servo Motor
  • Network Cable
  • Power Plug for the Arduino Uno
  • A ball path

(If you need a shortcut, get the Fritzing Starter Kit.)

Step 1:
Figure out a way to release the ball of the ball path using the servo motor. In my case it was pretty simple. I could make it look nicer, but for the time being the solution presented in the picture below will do.

 

Step 2:
Add the following libraries to your Arduino IDE:

Step 3:

  • Open BallPath_Version1.pde in your Arduino IDE
  • Modify the two variables [YOUR_TWITTER_ID] and [YOUR_HASHTAG]
  • Compile it and send it to your Arduino Uno.

Step 4:
Add the Ethernet Shield on top of the Arduino Uno and wire the servo motor according to the sketch below.

  

Step 5:
Hook up your Aduino to your network and attach the power plug.
Your Arduino should be booting now. The servo motor will stay at an angle of 10° until the IP address is received. In case the DNS lookup failed, the motor will be turned to 50°. (In case you need more than this servo-based logging change the value of “loggingEnabled” to TRUE and open the serial monitor of the IDE.)

Result:
Now you’re done. The code will check every 8 minutes for a new tweet with the hashtag specified. (If you would like to increase that value please make sure to check the API documentation for the max-request value.)
As soon as the Arduino receives a search result containing your hashtag the servo motor will be turned to 180° to release the ball. You might have to change this value according to your needs.

The video below demonstrates the systems.

If you find any bugs or if you improved the code, please let me know. Any feedback is welcome.

Tags: , , , , , ,

One Response to “Hook up your child’s ball path (or anything else) to Twitter”

  1. Koi Says:

    cool, I like!

Leave a Reply


Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.0 Germany License.

Switch to our mobile site