About 2 months ago, after years of begging and pleading from my family, I reluctantly agreed to get another cat from the local shelter. We already have a menagerie of beasts that share our home, but for some reason they felt we needed another.

I admit, I do like our new addition to the family. Chester is a spunky little stray who’s always looking for fun. Even if it means knocking a few things off my desk as I write this article. The only problem is, when my wife goes in to work, she misses her new cat and always wants to know his whereabouts.

She used to ask me for updates, but after a while I realized that I needed to make something that would take me out of the loop, and let the cat communicate with my wife directly via twitter.com. I needed a Twittering cat toy. And that’s how Kitty Twitty came to fruition, after some basic soldering and crafting with just a few parts.

Project Steps

Drill and paint the enclosure.

Chester doesn’t get too aggressive with the Kitty Twitty, but if he ever does, I’ll add some weight to the enclosure to help keep it upright.

Decide where to drill the hole for the power and Ethernet cables. Attach the Ethernet shield on top of the Arduino and place them in the box to see where they fit best. Mark the location of the hole with a pencil on the outside of the box

Use a ½” spade bit to drill the hole, and go slow to minimize splintering. Once the hole is drilled, give it a quick test-fit. Does it fit? Yes? Good!

Mark the 4 holes where you want to mount the 2 LED holders, the power switch, and the hollow wall anchor. The wall anchor should be in the center.

Drill small pilot holes at each location (1/8″ should work) and then drill out the holes to fit the components.

Test-fit the components, but don’t permanently attach anything yet.

Decorate! I marked out my design in pencil and then painted it with kitty-safe nontoxic paint. Don’t forget to paint the inside; you’ll want to show your friends how it works, and having a painted inside looks so much cooler!

After the paint dries, attach the LED holders and the switch to their respective holes. A few nuts and washers, and it’s done.

Finally, attach the hollow wall anchor. Screw it in slowly to avoid damaging the wood, and don’t overtighten. The anchor will fold up on itself and its “legs” will secure it against the inside of the box, but they shouldn’t dig into the surface. Once the anchor is in place, remove the screw.

Make the sensor.

Cut the guitar string to about 10″–12″, keeping the lug end (with the little brass barrel). The lug will prevent the wire from being pulled out by an aggressive kitty. If you’re using plain steel wire, tie a knot instead.

Use small pliers to curl the cut end around, so it will attach to the toy more easily and won’t expose the cat to being poked with a sharp wire.

To electrically insulate the guitar wire from the wall anchor, cut two ½”-long pieces of 1/8″ heat-shrink tubing, then slip and shrink them one by one over the wire at the lug end.

Solder a 6″ length of insulated solid-core wire (I chose red) to the brass lug grommet, extended away from the guitar string, and encase the entire connection in another piece of heat-shrink.

Thread the guitar string through the underside of the hollow wall anchor and screw in the wad of heat-shrink. It’s OK if it’s a tight fit; my heat-shrink even twisted a bit, which made for a nice fit. But make sure the wires and lug do not make any metal-to-metal contact with the anchor.

While keeping the guitar string centered (I used a “third hand” but you could have a friend hold it steady), apply some hot glue into the core of the hollow wall anchor around the string. You don’t want to fill the entire cavity, just a bit around the bottom to further insulate the guitar string and keep it straight and secure.

If you add too much hot glue, the wire won’t be able to flex enough to touch the top of the anchor, so err on the side of caution and use only a dab or two.

Feed the Ethernet and power cables through the hole you drilled in Step 1. Tie a simple knot to keep them from being pulled out of the box. Position the Arduino boards in the box, plug in both cables, and also plug the red wire from the guitar string into its 5V header socket.

On the lid of the box, solder a 3″–4″ piece of wire to one of the anchor’s legs. Using a different color wire (purple here) will help. The anchor draws a lot of heat away, so you’ll need to heat it with the soldering iron for a while, or else the solder will bead up and you won’t get a good joint.

Now we’ll split the connection from the hollow wall anchor so that one wire goes to an Arduino ground pin (GND) through a 10kΩ resistor, and the other wire connects to its digital I/O pin 6. Doing this pulls pin 6 to ground, so that it reads LOW unless contact is made by the sensor.

Strip, twist, and solder a wire to the end of the anchor wire, along with one end of the pull-down resistor. Then solder a third wire to the other end of the resistor, and insulate the entire junction with a long piece of heat-shrink. Make sure you can identify which lead runs to the resistor and which goes directly to the anchor.

Wire the switch and LEDs

Unplug the power supply cord at both ends, and then cut and strip one of its wires about 2″ from the barrel plug end.

Solder a piece of wire to each end of the cut wire, and seal both connections with some heat-shrink tubing.

Electrical tape will work too, but I find that using heat-shrink makes for a more permanent solution.

Solder the free ends of the wires you just attached to the 2 terminals of your switch. No need to worry about the polarity; either way works.

If you’re using LED holders, remove their rubber grommets and insert an LED into each. Make sure you know which color LED is which.

If your LED is clear, you can verify its color by pressing its leads around a 3V coin-cell battery (CR2032), longer lead on the positive (+) side of the battery and shorter on the negative (–).

For each LED, solder a 220Ω resistor (or similar value) between the positive (longer) lead and a 3″–4″ length of wire. The resistor limits the amount of current that flows through the LED, so that it won’t burn out. Solder a 3″–4″ wire of a different color to each negative lead. I used yellow for positive and blue for negative, but red and black are traditional.

If your enclosure is shallow, you may need to trim the LED leads before soldering so that the lid will close. Cut them at an angle to retain the different lengths that indicate (+/–) polarity.

Insulate all connections with heat-shrink tubing (I used clear heat-shrink here) or electrical tape.

Connect everything.

Fit the LEDs into their holders. Plug their negative leads into 2 ground (GND) header pins on the Arduino. Plug the positive lead of the blue LED into digital pin 8 of the Arduino and the positive lead of the green LED into pin 9.

To wire the split lead from the wall anchor, plug the lead without the resistor into Arduino digital pin 6, and the resistor lead into ground. All done!

Make the paper toy.

Kitty-wise, the most important part of this build is the actual toy that the cat plays with. You can use almost anything, from a feather or piece of cardboard to a lightweight manufactured toy. Just make sure the materials are 100% kitty friendly. And you can enhance your kitty’s fun by adding some catnip!

Draw a bird, or whatever you think might interest your kitty, onto a piece of paper. Once you have your final design, tape 2 pieces of paper together and cut the design out of both, to make 2 mirror images. I decided to add a few white paper highlights, and you could easily add additional detail with nontoxic markers.

Add plenty of nontoxic glue to one side of a paper bird. Center the guitar wire loop in the middle, and then add the other bird cutout to the opposite side to create a paper-wire-paper birdie sandwich.

Press the birdie between books or in binder clips while the glue dries. I decided to clip it and let it sit overnight. The end result was a durable and appealing birdie for my cat to attack!

Download these papercraft bird costumes for your Kitty Twitty.

Set up the software.

Sign up for a new Twitter account, following the instructions to create a username and password. It’s simple and free!

Download and install the Arduino software.

Download and install NeoCat’s Twitter Library for Arduino (http://playground.arduino.cc/Code/TwitterLibrary, which makes it easy for the code to connect to Twitter).

Copy the Kitty Twitty source code and paste it into a new sketch.

You’ll use http://arduino-tweet.appspot.com as a proxy server to authorize your tweets using a token generated for your account. Generate your token and replace it in the following line in the code:

  • Twitter twitter("YourTokenHere");

The new Arduino IDE 1.0 or greater will automatically assign an IP address using DHCP. However if you want a static IP, configure the network information in the code, find this section of code and replace the ip, gateway, and subnet values with your own values (see the comment in line 71 of the code).

  • byte ip[ ] = { 192, 168, 2, 7 }; // a free IP address on your network
  • byte gateway[ ] = { 192, 168, 2, 1 }; // the gateway address of your network
  • byte subnet[ ] = { 255, 255, 255, 0 }; // the subnet mask of your network

To get these settings, start by looking at your computer’s network settings. On a Mac, go to System Preferences/Network, then click the Advanced button and select the TCP/IP tab. On a PC, go to Start/Control Panel/Network and Sharing Center, then click View Status and Details. For the code’s free IP address, you can usually just take your network setting and increase the last number a little bit. In my case, my computer’s address is 192.168.2.6, so I tried 192.168.2.12 and it worked fine.

Next is the gateway address. On a Mac, this is listed as Router and on a PC, it’s listed as Default Gateway. Mine is 192.168.2.1. The subnet mask is generally 255.255.255.0, but yours may be different, and it will also be listed in with your computer’s network config information.

Save the revised code, then upload it to your Arduino. With the Arduino environment already configured to recognize your port and board, this usually means just plugging it into your computer and clicking the Upload button. But if you’re not sure how to do this, the Arduino website has great tutorials, and the Resources section on the next page lists other ways to get started.

If you have trouble with any of the software setup, try posting in the MAKE forums. They’re filled with friendly and helpful people.

Conclusion

Operation

This is really easy. Simply plug in the power supply and Ethernet cable, and flip the switch. The green power LED should come on, and in a few seconds, the blue network status LED, too. The code tweets an “Up and Running” message to let you know everything is OK. You can plug a USB cable into the Arduino and listen in on the serial port for some debugging.

Every time the wire makes a connection, you’ll see a new tweet! That’s it!

Variations

You can modify this project to make almost anything send a tweet. It’s a cat toy, but there’s no reason it can’t be converted into a Twittering dog toy, or even a Twittering bird perch. Just substitute a different kind of switch sensor for the bird-on-a-wire. Make a Twittering burglar alarm? Easy! Doggie door? Sure! Twittering fish? Now that’s a challenge!

Also, you can add additional switches or sensors, connect them to as-yet-unused pins on the Arduino, and write some code to handle them. Think about adding a servo to make some random rumbles, or a speaker to simulate a bird. That should keep your cat’s interest!

This project is still evolving, and I need to add more parts and experiment with them before I settle on the final Twittering toy. By the time you read this, I hope to have modifications that check whether your cat is sleeping or needs food, via pressure-sensitive piezos under its bed and food bowl. I also plan to add a speaker or small motor to get the cat’s attention. See https://makezine.com/22/kittytwitty to learn more about these modifications.

Resources

KittyTwitty project code, links, and other resources: https://makezine.com/22/kittytwitty

Arduino tutorials: http://arduino.cc/en/Guide/HomePage

Getting Started with Arduino by Massimo Banzi: Maker Shed item #9781449309879-P

Making Things Talk by Tom Igoe: Maker Shed item #9781449392437-P

This project first appeared in MAKE Volume 22, page 80.