Magnetic Switch

Magnetic Switch

Magnetic Switch

  • Switch is “normally open” (open circuit)
  • Switch is activated / closed (completing the circuit) when placed near a magnet
  • Often used to check for open drawers, doors, etc.
  • These are also called a reed switch

How Reed Switches Work


Wiring and Operation

  • Connect one wire
    • 3.3v with 10k pullup resistor
    • Argon digital input pin
  • Connect other wire to ground
  • Switch is not polarized so use either wire
  • When reading signal from Argon
    • HIGH means open circuit (no magnet present)
    • LOW means closed circuit (magnet present)

Wiring Example

Quick Note

  • Wire ends are thin and twisted together so be careful inserting them into breadboard
  • For greater durability, wire ends can be soldered


Exercise Part 1:

  • When the magnetic switch is opened or closed, publish cloud event with the message door was opened or door was closed. Note only one publish should occur every time door is opened or closed (Hint: Think about how this operation is similar to other things we’ve done. what variables would you need to this?)
  • Your event name should be ITP348_Door

  • Change the RGB colors based on their door status
    • Red means the door is open
    • White means the door is closed