February 2012

Musical Book for Halloween 2011

My daughter wanted to dress as Hermione Granger for the Halloween party at her school. We thought we'd jazz it up a bit with a special book she could hold -- one which might play the Harry Potter theme song from within if it's held in a certain way. Well, we could have really gone overboard and embedded an LCD or OLED in the pages themselves but the music would have to suffice this time ;-). I've made hollowed out books before but that can be a bit messy and time consuming so I thought I'd look for some (inexpensive if possible) ready made ones.  I ran across an excellent two book set (with one large and one small) on Amazon.  The small book was the perfect size to hold the mechanism and small and light enough for her to hold.  The book has kind of ancient mysterious look to it.The internal mechanism was straight-forward.  I'd worked with the Wave Shield from Adafruit before so I paired that with an Arduino as the music playing device.  You can see the Arduino with the Wave Shield at the top of the photo.  I then attached a tilt sensor to the Arduino (actually to the top of the Wave Shield) so that I could sense when the book was tilted.  I converted a MIDI version of the Harry Potter theme that I'd purchased for our piano to Wave format and wrote it to the SD card for the Wave Shield.  A small battery pack with included switch provided the power.In a few of my projects, I've been using the internal speakers removed from old Sun Microsystems external speaker units (shown below).  This is also the type of speaker I'd used earlier on the MARV project.  They're very sturdy, a bit heavy, but give a nice rich sound in a limited space.  Since I didn't want to make any permanent changes to the book itself, I cut a piece of 1/4" plywood to fit inside the book and then used an L-shaped bracket (the kind Ikea gives you with bookcases to tie them to the wall) with a wing nut to tighten it.  That way, the bracket can slide closed and be tightened to hold the wood firmly in the book.  Then I attached the Arduino stack with screws and spacers to the wood and used wood glue to fasten the metal back of the speaker to the wood.  The battery pack can use some velcro to keep it from rattling around.

Here's a video of the finished book:
I quickly put together the Arduino sketch for the project the night before. It's based on one of the example playback sketches. One has to build in an appropriate delay in recognizing that the book has shifted in orientation (so brief shifts won't change the play state of the music). If the book was tilted toward its spine and kept for a short duration the music would begin to play. If moved to a different configuration for a short duration (for instance, flat) it would pause. The sketch could be improved to play different tracks based on orientation shifts, time, etc... (or even opening the book since I thought about installing a photo sensor). I also thought about using a piezo so you could tap out various inputs on the cover (as with knock sensor projects like the Secret Knock Gumball machine or door unlocking devices). I'll try to post the code soon, post a comment if you're interested in me posting more precise plans.