I recently received this 2-wire door detection sensor (see image below). How can I connect it to my RPi without causing either damage?

After some further research, I would like to edit my question. I discovered that this is an ultra-thin dual magnet opening detector. Its characteristics: low voltage output signal, TOR, 3V3 INPUT, output on two wires: DOUT and VCC.

After a search on Google, it seemed to me that the principle of using all sensors of this kind with an RPi is the same. But I have seen fritzing where the two wires are connected directly to the GND and to another GPIO of the RPi. Yet some articles talk about using a resistance ranging between 1-10khm to protect the RPi.

This is the reason why I post this question, I would like to have some help on how to proceed. I am using a Raspberry Pi 3.

image of unknown sensor

connexion of sensor on breadboard

  • 3
    You need to identify the type of sensor. Once you have done that it should be a simple case of googling the raspberry pi and the sensor name.
    – joan
    Apr 18, 2017 at 11:04
  • 1
    We can't help you with nothing but a picture. What sensor is this? where to find it? (it's documentation) What Pi model do you have?...
    – mystery
    Apr 18, 2017 at 11:41
  • You seem to have it correctly set up. Now, all you need to do is to read GPIO. There is plenty of documentation on this site and elsewhere on the net.
    – Bex
    Apr 19, 2017 at 8:57

3 Answers 3


From image it's little difficult to check the connections




In this configuation ,when reed switch is open you will get 0V at the RPI GPIO pin and when reed switch is close you will get 5V at RPI GPIO pin


This a reed switch based sensor(2- wire door sensor), it comes normally in two types NC(Normal Close ) or NO (Normal Open) .Majority are NO which closes when other piece i.e magnetic part comes in proximity to it.


The sensor has a reed switch inside. To use it, connect the one end to ground and the other end to a gpio pin that you could read. In addition connect a resistor with a value of 1K ohm to 10K ohm from the selected gpio pin to +3V3. While the reed switch is in the open position the gpio pin will read a logical 1. When the switch is closed, it will read a logical 0. Enjoy your Pi..

  • Thank you for your answers but I have very limited knowledge in electronics. To be sure not to be mistaken, are my connections on the photo correct ( I added the photo to the question, see above)? 1 wire to the GND, the second to the gpio 4 with a resistance of 1K ohm between this gpio and the 3v3. And how should the resistance be connected (longer pin and shorter pin) ?
    – Tobin
    Apr 19, 2017 at 7:50

Your Answer

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

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