Learn
Resistor Values and LED Brightness on Raspberry Pi 4B
Learn how a resistor's value changes an LED's brightness on a Raspberry Pi 4B. Set ohms, kilo-ohms or mega-ohms and check the value with the Digital Multimeter.
Try this directly in the free Raspberry Pi 4B simulator — no hardware or signup required. New to the GPIO header? Start with the interactive pinout guide.
What you’ll need
- Raspberry Pi 4B
- LED
- Resistor
- Digital Multimeter (Free, for the value check)
Step by step
A resistor limits how much current flows. An LED needs one, or it draws too much current. A bigger value means less current, and a dimmer LED.
- Drag a Raspberry Pi 4B, an LED and a Resistor onto the Canvas. Wire Pi pin 37 → the resistor, the resistor → the LED's anode, and the LED's cathode → a Pi GND pin (for example pin 39).
- Click the resistor to select it. Its settings show a Name and a Resistance box with a unit list (Ω, kΩ or MΩ). The default is 220 Ω. You can only change it while the simulation is stopped.
- Go to the Code tab and write:
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD)GPIO.setup(37, GPIO.OUT)GPIO.output(37, GPIO.HIGH)- Click Start and look at the LED with the resistor at 220 Ω. Click Stop.
- Set the resistor to 1 kΩ and click Start again. Then try 100 kΩ.
- To check a value: drag a Digital Multimeter onto the Canvas, set its Mode to Continuity/Resistance, and wire its two probes to the resistor's two terminals.
What “working correctly” looks like
- How to test it: with 220 Ω the LED is on and clearly lit. With 1 kΩ it is noticeably dimmer. With 100 kΩ it is almost off. The simulator scales the brightness from the current, using the pin's 3.3 V and the LED's voltage drop.
- The Multimeter in Continuity/Resistance mode reads 220 Ω for the default resistor, and 1.00 kΩ after you set 1 kΩ. This works even while the simulation is stopped.
- The resistor's colored bands change to match the value you set.
If something’s wrong
- The LED never lights → check the anode and cathode orientation, and that pin 37 goes through the resistor to the LED. The script also needs to run: click Start.
- You cannot change the value → stop the simulation first. The settings are locked while it runs.
- The value reverts after you type it → the box must hold a valid number. An invalid or empty entry goes back to the last valid value.
- The Console warns that the LED is lit through less than 100 Ω → the resistor is too small. A real LED would likely burn out, so use 220 Ω or more.