0

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?

EDIT #1

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

Unkn0wn
  • 23
  • 1
  • 6

1 Answers1

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

Milliways
  • 62,573
  • 32
  • 113
  • 225