This is Plum. She plays "Old MacDonald Has a Farm" when the button in her right ear is pushed.
She is a project I made for a class - Youth and Technology in Libraries. It features a stuffed animal with a push-button switch sewn into its ear and all other pieces (the board & buzzer) located under the stuffed animal's jacket. This could be modified to make all of the pieces internal, I just wanted the board easily accessible for charging, etc.
The code included is based on two examples: toneMelody (provided in the downloadable Arduino program and including the note table made by Brett Hagman) and the switch code provided on the LilyPad site: http://lilypadarduino.org/?page_id=635.
The stuffed animal I used was one I made from a pattern in Knitted Toy Tales by Laura Long: http://www.amazon.com/Knitted-Toy-Tales-Laura-Long/dp/0715331728 . Because of this, the jacket made, while simple, will need to be "tailored" to whatever stuffed animal is used.
Step 1: Materials
Ready-made stuffed animal or the materials to make your own
Material for final jacket (I used felt because it is forgivable and eliminates having to hem)
Muslin or scrap material (for mock-up of jacket)
Snaps (one set)
Chalk pencil or fabric pen
LilyPad Arduino (specifically the board, buzzer, and button switch)
Mini USB cable
Decorative fabric/felt in various colors
Step 2: Coding
The code I made is an amalgamation of the codes mentioned above, with a few of my own tweaks. The music included plays "Old MacDonald Had a Farm" since my stuffed animal is a pig... but pretty much any music would work - just substitute the notes of your song into the int melody field, change the individual note durations (my first note, NOTE_G4 correlates to the first 4, meaning I want that G played as a quarter note), and change the 54 under void loop to however many notes your song has in it.
Input the OldMacDonald code first.
THEN create a new tab to put Brett Hagman's note table in. Call it "pitches.h" (without quotation marks).
Load this onto your LilyPad Arduino.
Step 3: Plan Circuit
Since every stuffed animal is going to be slightly different, the circuit may need to be adjusted to fit the toy's dimensions. My final circuit looks a bit different because I was trying to hide the stitches made with conductive thread under part of my decorative design on the other side.
Basically, the board's negative pin is attached to to the buzzer and switch's negative pins. The button switch's other pin is attached to A5 on the main board and the positive on the buzzer is attached to 6 on the main board.
Half of one of my pig's ears is actually sewn to the jacket. Plan to have half of the part of your toy you want the button in attached to your final jacket... you are either going to have to remove it from your ready-made toy and reassemble later or hold off on attaching it when you are making your toy.
Step 4: Make Jacket
Once you have your stuffed animal ready, you are ready to make it's jacket.
I made a mock-up of the jacket using scrap muslin. Draping it over your animal and experimenting with armhole positions helps to create a pattern you can use for your felt/final fabric. I used pins to mold the fabric to the shape I wanted. Make sure to leave enough fabric on the front of the vest so you can attach your snaps. 1/2 of an inch on the left side (see circuit drawing) was enough for my pig, but more or less could work, depending on your stuffed animal's dimensions.
Once you like the pattern you've created, outline it onto your final fabric/felt. If you are planning on using fabric ,draw it onto the wrong side of your fabric. Also, allow extra fabric outside of the pattern (including armhole lines) for hemming if you are using fabric instead of felt.
Cut out your pattern. Hem if you are using fabric.
Optional - I sewed 1/4 of an inch all along the edges of the felt (including the armhole edges) to give those areas extra strength.
Optional - sew on decorative felt to the "right" side of your felt (the side of your pattern that will be seen). I added decorations because the LilyPad was visible through the white felt. I also wanted to hide any conductive thread stitches.
Sew the half of your animals ear/leg/whatever to the jacket so that both wrong sides are facing up, like in the circuit drawing. Make sure that when you put your toy's jacket on it lines up with the other half of their ear/leg/whatever. No Franken-pigs allowed... unless that's what you're making :)
Sew the snaps onto your jacket. On the pigs jacket, the male snap is on the wrong side of the felt (left side with extra 1/2 inch, see circuit drawing) and the female snap was on the right, on the "right" side of the felt.
Step 5: Attach Arduino Components
If you haven't already snapped your pieces, snap them.
Tack your board onto the "wrong" side of your jacket with a few stitches of regular thread using unneeded pins. The pig's ended up in the center of the jacket near the top, so that I could reach his ear easily. Yours may be somewhere else, depending on how your circuit was designed.
Place the switch button face up on the ear/leg/whatever half you attached to the jacket. After attaching conductive thread to A5 with a knot and a few loops, sew with as few stitches as possible to the not-negative pin on the switch button and attach the thread with a few loops. Secure it with a knot and cut the remaining thread.
Do the same from the board's negative pin to the switch button's negative button. Instead of knotting and cutting the remaining thread, continue sewing to the buzzer's negative pin. Loop a few times, knot, and cut.
Do the same from pin 6 to the buzzer's positive pin.
Optional: tack buzzer and/or switch button with a few stitches of regular thread through the pins.
*** the entire circuit isn't seen in the picture because it was taken after I attached the ear to Plum.
Step 6: Attach the Button!
Basically, what I did was put Plum's jacket on, snapped it an pinned the half of her ear attached to the jacket to the other half of her ear already attached to her body. I only needed one pin to keep everything in place.
Then, using either regular thread or embroidery thread, sew the two together. I used embroidery thread because Plum purposefully has a quilted, rustic toy vibe going on. Using felt here is especially helpful because you don't have to worry about raw edges.
Your toy is now fully musical! Flip the switch on the underside of the jacket and push the button in their ear to hear the musical stylings of your stuffed animal :)