Halloween 2010

My vision for an electronically-enhanced Halloween was something like this:

It is a dark and stormy night. The air is filled with the sounds of children…screaming in terror at the evils of the night, and oohing in delight at the candies received.Little Timmy approaches the next house…it looks plain enough, with just a couple of styrofoam tombstones in a corner. Unfazed, he continues approaching the door. As soon as he steps up on the front porch, lightning flashes almost blind him, and thunder claps almost deafen him. Startled, Timmy makes another step. A soon as the thunder dies down, a ghost rises from behind some gravestones, and a horrible screaming begins. Timmy, with tears streaming down his face, can’t tell if the screaming is coming from the ghost or from himself…

So yeah, that’s what I was going for. Instead, I only had time to get the ghost to rise up from the grave, and I had to trigger that manually. I did manage to make a couple kids cry, though. It was a qualified success.

The Trigger

I figured the whole thing would be triggered by breaking an IR beam that I’d throw across my porch, so I picked up some IR LEDs, and an IR photodiode.

After figuring out how to use a photodiode (reverse biased with a high-resistance pulldown resistor), I quickly ran into problems. Things worked great when the LED and photodiode were only separated by inches, but I needed the LED/photodiode pair to bridge about an 8 foot gap. When I separated the two, the LED’s light diminished (square of distance, blah blah). So, I added some op-amps to increase the photodiode signal, but then IR noise from my garage lighting dominated the reading.

After a little research, I found out that TV remote controls mitigate the IR noise problem by emitting at a specific frequency, and having the receiver filter it out.

It was a long shot, but I decided to try my own version. I programmed my microcontroller to pulse the IR LED at a couple kHz, and kludged together a high-pass (or bandpass, I don’t remember) op-amp circuit. As I recall, that setup worked up to a couple feet! However, beyond that, I had to amplify the photodiode signal so much that electrical noise became a problem…especially since the microcontroller and flashing LED was on the same power supply. I tried to mitigate power supply noise to the photodiode & op-amp with capacitors, but it didn’t help enough.

I resolved to give up on it for this year, and get a proper IR receiver the next time around. I ended up running a 2-conductor wire into my house, where I sat by the front window and touched the two wires together when I saw kids coming. Even this simple solution ran into problems…the integrated pull-up resistor in the microcontroller was too weak for the long run of wire (I don’t know if it was a capacitance thing, or EM noise?). I had to add an external pull-up resistor for it to work reliably.

FIXME: add photos of a reverse biased photodiode, op-amp non-inverting amplifier, and op-amp high-pass and bandpass filters.

The Lightning

Having read many writeups of people hacking disposable cameras, I figured that would be a great way to simulate lightning.

Here’s my effort

Once again, my efforts weren’t quite enough, and with the deadline looming, I put it aside temporarily.

The Thunder

Without lightning, it’s kind of silly to have thunder, isn’t it?

The Ghost

Now, finally, I have some success…

The mechanical assembly that I created was, to be generous, a kludge. I’m an EE/CE after all, not a mechanical whiz. I had attached some fishing line to the ghost itself, and this spooled up on a chunk of 1-1/4 inch dowel that I had laying around. To attach the fishing line to the dowel, I put in a screw and tied the fishing line to that. To spin the dowel (and, thereby to pull up the ghost), I used parts of a cordless drill. To get the drill to spin the dowel, I drove a screw into one end of the dowel (almost in the center…wouldn’t want to be too precise, you know?). The screw head would slip in the chuck of the drill, so I filed three flat spots on the sides of the screw head. I held the motor on a piece of wood with some precariously placed screws and shims. On the other end of the dowel, I cut a U-shape out of another piece of wood for the dowel to rest in, and tried to lubricate the wood-wood contact with bar soap. It only needed to work for one evening, after all. I put this whole contraption in the little bit of attic over my covered porch, and threaded the fishing line through a tiny hole I drilled in the porch ceiling.

FIXME: add photo or drawing?

Once I got my motor controller working, I still had an issue of control. How would I know that I had run the motor long enough for a ghost to rise a certain distance, and fall the same distance? I went back to my arch-enemy IR.

When I was working with the IR beam in the beginning, I had gotten it working at very close ranges (i.e. within a couple inches). Fortunately, this was all the distance I would need to count revolutions. I created a beam-breaker with a couple of nails and some blue painter’s tape sticking out the side of the dowel, and I arranged the IR LED/photodiode appropriately.

When I was programming the microcontroller to operate the motor, I had made the assumption that any time the IR beam was broken, it was a revolution in the direction I was powering the motor. As it turned out, even after I reversed the power to the motor, it would continue spinning in the original direction for a revolution or two. With the 3 reversals that I had planned (ghost goes up, then down halfway, then up again, and all the way down again), this meant that the motor would be several revolutions off of where the micro thought it would be.

I tried fixing this by coding a delay into the program. I’d have the motor go left, cut the power, wait for it to stop, go right, etc. Unfortunately, this meant waiting almost a full second when changing direction, which I found to be unacceptable. As I say in the motor controller writeup, I adjusted the circuit to minimize the time to stop the motor, so the time required to change directions improved a lot.

I had also picked up a recordable greeting card to make the ghost scream or cackle, but as with most everything else, I didn’t have time to make it work. The ghost operated silently. Well, there was still the noise of the drill motor, but that’s not really a ghost noise…

Schematics & code

FIXME: add schematics & code.

Leave a Reply