I’m connecting a NO reed sensor to 3.3v and GPIO17. In my code I defined GPIO17 as input and set the internal resistor to pulldown.

When the door is closed, GPIO 17 reads 1 and 0 when the door is open.

The code works flawless and does what I want it to do, but since the door is closed 99% of the time I’m concerned about safety and power draw.

Is this circuit safe, or is there a risk of damaging the pi? Since there is not any resistor in the circuit, how much power does it draw?


I've changed my setup to this as suggested by Milliways Reed Circuit

1 Answer 1


This would be "safe", but not best practice and subject to interference.

The internal pullups are very high impedance; use a lower value resistor. Unless the leads are very short and/or shielded you are likely to pick up inteference.

It is hazardous running leads connected to 3.3V, any accidental short risks blowing up the regulator - it is normal to connect switches between GPIO and Gnd

See https://elinux.org/RPi_GPIO_Interface_Circuits.

It is also good practice to use a series resistor ~1kΩ to protect the GPIO if it is configured as output.

See I am getting ghosting/bouncing on my digital input

  • I haven't had any problems with interference, but I still changed the circuit as described. Can you take another look at it to see if that's what you meant?
    – Unkn0wn
    Apr 22, 2020 at 7:10
  • 1
    That looks OK. I would have used a lower pullup 4.7kΩ max - 3.3kΩ would only draw 1mA. I guess after 50 years working on electronics is hostile environments I have learned the hard way.
    – Milliways
    Apr 22, 2020 at 7:22

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.