A pull-up resistor is connected between a signal line and a positive voltage supply to ensure the line reads a high voltage (logic 1) when no other device is driving it.
Click to reveal answer
beginner
What is a pull-down resistor?
A pull-down resistor is connected between a signal line and ground to ensure the line reads a low voltage (logic 0) when no other device is driving it.
Click to reveal answer
beginner
Why do we need pull-up or pull-down resistors in Raspberry Pi GPIO inputs?
They prevent the input pin from 'floating' which can cause unpredictable readings by ensuring the pin has a default voltage level when no button or sensor is connected.
Click to reveal answer
intermediate
How can you enable an internal pull-up resistor on a Raspberry Pi GPIO pin using Python?
Using the RPi.GPIO library, you can set up a pin with pull-up like this: GPIO.setup(pin_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)
Click to reveal answer
beginner
What happens if you don't use pull-up or pull-down resistors on an input pin?
The input pin may 'float', causing it to randomly read high or low, leading to unreliable or noisy input signals.
Click to reveal answer
What does a pull-up resistor connect to?
AGround
BPositive voltage supply
COutput pin
DBattery negative terminal
✗ Incorrect
A pull-up resistor connects the signal line to a positive voltage supply to keep the input high when not driven.
Which resistor prevents a GPIO pin from floating low?
APull-down resistor
BPull-up resistor
CSeries resistor
DNo resistor
✗ Incorrect
A pull-down resistor keeps the pin at a low level, preventing it from floating high.
How do you enable an internal pull-down resistor in RPi.GPIO?
5. You want to connect two buttons to Raspberry Pi GPIO pins 6 and 13. Button on pin 6 should read HIGH when pressed, and button on pin 13 should read LOW when pressed. Which setup correctly uses pull-up and pull-down resistors to achieve this behavior?
hard
A. GPIO.setup(6, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_UP)
B. GPIO.setup(6, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
C. GPIO.setup(6, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
D. GPIO.setup(6, GPIO.IN)
GPIO.setup(13, GPIO.IN)
Solution
Step 1: Understand button logic for pin 6
Button on pin 6 should read HIGH when pressed, so use pull-up resistor to keep default HIGH and go LOW on press.
Step 2: Understand button logic for pin 13
Button on pin 13 should read LOW when pressed, so use pull-down resistor to keep default LOW and go HIGH on press.