Resistor
A resistor is a two-lead part that limits current and divides voltages. In the shop it costs $0.25 and comes in the one 1/4 W axial size that covers almost everything on a Pi board: the series resistor that keeps an LED from burning out, the pull-up that stops an input floating, and the halves of a voltage divider. Its value is the ohms setting — the simulator accepts anything from 1 Ω to 10 MΩ, so E12 values like 330, 4 700 and 10 000 are a convention, not an enforced rule.
Pins
| Pin | What it is | Type |
|---|---|---|
| 1 | Lead 1 | passive |
| 2 | Lead 2 | passive |
| Setting | Type | Range | Default |
|---|---|---|---|
ohms | number | 1–10000000 | 330 |
A resistor is not polarised: lead 1 and lead 2 are interchangeable, and a chain like GPIO17 >> Resistor(330) >> LED passes through in either direction.
Wiring it in circuit.py
The classic use — current limiting in series with an LED:
from wiring import *
pi = Pi()
pi.GPIO17 >> Resistor(330) >> LED("red") >> pi.GNDThe same part covers pull-up duty; here are the two you will meet most:
pi.V3_3 >> Resistor(10000) >> dht.DATA # DHT22 data pull-up
pi.V3_3 >> Resistor(4700) >> probe.DQ # DS18B20 1-Wire pull-up
Driving it in main.py
Nothing to drive: a resistor is transparent to the software. The program drives the LED it protects:
from gpiozero import LED
from time import sleep
led = LED(17) # the 330 Ω resistor sits in series in circuit.py
while True:
led.on()
sleep(0.5)
led.off()
sleep(0.5)Useful values from the parts in the shop:
| Use | Value | Why |
|---|---|---|
| LED from 3.3 V | 330 Ω | ≈ 4 mA through a red LED; 220 Ω is brighter, 1 kΩ dimmer |
| Pull-up / pull-down | 10 kΩ | strong enough to define a level, weak enough not to load a switch |
| DS18B20 1-Wire | 4.7 kΩ | the value the 1-Wire bus expects across DQ and VDD |
| HC-SR04 echo divider | 1 kΩ + 2 kΩ | drops the sensor's 5 V echo to 3.3 V |
Electrical notes
- Rated power is 0.25 W. The model computes
P = I²Revery solve and warnsoverpowerabove the rating — a resistor across a supply rail will trip the judge's damage check. - Tolerance is a datafeed setting:
5 %(default) or1 %. Each part draws one fixed deviation inside the band and keeps it, exactly like a bag of real resistors. - The colour bands are drawn from the value: two significant digits, a multiplier and gold (5 %) or brown (1 %), so
330shows orange-orange-brown and10000brown-black-orange. - An LED almost always wants a series resistor:
R = (Vsupply − Vf) / I. From 3.3 V, 330 Ω gives a red LED about 4 mA, comfortably inside its 20 mA nominal. - The simulator does not snap values to the E12 series:
Resistor(333)solves as 333 Ω. Round to a real preferred value (the E12 series is 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 per decade) when you care about a bench build.
Simulator vs real hardware
- The model is a linear resistor with one per-part tolerance offset; there is no thermal drift, voltage coefficient or inductance.
- The power check is instantaneous. On a bench a 1/4 W part only heats visibly after seconds, and a brief overload may survive.
- Colour bands follow IEC 60062 two-digit codes for any value, including ones no vendor sells.
- Resistance is exact at solve time, so divider ratios come out as clean as the marked values suggest.
Going deeper
- Primers: Voltage, current and Ohm's law and pull-up and pull-down resistors.
- Every part that relies on one: LED, DHT22, DS18B20.
- Recipes: the night light uses one in series and one as a divider.
Further reading
- Electronic colour code — Wikipedia — the IEC 60062 code the simulator's bands follow.
- SparkFun: Resistors — reading bands and common values.
- E series of preferred numbers — Wikipedia — where 330, 470 and 10 000 come from.