Magic Costume and Garage Of Mystery make for Halloween Hardware Madness
- Posted: Nov 14, 2014 at 6:00AM
Today with have not only one, but two Halloween projects. One from Abhinaba Basu and the other, Jamie Dixon (whom I got to meet and chat with last week at the Microsoft MVP Summit... Yep, he's as cool and passionate as you might think from his posts and projects :)
I can hear you already, "Halloween? But that's weeks in the past Greg! What are you thinking?"
I'm thinking that these are just cool projects and there's no way I'm waiting a year to highlight them! Plus, maybe, they will give you some ideas for the coming holidays.
This Halloween me and my daughter decided to add some dazzle to her fairy costume. Since we were anyway learning to code on Arduino we decided to dip our hands in wearables.
The basic idea is to build a costume that glows when someone comes close. The project was intended to teach a 9 year old to code and is hence simple enough for her to grasp. We used the following
- Arduino UNO board
- TIP120 transistor
- Diode 1N4004
- 1K Resistor
- HC-SR04 Ultrasonic Range Finder
It’s best to consider the circuit as two separate pieces. One to acquire the distance of someone approaching using the HC-SR04 ultrasound range finder. The second is to actually make the LED strip glow.
The first part consists of connecting the 4 pins of the HC-SR04 as follows
The entire code is available on GitHub at https://github.com/bonggeek/GlowDress/ (I cleaned up the code a tiny bit after my daughter wrote it). This is how it looks
Here to abstract away the intricacies of how distance is received from the ranger, I have used GetDistanceInCm. The source for this library is at https://github.com/bonggeek/GlowDress/tree/master/UltraSonicRanging.
Once we tested out the circuit we went ahead and soldered it on a board. My daughter did receive a battle scar (a small burn from iron) but we battled on.
For this years Halloween, the kids and I decided to do something out of the opening scene of Indiana Jones, without the big rock. We wanted to give kids a choice when they came to the house –> either get a small “fun” size candy bar or enter the garage of mystery for the chance of a full sized candy bar. (Incidentally, whoever thought it would be a good idea to name the smallest candy size on earth “fun” obviously was never a kid. When I was growing up, we called it four size, being that if took four of them to make a normal candy bar)
So if the kid wants to go into the garage of mystery, they have to get to the alter of snickers without the motion detector or the laser beam trip wires catching them. The full-size Snickers would disappear if the kid was picked up by the Kinect motion detector or if they tripped too many beams. In the diagram below, the red dots are the lasers crossing in front of the alter
The first thing we did was construct the alter.
Once the frame was set, we added a servo with a trap door to the top. We control the servo via a Phidget Servo Controller with some basic code from the Phidget SDK (if the SDK, you know, had F# in it)
And you can see it in action here:
With the light sensor in place, we turned our attention to the Kinect motion sensor. I first considered Rob Miles’s ides to compare the different color frames to see if there was movement but because I am using F# and F# does not support pointers like C#, the performance was too choppy. You can see the Stack Overflow thread here. So I could have either jumped to over to C# or figure out a different way using F#. I went with option B by using the skeleton frame, which has a Z index. By comparing the Z index over time, I can see how fast a person is moving towards to alter. The Kinect code was pretty much from the SDK (if the SDK, you know, had F# in it)
And we were good to go. The final result looks like this (the smoke machine was an added touch):
All of the code is on github here. If you create your own garage of mystery, please drop me a line –> I would love to see what other makers come up with.