masthead

TwitShit

My first project for Physical Computing was to find a creative way to turn an LED on and off using Arduino. A while ago, I said that the only way I’ll use Twitter (which I think is beyond pointless) was if I could hook it up to our cat’s litterbox and have it “Tweet” every time the cat takes a poop. An LED would light up to signal “the litterbox is occupied” or start flashing to signal “warning: it may smell awful.” And that’s exactly what I did!

I had first planned to install an ultrasonic sound emitter inside the litterbox to detect if there was something inside. When I went to Jason to look through his box-o-sensors, however, I found the flex sensor which was not only much easier to use than the ultrasonic emitter, but it would be much easier to code for as well. The flex sensor outputs a number which tells me if it is bending one way or another.

p3170089

Once I had wired up the board, I took to writing the code. The Arduino code checks three times a second to get the value of the sensor. If it is bending into the litterbox, it signals the LED to turn on. If it is bending out of the litterbox, it tells the LED to flash for a few minutes. The Processing code is responsible for posting the Twitter updates, which works like this: the Arduino board is able to broadcast information via the USB port back up to the computer, which Processing listens for — this is called a serial event. Depending on what the event parameters are, I can tell which direction the sensor is flexed in and post the appropriate tweet using a nifty library called JTwitter. Here’s a screenshot of the programs running on my laptop (technically, Arduino doesn’t have to be open for it to work, but it looks cool with them both there):

screenshot1

And here is a picture of the installed “device:”

p3170090

If you’re interested, you can follow our beloved cat Reptar on Twitter here.

5 Comments so far
Leave a comment

what’s Reptar’s account?? This is hilarious btw!!

at the bottom of the post

Well, dang.

You will have to show me how you manage the voltage on the LED sometimes.

the arduino board is pretty nifty, it has a 3 volt and 5 volt output built right in. the pin that the LED is sticking out of has the resistor built in as well, so that takes all the hard work out of it. otherwise i think it’s 220 ohm resistor at 5volts for most LEDs.

Not sure who Reppy takes after but he’s sure getting his money’s worth out of that litter! Something ironic about a cat having so many ‘tweets’.



Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required)