Welcome to Atalasoft Community Sign in | Help

A Geek on Hallowe'en

This blog entry is about design and design process using Hallowe'en as a delivery vehicle.

In early September, I started thinking about Hallowe'en.  I've always loved the holiday with its unbridled opportunity for creativity.  Unfortunately, with my active family life, it's hard to devote as much time to it as I have in the past.  I spent some time talking to my spouse about it and how we wanted Hallowe'en to be for our family and both she and I are on the same page for making things to enhance our house.   We want our house to become "that house".  You know the one.

I own a smoke machine and in previous years, I've set it up on the front porch with the manual remote running into a window so that when kids come to the door, we could send out a burst of smoke behind them.  I had one kid jump off my porch in surprise.  It was worth it.  The problem is that working the remote is a bit of a pain, so I decided to try to build automation for it.  The design goals were:

  • Needs to be able to detect when children arrive
  • Needs to be able to trigger the smoke machine
  • Needs to be able to detect when the smoke machine is ready
  • Needs to be expandable for future use

Now keep in mind that not only am I decidedly NOT an electrical engineer, I've never even taken electronics courses.  I have a cursory understanding of circuitry and typically view digital circuitry as programming with a crummy editor.

I dismantled the smoke machine remote and looked it over - a couple of surprises - the machine was running AC right into the remote as the indicator lamp is a neon lamp (fairly standard part) and the switch was rated for AC.  This told me that I would probably need a relay to switch the AC.  I wanted to try using solid state relays rather than coil relays for silent operation.  I also decided that I would try to build an IR beam crosser like you have in the entranceway to some stores.  I could mount it on two posts on my porch as an photometric trip wire.  So I read a little bit and while my kids watched The Muppet Show, I sketched up some ideas and notes from the remote:

I had three separate units - the smoke machine activator (relay), the smoke machine ready detector and the trip wire.  My intent was to glue them all together with a microcontroller.  Since I was already familiar with it, I chose the Parallax Basic Stamp, in particular the Stamp I, which has plenty of power for this task and is cheap enough.  With 8 input pins, I was in good shape to grow a system that could in the future flash lights, servos or sound as needed.

The smoke machine ready detector was based on a hunch - if thought that if I could drive a red indicator light from the smoke machine than an phototransistor (most of which are IR sensitive) might have a good chance of picking up the signal.

You can see that the trip wire was the most struggling for my poor little brain.  I referred often to Forrest Mimm's optoelectronics book - very helpful.

Finally, I ordered parts.  I have a Parallax Basic Stamp II system kicking around, and I thought I'd do initial prototyping and experimentation on that then downgrade it to the Stamp I when it arrived - good thing - shipping on the Stamp I was slow.

Meantime, I also bought a Labor Day closeout on a chest cooler in order to make a fog chiller.

I picked one day a week to sit down after the kids went to sleep to hack on this project.  In the process, I found the following:

The "new old stock" solid state relays I bought were either DOA or I couldn't drive them from the microcontroller.  I suspect dead.  Instead of ordering more, I decided to switch to coil relays and to save shipping time, I picked them up at Radio Shack.  Although I wasn't happy about having to up the component count, they worked right away.  Meantime, while browsing, I found that Radio Shack was selling an IR motion detector module - the interfacing was 5V, ground, and a logic line.  Under $10?  Score.  I bought one and scrapped my trip wire idea.

The mechanical relay has to be drive by a transistor to get more oomph than the microcontroller could supply and it needs a diode to keep flyback spikes away from the circuitry (basically, whenever a mechanical relay opens or closes there are feedback spikes that can damage drive circuits).

Generally speaking, when I prototype, I try to buy 1.5 to 2x the number of parts I need.  As many people know, semiconductors run on magic smoke and if you let the smoke out, they stop working.  This is a good practice and I did break several parts in the process.

Around the same time, I got the smoke machine ready detector working to a degree.  The phototransistor could detect the red light, but not very well.  It was pretty twitchy at best, so I looked for alternatives.  I found several schematics online bur working with AC always makes me antsy and the schematics weren't presented with very high confidence.  Instead I found a single chip that would do the work with minimal external components - it's pretty much the same circuit I was building, but carefully tuned by an actual EE.

Finally, the Stamp I chips arrived and I could move the modules to a bigger protoboard and rework the driver code for the smaller Stamp.  Unfortunately, I made some mistakes while recreating the relay driver and smoked three transistors and one pin of the stamp isolating it.  Oops.  I debugged and rebuilt.

At this point I had the following set up on my desk at home:

 

 The chip at the far left is a 555 timer that had been on my protoboard.  Continuing on is the MID400 AC Line Monitor (8 pin dip), the relay, the IR module, a yellow indicator LED and the Basic Stamp carrier board.  The top rail is ground, the bottom rail is 5V.  I took out a pad of paper and scribbled down each module:

I was committed to using IO Pins 0, 1, 3 and 4.  Note that I skipped pin 2 because I burned it out.

I got each module working individually by testing on simulated inputs and outputs.  I did some quick testing on the real smoke machine and discovered that the remote indicator light either doesn't show "ready" or is highly analog - it was showing ready pretty much right away.  Not great, as I only wanted to put out smoke, but it just means that driver might try to run the smoke machine when it's not ready.  I decided to commit to solder since the week before Hallowe'en, I'll be at PDC and have no more time to experiment.  The smoke machine dirver works light a champ and I made a quick decision to do the rest of my testing outside before my spouse flipped.  Here's the main board:

 

After some field testing, I tuned the firmware and now have it working.  The software boots up, waits a few minutes for the smoke machine to warm up, then if motion is detected, it turns on the smoke machine for 15 seconds and then goes idle for three minutes (to let the machine recover and to keep kids on my porch from being smoke out).  If the machine doesn't detect smoke, every 3 minutes or so it lets out a puff of smoke to keep the house looking extra spooky.

Lessons learned: start earlier than you think.  Be prepared to test a lot and revise.  In this project I had to make several changes because either the technology didn't work or a better piece of technology became available.  I also had a bunch of back up plans - I didn't modify the original remote so if I failed I was no worse off than when I started.  If the smoke driver didn't work, I could run it by hand.  If the smoke chiller didn't work I could do without it.

Published Friday, October 24, 2008 11:16 AM by Steve Hawley

Comments

Sunday, October 26, 2008 10:32 AM by electrical engineering hand book | Bookmarks URL

# electrical engineering hand book | Bookmarks URL

Anonymous comments are disabled