Sunday, May 23, 2010

Fun with 555s

The 555 timer IC is an incredibly useful & popular chip. If you're not already familiar, there are plenty of useful sites on the internet that will explain it in detail. I like this site best: www.doctronics.co.uk/555.htm.

The 555 is great for a lot of simple projects, usually involving functions like generating a tone, generating a timed delay, generating a timed pulse, and so on. In this post I'll go over two that I really like.

1. The Steady Hand or Buzz Wire game
The Steady Hand/Buzz Wire game involves leading a wire loop through a wire maze without touching the two together.

The wire maze and wire loop will act as two contacts of a switch. You'll want to build a 555 astable circuit. On the Doctronics page I linked above, look at the "minimum component astable" circuit. Instead of the LED and 680 ohm resistor, plug in a speaker or piezo transducer (polarity isn't important with these). Then calculate the R1 and C values using the provided equation, aiming for a tone you can hear (440 Hz for example). When you fail the game and touch the wires, the switch closes the circuit (you could place it in line with +V for example) and the buzzer sounds.

2. Return Key to Hook Alarm
Somebody on my robotics team has a bad habit of forgetting to return the conference room key to its place. He puts it in his pocket and leaves for the weekend, and nobody can get in the conference room and the entire listserve gets a series of angry emails. So I brainstormed this: an alarm that goes off if some time has passed and you have not returned the key to the hook. The circuit must achieve the following when the key is removed from the hook: first, it must wait for a certain interval of time, and then it must sound the alarm (buzz).

A reed switch is a switch that turns on or off in the presence of a magnetic field. I mount a strong magnet on the key hook, so I want a reed switch that will be "normally closed," in other words, OFF in the presence of the magnetic field. Two 555 timers (both included on a 556 chip) take care of the rest.

This page http://clarkson-uk.com/555-timer/operation/frames3.html shows you how to construct the first part of the circuit: a timed delay. When the reed switch is ON (key is off the hook!) the delay begins and lasts for the calculated interval (depends on the value of the resistor and capacitor you choose). For the duration of the interval the output pin is LOW, but as soon as it is over, it goes HIGH until the circuit is powered off (key is returned to the hook).

We use the output of that first 555 to control the RESET pin of the second 555. When the RESET is LOW the output of the 555 is always LOW. Only when the RESET goes HIGH is the 555 allowed to function normally.

So, again referencing the Doctronics "minimum component astable" circuit: replace the LED & 680 ohm resistor with a speaker/piezo transducer, and calculate the R1 and C values appropriately (ie something in the range of human hearing!).

Here is a photo of (left to right): a magnet, the Key Alarm device, and some keys.



In the future, if I ever want to actually use this, I might get a nice PCB fabricated and use surface-mounted parts and a smaller enclosure. This one is just a prototype obviously, haphazardly put together and stuffed into this box that some ICs were shipped in.