door alarm / reed switch

Hello fellow arduinoheads,

I'm trying to interface a reedswitch / magnetic door alarm w/ the arduino. I've been fiddling around and I'm finding that the voltage going to the speaker alarm is likely too small (under 1v then drops to 0 when the switch is closed (door is closed)). I've thought of putting the reed switch itself on the analog input and reading it's resistence? Is it possible to use a pull-up resistor to bring the voltage closer to 5V?

Thanks for any help!

Concise and brilliant as usual. Thanks Richard. I'll take some time to study what you have here.

Sometimes parts intended for an alarm circuit have an integral parallel resistor. The idea is that you can detect either an open circuit or a short. This also allows combining N/O and N/C sensors on a single circuit. If you have one of these parts on your hands, things might appear a little wonky.

This is a very cheap dollar store unit. It isn't meant to interface with anything. Just sounds an alarm speaker when the switch is open. So no to the external connections.

I had a bunch written that I just erased since I figured out where to get the 3Volts from. The 3volts goes through the reed then to a transitor that switches to charge the capacitor that powers the speaker load (I think that's right). There is a resistor that looks like it is tied across the collector and emitter of the transistor (hard to see). Such that the 3volts is brought down to 0.132 at the end of the capacitor.

Anway I was able to get a 3volt ON and 0volt closed reading by grounding directly to the battery (3V) and then directly to the reed switch. I think it's working. Going to try it out on the digital pin now.

Thanks for your help so far guys(and or girls)!

-Allan

Yay, the arduino likes it! However, there does seem to be a bit of noise such that when the door/switch is opened the LED goes off (as it should via the code) but then it may flicker on for a a few ms then go back off. There is also sometimes a slight delay at times between the LED and the reed switch.

Will a 10K resistor across the 3V ground coming from the device to the arduino help clean up the noise? It's actually working pretty good and reliably if I place the magnet in a sweet spot. Perhaps some of this is to do with the quality of the dollar store reed switch. haha.

Thanks Richard. That's actually where I originally looked to wire it up!

Cheers,