loading

How to interface a microcontroller with a switch?

I have a device with a lever-style switch, like the bottom switch in the picture of this article. http://en.wikipedia.org/wiki/Miniature_snap-action_switch

With some multimeter probing, i found that of the three pins, the middle is unconnected. The left pin is always connected to ground. The right pin is connected to ground when the switch is unpressed. When the switch is pressed, the right pin is unconnected. How can I use a microcontroller to stand in for this switch? I'd like to have it activate the switch every 2 seconds. I have the software done, and just need to get the hardware set up. Help is apreciated.

sort by: active | newest | oldest
Use a relay. Trigger the relay with the microcontroller, via a transistor. Connect its common pin to the "left pin", connect the Normally Closed pin to the "right pin"

Steve
4lifenerdfighter (author)  steveastrouk4 years ago
Yes, but then when the rlay actuates, the original switch is still closed. I forgot to mention: I want the device to retain its original fuction. Is it impossible?
Yes. Put it in parallel with the existing switch.
4lifenerdfighter (author)  steveastrouk4 years ago
But even when the relay breaks the connection, there will still be conductivity through the original switch. Thereby having the device beleive nothing has happened.
Put the Relay in series with the switch. Sorry.
4lifenerdfighter (author)  steveastrouk4 years ago
Genius. One problem. The existing switch is mounted to a PCB in the device. How do I connect the relay to the switch's circuit?
Cut a track, insert the relay connections across the break.
4lifenerdfighter (author)  steveastrouk4 years ago
When you say cut a track, do you mean to break the pcb trace connecting the switch to ground?
Yep.
4lifenerdfighter (author)  steveastrouk4 years ago
Wonderful. I think I can do that. Thank you for all your help. I'll be sure to credit you when I finish my project.
Don't forget to tick the Best answer box !

Steve