Welcome back to the Digilent Blog!
With Halloween coming up soon, I decided to make a cool Halloween prop using Digilent products. After grabbing a chipKIT uC32, a couple of shift registers, a bunch of LEDs, breadboard jumper wires, and a PmodMAXSONAR, I was able to make a distance detecting Halloween Box Monster.
A Box Monster, for those of you who might not know, is “Boximus Terriblus, the Corrugated Conqueror” who occasionally attempts to eat the unwary passerby by closing its lid (sorry, mouth) on fingers that stray a little too close. Luckily for us, it is possible to control his actions and prepare him for Halloween by disconnecting the power that goes to the servo motor which allows him to open and close his mouth. Once he is properly subdued, the preparations become much easier.
However, since it is generally considered impolite to bite a person’s fingers, I decided that the Box Monster should only close his mouth when there were not any people directly in front of him and keep his mouth open when there were people close by. This sensing capability was achieved by using the PmodMAXSONAR. This particular Pmod is able to accurately sense objects in front of it to a one inch resolution over a 20 foot distance. Between this and using the MAXSONAR library, I was able to make sure that the servo motor stayed in the closed mouth position when there wasn’t an object close by but still have the Box Monster open (and keep open) its mouth to show of its inner workings if there was a person within six feet of it.
What inner workings does it have? Well, since we are close to Halloween, I decided that I wanted the words “Happy Halloween” to be on display. However, using an LCD screen such as the PmodCLP or an OLED screen like the PmodOLED would either be not bright enough or a little too small to conveniently read. A large 14-segment display would have been ideal, but a) I didn’t have one and b) it would not be quite as fun to prepare. So, I instead created my own multi-segmented display (16 segments in this case) with pairs of orange LEDs. Admittedly, the box that these LEDs came from claimed that these are “yellow” LEDs, but I’m still fairly convinced that they are, in fact, orange.
As you can likely imagine from the above picture, getting all of the LEDs in place in such a way so that a pair of LEDs would receive power from a single input and also have one (or two, if the LEDs were in parallel) of their cathodes connected to a ground rail was quite a challenge. Thankfully, I was eventually able to get all of the LED pairs set up so that none of them were shorting each other out. To have the LEDs light up in appropriate combinations to form letters, each of the pairs are connected to one of two shift registers which will send out a 5V signal to the LEDs to turn them on. Although these LEDs are not individually rated to handle a 5V signal, the combination of two LEDs recieving the 5V signal brings the “stress level” of the LEDs down to a far more manageable and stable level.
To figure out which LED pairs to turn on when displaying the individual letters of “Happy Halloween”, I mapped out on a piece of paper which output on each shift register went to which pair of LEDs in my 16-segment display. Then, knowing that the combination of high and low voltage values sent out by the shift register would effectively translate to a binary value, I figured out the equivalent binary value that I would need to send to both the top and bottom shift registers in order to display the desired letters. Once I knew what combinations of outputs on my two shift registers I needed, I was then able to use the MPIDE’s built in shiftOut() function send the combinations of LEDs pairs to appropriately display “Happy Halloween” with a brief pause between duplicate letters, such as between the two “p”‘s in happy.
Despite all of this, I knew my box monster was not quite complete without classic glowing eyes. Before putting the sticker on the Box Monster itself, I carefully cut out holes in the lid where the eyes would be and oriented two green LEDs to shine into each eye slot. But because these green LEDs are so bright, they are only turned on when the PmodMAXSONAR does not detect anything in front of it. Once the MAXSONAR detects that there is something close enough to it, the green LEDs are turned off, the box lid opens, and “Happy Halloween” is displayed on the LEDs for as long as an object is detected. Once there is no longer an object the immediate vicinity and the message has finished, the mouth closes again and the glowing eyes return. You can check out the Halloween Box Monster in action in the video below. For more information on how to create the Halloween themed Corrugated Conqueror check out my Instructable!
One Comment on “Halloween Box Monster”
Very cool! I know some boys who would like to make some Halloween surprises and this gives some great ideas.