SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By davidb
#94354
Hi all,
Need some sensor advice. I'm basically looking for something very similar to the switch that is in the Harry Potter family of "lighted" wands, e.g.:

http://www.noblecollection.com/catalog/ ... 0&catid=21

you shake it, LED turns on, shake it again, LED turns off. It appears to be some sort of spring activated switch (the wand had an unfortunate meeting with my dremel). I have a project I am working on now that could use the same functionality, and am wondering if anyone had any clue where to look for something small & inexpensive. Something along the lines of the piezo vibration sensor sold thru sparkfun, only in switch form.

Thanks in advance for any advice!

Best,
David
By lyndon
#94558
Use a mercury switch (look in an old thermostat if you can't buy one) or since you have a Dremel tool you can make your own.

Center of the switch is a short length of wire with a small weight on the end. Wire must be light enough so the weight will "bounce" when you shake it.
Make a circle out of copper wire and assemble the two so the straight wire is in the middle of the circle. Using copper wire makes it easy to solder to a circuit board. Now you have a motion switch that makes momentary contact when you shake it.

Wire up a one-shot circuit with a 1-second or so time constant using a 74LS123 or a 555. The output of the one shot feeds a toggle flip flop. The same can be accomplished with a few lines of code and a microcontroller.

When you shake the switch, it triggers the one shot which generates a pulse and the flip flop toggles ON and turns on the LED. Since the one shot lasts 1 second, it give the vibration time to end so the LED doesn't just flash rapidly. Shake again, and the flip flop toggles OFF.

Nice and simple. Sure you could to the same with an accelerometer if you want to spend the money, but the home made switch or the mercury one (can also be done using ball bearings) works fine and costs pennies.
By riden
#94561
The following sensor works very well in these types of applications and would be preferable to a mercury switch (mercury is a toxic heavy metal). You could also roll your own sensor like lyndon suggested.

http://www.signalquest.com/sq-sen-200.htm