Interactive Design & VR tutorial: Hack a toy for your first Arduino project

The Neighbourhood explains how simple it is to get into experiential design using this year's hottest geek tech, Arduino, in this beginner's tutorial.

Intro


The Arduino microcontroller has revolutionised what we’ve come to call experiential design – the creation of real-world projects that interact with people. The users can be either in the same physical space as the project – or can communicate with it over the internet, as Rob Millington and Stuart Dearnaley from Manchester-based creative studio The Neighbourhood demonstrate here by building a sheep that bleats when sent a tweet.

Arduino is an inexpensive circuit board that connects to a computer via USB. It passes information to the computer from any sensor you connect to it, and from the computer to a huge variety of output devices. Almost anything is possible – you just need to experiment, bringing a DIY creative mentality inspired by TV shows of our youth from Blue Peter and The Great Egg Race to Robot Wars.

This beginner’s Arduino tutorial is designed to give an insight into how you can pull data from the internet and use it to control things back in the real world. We’ll be using Twitter’s API to look for tweets with the specified account name as a mention.

This will then be used to trigger an electronic switch, called a relay, that will activate a battery-powered toy or device – which for us will bleat each tweet. We’ve also added the ability to add an LCD display to show the tweet and the sender.

Time to complete

2 days

Tools

Arduino circuit board, Ethernet Shield, breadboard, long wires, jumper wires, 10k Ohm resistor, TN4007 Diode, 5V relay, BC549C transistor, hackable device (battery-powered toy in this case)

Optional items: 2 x 10k Ohm potentiometers, BC1602A LCD display

Download

Files for this tutorial are downloadable from here

Step 1

STEP 1

After gathering up the required components and picking out a toy to use, it’s time to set up your Arduino device. For details on how to do this for your chosen platform, go to the Arduino website at arduino.cc.

We’ve used Arduino IDE v1.01 for this, so make sure you’re on the latest version – and take a note of the Mac address printed on the Ethernet Shield for use later.


Step 2

STEP 2

Next, you need to grab the code from the project files and install the TextFinder library from the Arduino site.

Locate your sketchbook folder by looking at File > Preferences in the Arduino Environment and, if one doesn’t exist already, create a new folder named ‘Libraries’. Unzip the ‘TextFinder’ download into the libraries folder and restart the Arduino Environment. You should now see it on the Sketch > Import Library list.

Advertisement. Article continues below

Step 3

STEP 3

It’s time to open the code and personalise it to your Twitter account. If you open the TweetToBleet.ino file, you’ll notice that all the code has been commented out to help you understand what’s happening.

If you look on line 22, you’ll find the variable that names the Twitter account to be referenced in the searches. Change this to your Twitter account.

You should also change the Mac address on line 18 to match that of your Ethernet Shield (though this actually just needs to be unique on your network).


Step 4

STEP 4

After changing the variables and having a look through the code, you can now go ahead and upload the code to the Arduino device (File > Upload to I/O Board).

To test it’s all working, open the serial monitor (Tools > Serial Monitor) and look to see that it’s connecting and finding your tweets.

Here’s what it’s doing:

  • First, it tries to connect to the internet.
  • If successful, it will request a Twitter search API for a new tweet.
  • It then searches for a new tweet.
  • If found, it triggers the ‘bleat’ event, and logs the tweet’s unique ID to compare to on the next search.
  • It then loops back to start the search every minute.

This concludes the digital side of this tutorial, and all the code should be in place for you to start building the circuit and hacking your toy. If you’re having trouble getting a connection, check your network is configured to use DHCP. If this isn’t the case check the Arduino forum for help.


Step 5

STEP 5

It’s now time to take apart your toy, being careful to note where things go and to keep all the bits for putting it back together later. You’re looking for the wires that connect the toy’s activation switch to the internal circuit board, as this is how we’ll connect it to our circuit.

Advertisement. Article continues below

Step 6

STEP 6

Remove the switch wires, and replace them with longer wires that will extend out through your toy’s shell, and connect to your relay. In this case, we did the same for the speaker wires in order to add a volume control; taking one wire from the speaker and the other from the circuit board.


Step 7

STEP 7

Follow the diagram to create the control circuit. A breadboard is handy for this as you can easily reuse your components for other projects. You can also solder the components directly and fit it into a project box if you’re planning to create a more permanent installation.

Here’s what it’s doing:

  • When the Arduino receives the tweet, it makes pin 8 Hi for a half a second, set on line 188 of the code as a delay.
  • This gives power to the base of the transistor.
  • The transistor then increases the current flowing through the relay.
  • The relay is switched and closes the circuit of the toy to activate it.

The diode is important as it prevents damage to the components from high voltage ‘spikes’ that appear across the coil of the relay when the current is removed from the transistor.

If everything is connected correctly, you should now have a tweetable toy hack that will search for new tweets every minute, and alert you when a new one arrives by dancing and singing. Give it a try.


Step 8

STEP 8

This is optional, but will add a nice feature to your project that allows you to see the tweets without logging into Twitter. Follow the diagram to hook up your LCD display – if you need to change the pins used, you can do this on line 27 of the code.

Advertisement. Article continues below

Step 9

STEP 9

Finally, put the toy back together and somewhere you can see it. We added a mains adapter to our Arduino, so we don’t have to keep it powered from the computer.