Introduction: Acorn Chime
By: Charlie DeTar, Christina Xu, Boris Kizelshteyn, Hannah Perner-Wilson
A digital wind chime with hanging acorns. Sound is produced by a remote speaker, and data about chime strikes is uploaded to Pachube.
Step 1: Brainstorming for a Device That Would Represent Ourselves
Our goal was to come up with a project which represented our personalities, and used an Arduino. We decided to use a LilyPad -- but hadn't settled on anything else. A week went by, and we shot ideas back and forth over email. We wanted to have it make sound, wanted to have it have something to do with nature, wanted to keep it simple enough that we could actually implement it in the available time.
The idea of doing a wind chime thing came up -- the actuation is simple (just switches, no fancy temperature or humidity sensors to configure), so it seemed feasible. It provides nature, sound, and a nice form-factor in the LilyPad for that! But how should it work? Should it record the wind and play it back later with a button press? Should it transmit the wind knocks remotely to another place? Real time or shifted? Real location or shifted?
We got together, and Charlie brought some acorns; their natural beauty sealed the form factor of hanging acorns under the LilyPad. We decided to make the sound actuation real-time, but slightly remote (a speaker separate from the chimes), and to include a wireless module to upload the data to http://pachube.com.
Step 2: Materials and Tools
- 1.5 mm thick neoprene with fabric laminated to both sides for battery pouch
- Conductive thread
- Non-conductive thread
- Stretch conductive fabric (relatively small amount)
- Fusible interfacing "iron-on" to fuse conductive fabric to neoprene for battery pouch
- Non-conductive fabric (for the speaker cushion)
- Acorns (we used 6, but it's flexible)
- Small plastic beads (to insulate thread)
- Fabric glue (to insulate and protect conductive thread knots)
- String to suspend everything from
- A Lilypad Arduino
- Bluesmirf Bluetooth module for Arduino
- A USB to serial connector for testing and loading your code onto the Arduino.
- Batteries (we used 3 AA)
- A speaker (headphones could work too)
- USB Bluetooth Adapter (optional)
- USB Extender Cable
- The Arduino programming environment.
- The Processing development environment
- Sewing needle
- Pliers (for pulling needle)
- Thimble (for pushing needle)
- Sharp scissors (for cutting fabric and thread)
- Soldering iron
- Multimeter (for finding shorts)
Step 3: Threading the Acorns
For our chime, we used 5 plain acorns. Decide about how long you want your windchime threads to be and cut 5 pieces of conductive thread about 2-3 inches longer--precision doesn't really matter here, and it's good to give yourself some room to tie knots with.
Thread your needle* with one of the pieces of thread and poke it into the acorn. Using your thimble, firmly push the needle until it is all the way into the acorn. Unless you are using giant mutant acorns, most of the needle should now be sticking out of the other side. Pull the needle all the way through using a pair of pliers. Then, pull the thread through until there is about an inch hanging off of the bottom of the acorn and move on to the next acorn.
When all five acorns have been threaded, line them up to make sure that the arrangement of the acorns looks nice to you. If you are satisfied, tie a knot at the bottom of each acorn (big enough that the thread can't slip through the acorn even through vigorous shaking) and place some fabric glue on the knot to seal the deal.
Now, tie each one onto the LilyPad. You may find the needle helpful in this case. Spacing out evenly and avoiding + and -, loop the non-acorn-end of each thread into a port of the Arduino and secure it with a knot and fabric glue. At this point, BE CAREFUL not to get everything tangled up! Ours was such an issue that we ended up wrapping some normal wire around our thread to try to prevent tangling.
- Threading can be difficult, as conductive thread frays easily and wetting doesn't help too much--use scissors to cut off any irreparably frayed ends and start over.
Step 4: Making and Attaching the Knocker
Since we want to detect when the knocker hits a thread, the knocker should be something conductive. Any metal bead should do, but we decided to just wrap an acorn in conductive fabric. To simultaneously secure the fabric and to tie it to the Arduino, we got a long piece of conductive thread and used it to sew around the top of the acorn, creating a ruffle at the top.
The rest of the thread can now be used to suspend the knocker from the center of the LilyPad. To accomplish this, we created a criss-crossed X shape with thread on the bottom side of the Arduino (looping through holes -, a1, 1, and 9) , then tied the knocker's string on to the intersection. By looping it through the - hole, we guaranteed that this knocker was going to be connected to ground--make sure, however, that no part of the cross touches any of the acorns' ports, or it'll create a short that will register as a note constantly being "on"!
Step 5: Sewing the Battery Pouch
It is nice to be bale to integrate the power supply of any device within the design of the whole. So we thought to include the three AA batteries necessary to power the LilyPad Arduino (and later on the Bluetooth module as well) in the hanging of the chime. Making a pouch for the batteries so that they could be stacked in succession and become part of the suspension. This construction proved slightly faulty since the pulling forces on the battery pouch ended up pulling the conductive contacts at either end away from making contact with the ends of the batteries. We were able to solve this by stuffing enough conductive fabric into either end. Which worked fine for the time being, but in future this should be revised.
So that we don't have to sew the conductive fabric to the neoprene we can simple work with fusible interfacing. a think web of heat adhesive intended for textiles. simply iron it on to the conductive fabric first, be sure to use the sheet of wax paper between the iron and the interfacing. and be careful that the iron is not too hot or it will burn the conductive fabric. test on a small piece first. slight discoloration is okay.
Download the following stencil and print it out to scale:
>> http://www.plusea.at/downloads/TripleAABatteryPouch_long.pdf (coming soon...)
Cut out the stencil and trace to the neoprene and conductive fabric. You might have to adjust the measurements slightly if you use thicker neoprene. Other fabrics, stretchy or not, are not suitable for this purpose as they are unable to make such a great fit for the batteries. After tracing cut out all the pieces.
Remove the wax paper backing from the conductive fabric and lay out the pieces on top of the neoprene where they belong (see stencil). You can use the wax paper between the iron and the conductive fabric for extra protection. iron over the patches so that they are strongly fused to the neoprene.
Thread a needle with regular thread and begin stitching the neoprene together. first along the length and then both ends. you can insert the batteries while sewing to make it easier. And you can cut the hole at the very end to remove the batteries. make sure the hole is not too big. neoprene is very resilient and can take a lot of stretching.
Thread a needle with conductive thread. plunge into the neoprene at either end of the battery pouch and make contact with the conductive fabric within. use a multimeter to make sure you got the connections. and stitch multiple times to make sure the connection is good. you can define - and + by simply switching the direction of all the batteries. one of the ends will leave directly from its end of the battery pouch, the other will have to be brought down to the same end by stitching along down the neoprene. be extra careful that the thread never goes all the way through the neoprene, where it could make contact with one of the batteries or possibly the conductive fabric form the other end. use a multimeter to test as you sew.
Connect and isolate
When you have both ends + and - at the same end of the pouch. you'll want to get them to the LilyPad Arduino. isolate the threads with glass or plastic beads and sew around the lilypad connections and glue before cutting.
Now the power supply should be working. What is missing is a way to suspend the pouch, LilyPad and its acorns from. For this, take some non conductive string and sew into opposite end of the pouch than the LilyPad. Create a loop or two loose ends that can be tied around the branch.
Step 6: Programming the Chime Sounds
Sound! I love sound! Sound from speakers is a lot of fun. But how does a microcontroller make sound?
Speakers make sound when there is a voltage difference across their terminals, which drives the speaker cone either farther away from or closer to the coil in the back, depending on whether the difference in voltage is positive or negative. When the cone moves, air moves. Sound that we recognize is just air moving at very particular frequencies -- speakers pushing and pulling air, which then runs into our ears.
Microcontrollers, as sound makers, are pretty tricky. This is because without a digital to analog converter, they are only capable of making two voltages: high (typically 3-5 volts) or low (0 volts). So if you want to drive a speaker with a microcontroller, your options are limited to two basic techniques: Pulse-width modulation and square waves. Pulse-width modulation (PWM) is a fancy trick where you approximate an analog signal (one that has voltages in the range between low and high) with a digital signal (one that is ONLY low or high). While PWM can make arbitrary, lovely, full spectrum sound, it requires fast clocks, careful coding, and fancy filtering and amplification to drive a speaker well.
Square waves, on the other hand, are simple, and if you're content with their raspy tone, can be an easy way to do simple melodies. Leah Buechley provides a nice example project project page, source code) for using a LilyPad to make square waves capable of driving a small speaker.
But we wanted our chimes to sound a little more like chimes -- to have a dynamic decay, and to seem to be louder at first than at the end. We also wanted the sound to be a little less harsh and a little more bell-like. What to do?
To do this we take advantage of a simple technique to add complexity to the square wave, and a trick with the speaker. First, we made it so the square waves don't stay "high" for the same length -- they change over time, even though their onset is always the same. That is, a 440Hz square wave will still switch from "low" to "high" 440 times a second, but we'll leave it at "high" for varying amounts of time. Since a speaker isn't an ideal digital device, and it takes time for the cone to push out and in, giving more of a "sawtooth" shape than a square wave. Also, since we're only drive the speaker on one side (we're only giving it a positive voltage, never a negative voltage), it only returns to neutral because of the flexibility of the cone. This results in a smoother, and more dynamic, non-linearly distorted sound.
We regarded each hanging acorn as a "switch", so when the grounded center-hanging acorn touches them, it pulls them low. The code simply loops through the inputs for each hanging acorn, and if it finds one to be low, plays a tone for it.
Working LilyPad Arduino source code attached below.
Step 7: Including Wireless Connection
We wanted the windchime to be connected to the world by having it send the notes it played to the Internet, where it could be converted into a feed and consumed by anyone anywhere in the world and played back. In order to accomplish this we connected a Bluetooth adapter to the Arduino lillypad which sent the frequency being played by the chime to a computer with which it was paired. The computer then ran a processing program that sent the note on to pachube.com, sort of the twitter for devices, where the feed was publicly available for global consumption.
To accomplish this, I have broken to tutorial down into a number of parts:
NOTE: the following steps assume you have already flashed the arduino with our script.
1. Setting up Bluetooth on the Arduino and pairing it with a computer.
This step can be the most frustrating, but hopefully with a little patience and this tut, you will have your Arduino paired with your computer in no time.
Begin by connecting the Bluetooth module to the Arduino via some wires. For this step you will want to have a power supply ready to power the arduino, you can use the battery pack we describe in this tut or hack it with a 9v battery, which is easy to use with clippers. For programming the Arduino, you will not need to use the data wires to the Arduino, as your computer will only be speaking with the Bluetooth module at this time. For now, just connect the power and ground wires like so:
Arduino GND, pin 1 to BT GND Pin 3
Arduino 3.3V, pin 3 to BT VCC Pin 2
Once you have connected the wires, you can attach the Arduino to its power source and with any luck, you will see the Bluetooth adapter start to flash red. This means that it is receiving power and you are on your way.
The next step is to pair the device with your computer. To do this follow your OS/Bluetooth adapter protocol for discovering and pairing a device. You will want to pair with a passcode and give it passcode 1234 if you are using a brand new BlueSmirf device. Otherwise if it has been used get the passcode from the previous user or check the manual for the default if you are using a different brand.
If all goes well you should receive acknowledgment of a successful pairing.
Now, in order for the Arduino and your computer to exchange information they must both be running at the same baud rate. For the Lillypad, this is 9600 baud. Here is the bit of black ar: you will need to log onto the bluetooth device with a serial terminal and modify its baud rate to match that of the Lillypad. To do this I recommend using downloading and installing ZTERM (http://homepage.mac.com/dalverson/zterm/) on the mac or termite on windows (http://www.compuphase.com/software_termite.htm). For the sake of this tutorial we will be discussing mac only, but the windows side is very similar so if you are familiar with that environment you should be able to figure it out.
Once you have your serial terminal installed, you are ready to try to connect to the Bluetooth device.
Now, in order to get Zterm to connect to your device you will need to force your mac to establish a connection, you can do this by selecting your device from the bluetooth menu and then in the properties screen, choosing "Edit Serial Ports". HEre your protocol should be set to RS-232 (serial) and your service should be SSP. If all goes well, your device will show connected on yoru computer and bluetooth will acknowledge a coupling. Now you want to quickly launch zterm and connect to the serial port where the bluesmirf is connected. Once the terminal comes up, type:
This sets the device into command mode and gets it ready to be programmed. You must do this within 1 minute of coupling with the device or it will not work. If you don't get an OK message after this command and instead get a ?, then you ran out of time.
If you do get into command mode, make sure you have a good connection by typing:
This will display the settings on the device. You may also want to type:
This will remove the time limit for configuring the device.
Now, you want to type:
This will set the baud rate to 9600.
To make sure your setting took and now you are ready to rock.
To test you new data connection. Quit Zterm, detach the power from the Arduino, connect the data wires to the Bluetooth like so you have the following connections:
Arduino GND, pin 1 to BT GND Pin 3
Arduino 3.3V, pin 3 to BT VCC Pin 2
Arduino TX, pin 4 to BT TX pin 4
Arduino RX, pin 5 to BT RX pin 5
Re-attach power. If you have the whole chime built that would be great, otherwise just make sure it is flashed with the software and then simply trip the sensors with a wire. Launch Arduino, make sure that the device and baud rate under the toools menu matches you equipment and then click the serial monitor button. With any luck, you should see your notes echoed in the terminal when you trigger the sensors. Congrats!
If you don't see this, don't give up, follow these steps carefully again and see what you missed. One note is, sometimes Arduino complains the serial port is busy when its not. 1st make sure it is not busy with another application and then cycle Arduino (the software) to make sure the problem isn't there.
Here is an excellent reference to the BlueSmirf device and its codes:
2. Sending data to Pachube
Now that you have your Bluetooth Module working correctly, you are ready to send data to Pachube. The attached code will is fully functional and will show you how, but let's look at the steps here.
Before we begin, you will need to download processing (http://processing.org/) and create Pachube (http://pachube.com) account. Since they are still in closed beta you may have to wait a day before you get your login.
Once you have your login, create a feed in pachube, here is ours for example:
Now, we are almost ready to send data to pachube, we just need a special code library for processing which will structure your data in the way pachube likes. This library is called EEML (http://www.eeml.org/), which stands for Extended Environments Mark Up Language (pretty cool. huh?).
Once you have all this installed, you are ready to send data! Add your feed identity info here:
>>dOut = new DataOut(this, "[FEEDURL]", "[YOURAPIKEY]");
and your feed specific info here:
The 0 indictes which feed it is, in our case this is the only feed coming from this device, so it will be 0. "Frequency" represents the name of the value we are sending and will be added to the taxonomy of pachube (it will be classes with all other feeds with the keyword frequency), it also represents what the units we are sending are.
There is an additional call:
>>//dOut.setUnits(0, "Hertz", "Hz", "SI");
Which specifies the units, but at the time of this writing it was not working in Pachube so we commented it out. But try it. It'll be useful once it starts working.
Now you are pretty much all set, but it may be worth mentioning specifically a few other lines of the code:
This code prints out all available serial ports
>>myPort = new Serial(this, Serial.list(), 9600);
and this code specifies which one to use in the application. Make sure you specify the right one and the correct baud rate for your device or the code won't work. You can try running it and if you have a priblem look at the output of serial ports and make sure you have the right one specified above.
Once you have these specified, just run the code and you'll see your feed come to life.
I added this delay after sending the data off to pachube because they impose a limit of only 50 requests to a feed (up and down) per 3 minutes. Since for this demo I was reading and writing the feeds at basically the same time, I added a delay to make sure I didn't trip their circuit breaker. This makes for a much delayed feed, but as their service evolves, they will raise these sorts of naive limits.
The Pachube cammunity website has a nice Arduino Tut as well, I recommend reading it if you still need more info:
3. Consuming data from Pachube (bonus)
You can consume the Pachube datafeed via processing and pretty much have it do whatever you want. Another-words, you can treat the frequencies as notes (they map to a scale) and play them back or just use them as random number generators and do other stuff like visuals or play unrelated samples. The attached code sample plays a sinewave based on the frequency it pulls from pachube and makes a colored cube spin around. To get the pachube data, we simply request it in this line:
dIn = new DataIn(this, "[PACHUBEURL]", "[APIKEY]", 8000);
similar to how we sent the data in step 2.
Perhaps the most interesting part of this code is the inclusion of a simple yet powerful music library for Processing called Minim (http://code.compartmental.net/tools/minim/), which allows you to easily work with samples, generate frequencies or work with sound input. It has many great examples also.
Remember that if you would like to both send a feed and consume one, you will need 2 computers (I guess you could this virtually on one machine). One paired with the bluetooth device, sending data out and another pulling the feed from pachube.
if you would like to really field test this you will need to attach a dongle to your computer via a long USB cable and make sure that you have line of site with your chime. Internal bluetooth antennae don't have much range, but you could get 100' or more with a quality dongle that can be directionally positioned.
Step 8: Making a Speaker Pillow
We wanted our chime to output through a speaker, which would be attached to the trunk of the tree (away from the branches!) to invite people to lean in and listen. To make the pillow a little special, we took advantage of the computer controlled sewing machine capable of embroidery.
We drew a quick little design of a speaker in the sewing machine's vector illustrator software, and 2 needles and a lot of thread later, had a nice emblem. This was sewn into a small pillow shape, with the speaker inside, behind the stuffing. The stuffing helped to muffle some of the harshness out of the sound, and to make it quieter.
We ended up having to resew the side several times, as we needed to pull the speaker out for debugging!
If you don't have access to a computer controlled sewing machine, there are lots of other fun ways to make patterns, such as simply cutting out a piece of cloth and sewing it on.
Step 9: Putting It All Together
Sew the speaker's leads into the neoprene for the battery case. Be careful to avoid shorts -- it is easy to accidentally let ground, positive voltage from the battery, or the speaker wires cross paths. One solution we didn't try but thought of was to wrap the battery case in an additional piece of cloth that could be sewn without danger of shorts. We had to resew several times after accidentally creating shorts -- a digital multimeter is indispensable for debugging this.
To further insulate things, we threaded beads onto the connections near the board. This is an easy and attractive way to insulate conductive thread.
The neoprene battery holder might stretch a bit and leave the batteries unconnected. If this happens, just stuff some more conductive fabric into the bottom to wedge the batteries up.
Step 10: Installing It in a Tree
Now's the fun part: pick a tree, and hang it! Oak trees are especially nice, because the acorns will have on-branch neighbors. Pick a spot that will get adequate wind, so that it will shake. At first, we tried climbing high up into the middle of a large deciduous tree, but this wasn't as effective as a thin small branch on the outside.
The longer the speaker wire, the farther the chimes can be from the speaker (duh). Be sure to get speaker wire long enough -- but remember, you can always splice in more wire if you need to.
We sewed straps to the speaker so we could tie it around the tree. You could do the same, or attach with rope or string.