Resistor Colour Code📖 Reference
Read resistor values from colour bands on through-hole resistors. Works for 4-band and 5-band types.
⚡ Hold the resistor with the tolerance band (gold/silver/brown) to the right before reading left to right.
Read resistor values from colour bands on through-hole resistors. Works for 4-band and 5-band types.
Colour Digit Multiplier Black 0 x1 Brown 1 x10 Red 2 x100 Orange 3 x1K Yellow 4 x10K Green 5 x100K Blue 6 x1M Violet 7 x10M Grey 8 x100M White 9 x1G Tolerance band: Gold = +/-5% Silver = +/-10% Brown = +/-1% Red = +/-2% 4-band examples: Brown-Black-Red-Gold = 10 x 100 = 1 kohm +/-5% Red-Red-Orange-Gold = 22 x 1K = 22 kohm Yellow-Violet-Red-Gold = 47 x 100 = 4.7 kohm Brown-Black-Orange-Gold= 10 x 1K = 10 kohm Common values in maker kits: 220 ohm -- LED current limit (5V, ~14 mA) 330 ohm -- LED current limit (5V, ~10 mA) 1 kohm -- general pull-up / pull-down 4.7 kohm -- I2C pull-up, 1-Wire pull-up 10 kohm -- button pull-up, ADC reference divider
LED Current Limiting📖 Reference
Calculate the correct resistor value to safely drive LEDs from any voltage supply.
⚡ NEVER connect an LED directly to a voltage source without a resistor -- it will burn out immediately.
Calculate the correct resistor value to safely drive LEDs from any voltage supply.
LED forward voltages (Vf) -- approximate:
Red, Orange, Yellow 1.8 - 2.2V
Green 2.0 - 3.5V (varies widely)
Blue, White, UV 3.0 - 3.5V
Infrared 1.2 - 1.5V
Resistor formula:
R = (Vsupply - Vf) / I_target
I_target: 5-20 mA (10 mA is a good starting point)
GPIO current limit: 8 mA (Pico), 12 mA (Pi), 12 mA (ESP32)
Examples:
5V supply, Red LED (Vf=2V), 10 mA:
R = (5 - 2) / 0.010 = 300 ohm -> use 330 ohm
3.3V supply, Red LED (Vf=2V), 10 mA:
R = (3.3 - 2) / 0.010 = 130 ohm -> use 150 ohm
3.3V supply, Blue LED (Vf=3.2V), 10 mA:
R = (3.3 - 3.2) / 0.010 = 10 ohm -> use 33-47 ohm
Safe defaults (if in doubt):
5V system: 220 ohm or 330 ohm
3.3V system: 47-100 ohm (red/yellow), 10-33 ohm (blue/white)
Wiring:
GPIO -> Resistor -> LED Anode (+, longer leg) -> LED Cathode (-, shorter leg, flat side) -> GNDNPN Transistor as a Switch📖 Reference
Use an NPN transistor (BC547, 2N2222, PN2222) to switch loads larger than a GPIO pin can drive directly.
⚡ For motors, relays and solenoids (inductive loads), add a flyback diode across the load to prevent voltage spikes.
Use an NPN transistor (BC547, 2N2222, PN2222) to switch loads larger than a GPIO pin can drive directly.
NPN transistor legs (BC547 -- facing flat side, pins down): Left = Collector (C) -- connect to load Middle = Base (B) -- connect via resistor to GPIO Right = Emitter (E) -- connect to GND Basic circuit: GPIO -- [R_base] -- Base Load+ -- Load -- Collector Emitter -- GND Load power supply positive -- Load Base resistor calculation: I_base_needed = I_load / hFE R_base = (V_gpio - 0.7) / I_base_needed Use 2-3x I_base for full saturation (low collector voltage) Example (100 mA load, hFE=200): I_base = 100mA / 200 = 0.5 mA (use 1.5 mA for safety) R_base = (3.3 - 0.7) / 0.0015 = 1733 ohm -> use 1 kohm Typical values: 3.3V GPIO, small load: 1 kohm base resistor 5V GPIO: 10 kohm base resistor For larger loads -- use a MOSFET instead: IRLZ44N, AO3400, 2N7000 (logic-level gate, works at 3.3V) Gate resistor: 100-470 ohm No base-emitter voltage offset to worry about Flyback diode (motors, relays, solenoids): 1N4148 or 1N4001 across the load in REVERSE Cathode to positive supply, Anode to collector
No entries match