Using an Arduino - we are using a Nano V3.0 compatible board - we want to turn on the on-board LED (LED_BUILTIN) on when no magnetic field is present, simulating the way security switches on doors and windows work:
Attached to the door or window frame is a Reed Switch, on the movable part - the door or window - is magnet.
In closed position it will be near enough to the reed to close the circuit.When the door - or window - is opened, the reed will return to open position and the Arduino will trigger the LED - or any other operation - to alert of the door being opened.
Of course we can use only the Reed Switch, however the module makes it a bit easier.
Instead of triggering the LED_BUILTIN, you can trigger an external LED or other output devices, send messages, etc.
NoteTriggering a LED with the reed switch can be accomplished without the Arduino and we might give a tip on this later.
Requirements- Arduino (compatible) development board - we used the Arduino Nano compatible board (see here)
- Our Mini Reed Module KY-021 (see here)
- Arduino IDE (download here)
- This tip is focused on using the Arduino IDE
KY-021 | Arduino
PIN S | D3
PIN + | VCC 3.3V - 5V
PIN - | GND
Comments