Intro: Child's Robot Costume With Sound Effects, Candy Detector and More
Arduino source code
I've attached a wiring diagram created in Fritzing but the image may be too small. A larger version and source file can be found in the open source repository above.
Trick or treating, she was somewhat of a local celebrity and as you can see she got some bonus candy from people who wanted to try out the candy detector some more.
Full feature prototype on my desk, pre-packaging in costume:
Special thanks to Lee's Electronic in Vancouver! Awesome support and customer service.
Step 1: Concept Illustration
I sketched out a few concepts. The hardest part was coming up with a helmet design. I wanted a boxy, retro look. For a four year old, I didn't want anything heavy that her neck would have to support, so I opted out of separate piece helmets and went with one that was supported by the torso with a big "mouse hole" opening for the face. This also allowed her the best vision. A lot of cool helmet designs obscure vision a lot. I still ended up having to help her navigate stairs and walk past curbs and other tripping hazards because she couldn't see her feet.
I ended up not having time for features D and E.
Step 2: Sound Effects
The sound effects were a combination of original and sourced ones from the Web. I had a couple phrases that I recorded my daughter saying then using Audacity, I gave them a robot effect - basically a lot of reverb. ("Trick or Treat", "Thank You", "Happy Halloween"). The Wave Shield I used from Adafruit requires sounds to be 22Khz, Mono, WAV format with 8,3 DOS filenames so I used Audacity to also change any sounds I found to this specific format. I ran a Normalize filter on all the sounds to make them a consistent volume. I had to assemble the Wave shield with some soldering. Adafruit has a good step by step on how to do do the assembly.
Step 3: Candy Detector
Initial prototype of the candy detector. An always-on infrared beam is detected until the beam is broken by an object blocking the beam (candy being deposited). A box was created to hide the electronics, hold the loot and block as much ambient light as possible. I programmed the candy detector to have priority when playing sound effects. While candy was busy being deposited ("Thank You" sound was busy being played back), the big button pad and foot sensors would be ignored.
Step 4: Big Button Pad
I happened to have an old seniors' big button phone because when I was a teenager I bought it thinking it looked kind of goofy and fun. Looked like a good button pad opportunity. I envisioned bright colours. Basically, I took apart the phone, painted the buttons, sawed off the phone cradle, spray painted the face plate silver, reassembled it and wired it up.
Before I started painting the colours I got cold feed about the colour pattern so I wrote a simple web program to create random colour configurations. Every time I refreshed the page, different random colours would paint the buttons. I constrained the colours to a pool of bright colours but it was random which subset of those colours would be used and in what combination. I took screenshots of a bunch of ones that I thought looked nice and showed them to my daughter and had her decide which one she liked best. I involved her in little ways like this throughout the process.
I used a port expander IC chip to feed the 10 phone wires into only four Arduino pins (note, there were actually 11 wires but the 11th wasn't used). It was a bit of a bitch getting the wire voltage combinations mapped to button presses but it worked in the end thanks to a clever idea from my friend Bruce. It was a bit of a nail biter, I didn't get it working until after I'd spent all the time painting it!
Step 5: Antennae Lights
Took a wire coat hanger, cut two even lengths of it, bent it to a shape that would be stable once glued into the head box, ran some wires up it, encased in plastic tubing. LED bulb at the end. Drilled a hole in a ping pong ball, fit that over the LED, soldered and glued it together. I was happy with the result, they diffused the light well giving a good pulsing orb look that showed up well enough in a lit doorway and even better between houses in the dark.
I noticed we had some two-coloured yogurt cups in our recycling and thought they might make nice ear bulbs. Tested them out with a flashlight in the dark and thought they looked good and they ended up being pretty nice. I cut out a square of cardboard, punched a hole in the middle and fed an LED through. Then, I hot glued that to the opening of the yogurt cup. Ear bulbs, check!
Note that with all the other pins in use, especially by the Wave shield, I only had one pin left with PWM to fade the antannae lights in and out but I had two lights. I hooked them up in parallel off the same pin being careful to stay within the limits of the LEDs and Arduino pin (using Ohm's Law calculations, factoring in the LEDs' forward voltage, 3.2V in my case and the 40mA max current for the pin).
Testing lights on my desk in the dark:
Step 6: Head Box
Cut out a space for the neck, face and ears. Later, drilled holes behind the ears for feeding the coat hanger stabilizing bends and wires through. Yogurt cups pressed through snug ear holes and hot glued glued to stay put. I ended up redoing the head part after finding it didn't fit my daughter's head. I made it quite a bit taller in the end so that there was more room for the wires above her head inside and I ended up using this extra space for the speaker and its amplifier too. The one shown here is the original but the steps to make the tall one are the same.
Step 7: Body Box
Created the torso part. Kids heads are a lot bigger than their necks so I ended up making these flaps for putting the costume on. They get folded down once the costume is donned. I custom made the candy detector box with a bit of cutting and hot glue. I left room for the big button pad to go beside it. I left the bottom facet of the candy reservoir a hinged flap and added a velcro strap so that every once in a while I could unload the candy into my backpack during the outing. Note that for the arms I started off with this aluminum duct tubing. My daughter couldn't move her arms at all so I replaced it with some light plastic flexible stuff later. Body was then spray painted first with a white/cream primer then silver. Lastly, I bought some of those little semi-circle stick-on cupboard bumpers that you're kitchen cupboards might have on them to dampen the sound when closing them. I used these to simulate rivets/bolts. They were a nice touch and my daughter had fun helping me put them on. In fact, she loved to tell people, "these are real bolts!".
One lesson I learned is that it's very hard to find the right size boxes. I recommend just finding bigger than what you need, and more boxes than you need and practice creating your own custom sizes out of them with a box cutter and hot glue, it's surprisingly easy to do that.
Note, that my daughters ams were fairly snug in the box, so to get her arms bent to put them into the arm holes, I hinged one of the arm holes like a door. That let her shift her body a bit to the side with one arm out of that flap, then she could get the other arm into the sleeve with the door open, then with both arms in, I could close the one side's sleeve door. Door kept shut with a little strip of velcro. I found the sticky backing of the velcro wasn't adequate so I hot glued it on.
Step 8: Packaging Components, Putting It All Together
I was concerned about rain so I packaged the battery holder (4 C batteries) in tupperware. I used an adjustable buck converter to regulate the voltage from the batteries from 6V down to 5V (4.95V is what I set it to to be safe). The Arduino needs 5V and I fed the 5V wire directly into the 5V pin, bypassing the Arduino's regulator. This meant less batteries and more efficient battery use since the onboard regulator needs at least 7V if you go through Vin on the Arduino (or the barrel jack). I got the buck converter off eBay.
I cut out some foam from an old camping mat to hold the Arduino microcontroller in place without having to glue it in there permanently so that A, it could be reused for another project in the future, and B, so that I could pry it out a bit to access the USB socket for programming it with my laptop. For the foam, I ended up adding a rectangular base layer then another layer on top with the cutout whose frame was glued to the base at the outermost edges only creating a bit of an overhanging edge under which I could wedge the base of the Arduino PCB. I used a small screwdriver to lift the foam up over the edges when I was tucking it in to bed. I made sure the power was off when I did this so as not to damage the microcontroller. Another reason for the base layer was to separate the circuitry from any moisture that might potentially find its way into the container and accumulate. I put a square of foam under the regulator too to elevate it and the switch was glued to the side wall with some cardboard in-between.
The heaviest part of the enclosure were the batteries so I put those at the bottom and I drilled a couple holes at the opposite end to feed a zip tie through which provided the back-up mechanical strength to ensure it wouldn't fall off the costume if the glue failed. I kept it loose then hot glued the base of the enclosure to the costume. I only applied the glue once I was confident of the placing and number of holes I needed. Then once fastened, I tightened the zip tie and clipped off its excess.
Some wires required resistors to either limit current to the LED bulbs or as "pull ups" for digital input. I decided to try and keep any resistors and branching of wires (i.e. power to 5V via resistors and also to an Arduino digital pin) a decent length away from the Arduino tupperware container because I wanted to minimize how much was in that box where possible so that it would all fit. To prevent shorts and to make it more durable I used some heat shrink sheathing and used my fancy new blowtorch to shrink it on - nice and tidy! FYI, if you don't have a heat shrinker you can use electrical tape but I don't like how that is time consuming and sometimes gummy at the edges, possibly coming unwrapped as the wearer is entering/exiting the costume. If you want to buy a heat shrinker, you can get a blowtorch or electric hair dryer style. I've even heard that an actual hair dryer will work. The benefit of an electric one is that it's not going to run out of butane. The blowtorch one only takes seconds to shrink sheathing vs a bit longer with a hair dryer style.
Conscious of how rain might drip down a wire and into the enclosure, I decided to fed the wires through the back of the costume, under the tupperware. Not having any caulking on hand I used a thick bead of hot glue at the top edge and sides of the enclosure to prevent water from dripping behind the enclosure and into the holes I drilled. Luckily, it ended up not raining but I was happy to have been prepared. Since I needed to hold my daughters hand because she couldn't see her feet, I'm glad I didn't also need to handle an umbrella to protect the costume.
When putting the wires into the costume, to reduce the spaghetti, I used bits of twist ties to bundle groupings of wires together. I then used dabs of hot glue to arrange the wires along the walls. After that I removed some of the twist ties that were no longer helping.
Step 9: Boots
For me this was a bonus feature that I was going to add if I had enough time. I was pushing my luck with time but I did end up adding this feature in. The pressure sensors at the base of the boots triggered robot walking sound effects while my daughter was walking. Since these left/right foot sounds played very often, I reduced their volume compared with the other sounds so that they didn't get irritating. I had my daughter wear the boots with the sensors superficially taped into the boots and tethered to my computer so that I could get real world analog values back (The foot down/up values would differ based on the weight of the wearer and their foot shape). Armed with good data I was able to program in a good threshold for which values would be considered boot up vs boot down.
You can see my daughter holding her ears; I didn't have speakers yet so I used earphones and she was listening to her feet as I tested. This helped hold her attention. The hardest part was keeping her in one spot so she didn't rip everything apart. Try telling a four year old to walk but not go anywhere and don't turn around! :)
I ended up having the longest part of the wires dangle down from the costume. I used a set of male/female barrel jack connectors to connect the boots after the costume and boots were put on. We had some segments of dryer vent hose to go over the legs so we fed the long section of the wires under those to keep the wires from billowing out at the back. S
Step 10: Speaker and Amplifier
You may have noticed a purple iPhone dock in previous steps that I was using until the last minute for speakers. It was awfully heavy but the speaker amp I wanted from Adafruit was back-ordered. I got it with days to spare and ended up replacing the mp3 player with the custom speaker/amp solution within hours of trick or treating and in doing so reduced its weight and size by at least 50%. I made a little circuit on perf board for the amp and the various wires to keep it tidy and strong. I cut one of the two male ends off the stereo earphone cord I had and soldered its power/left speaker/right speaker wires and my power and ground wires to a piece of perf board. I also soldered the battery pack's power and ground wires onto the circuit. I used the supplied header pins for the amplifier circuit and soldered that circuit to the perf board as well. The speaker wires were just screwed into the Left speaker ports. I decided that one speaker was loud enough and didn't end up using the second speaker I had which reduced weight and presumably power. The Wave shield only supports Mono sound files anyway.
I had a four-battery holder but only wanted 5V which is 3 AA batteries so the red wire you see in the battery holder is soldered to the + and - ends of that slot to create a short circuit - enabling the 4 slots to act as 3.
I carried extra batteries but didn't need to replace them for the 1-2 hour trick or treating session, even with sounds playing almost constantly. Note, I probably could have powered the speakers via the same set of D batteries in the microcontroller enclosure which would have reduced weight but I only thought of that just now :P. I know the Arduino + lights + Wave shield controller + boots were using 200mA. I'm not sure how much current the C batteries are rated for but I suspect I had enough max current left to accommodate the amp. It would be worth it for the weight reduction in my opinion.