I know it's an old question, but I've been reading into the RPi's internal resistors. I'm hoping to use them in order to make my circuit a little bit simpler.
According to this answer there are pull up/down resistors on all of the GPIO pins on the Raspberry Pi B+ and later.
The circuit and program in the tutorial uses an internal pull-up resistor on an input pin. This means current is constantly supplied from the resistor which sets the open circuit to a logical HIGH
. When the switch is engaged, it grounds the pull-up voltage which drops the circuit to a logical LOW
. This is the opposite logical sequence to what most other circuits use where their buttons switch on the voltage, not the ground.
Tutorial (Button on GND):
HIGH: Open Circuit
LOW: Closed Circuit
Typical (Button on 3V3):
HIGH: Closed Circuit
LOW: Open Circuit
Now that being said, for the purposes of safety, I would still recommend a small resistor between the switch and pin if you can't be 100% confident in the software. Just in case the pin gets set to output
, the resistor will be there to not let it short circuit to GND.