I have a big wardrobe in a dark room, I put leds inside and I want to light them up when the door (sliding door) opens. What's the cheapest and more robust way to detect door opening, with less damage to the door itself.

For example,

  • IR detection, emitter and receiver in the frame and mirror in the door.
  • hall sensor, adding some magnet in the door and sensor in the frame
  • capacitive sensor, adding some metal in the door and sensor in the frame

so, cheap easy and robust?

What about this: http://www.dx.com/p/reed-switch-magnetically-controlled-switch-golden-5-pcs-306815#.U8fLU_mSx8E so I just glue a magnet in the door and set this guy in the frame as a switch between +3.3V and a reading gpio and .. that's all, isn't it ?

  • 1
    Why do you need a Raspberry Pi? Just use a magnet switch directly connected to the LEDs: elementalled.com/magnetic-drawer-switch.html
    – Craig
    Jul 17, 2014 at 17:38
  • Is not better to switch the mains before the power supply of the LEDs to save energy? Can I use the reed in the 220V line? is not gonna melt it ? according to the led it uses 1.8W
    – javirs
    Jul 18, 2014 at 8:13
  • You will need to check the specification for the switch to know if it will handle the load.
    – Craig
    Jul 22, 2014 at 18:13

1 Answer 1


I finally set a reed switch just over the power between the transformer and the leds. Now the transformer is always consuming energy, which I don't like but .. this is what I have set

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.