Resistors & Components

Passive components used in cockpit builds — reading colour codes, calculating LED resistors, and choosing capacitors.

Resistors

Resistors are the most common passive component in any cockpit build. They protect LEDs from overcurrent, form voltage dividers for analog sensors, and provide pull-up or pull-down biasing for digital inputs.

Reading 4-Band Colour Codes

Yellow 4 Violet 7 Red ×100 Gold ±5% 4 700 Ω = 4.7 kΩ ±5%
ColourDigitMultiplierTolerance
Black0×1
Brown1×10±1%
Red2×100±2%
Orange3×1 k
Yellow4×10 k
Green5×100 k±0.5%
Blue6×1 M±0.25%
Violet7×10 M±0.1%
Grey8±0.05%
White9
Gold×0.1±5%
Silver×0.01±10%

Common values for cockpit builds

ValueUse case
68 Ω – 100 ΩLED current limiting from 3.3 V supply (standard LEDs ~20 mA)
220 Ω – 330 ΩLED current limiting from 5 V supply; indicator LEDs at reduced brightness
1 kΩ – 10 kΩBase resistor for NPN transistors driving LEDs or relays
10 kΩExternal pull-up or pull-down for digital inputs
4.7 kΩI²C pull-up (SDA / SCL lines)
LED Series Resistor

Every LED needs a series resistor to limit current. Without one the LED will draw as much current as the supply can provide and burn out instantly.

GPIO (3.3 V) 68 Ω GND R = (Vs − Vf) / If = (3.3−2.1) / 0.018 ≈ 67 Ω → 68 Ω

Formula: R = (Vsupply − Vforward) ÷ Iforward

LED colourTypical VfTypical IfR from 3.3 VR from 5 V
Red1.8–2.2 V20 mA56–75 Ω → 68 Ω140–160 Ω → 150 Ω
Yellow / Orange2.0–2.2 V20 mA55–65 Ω → 68 Ω140–150 Ω → 150 Ω
Green2.0–3.0 V20 mA15–65 Ω → 33–68 Ω100–150 Ω → 100 Ω
Blue / White3.0–3.4 V20 mA0–15 Ω → use 33 Ω min80–100 Ω → 100 Ω
Pull-Up and Pull-Down Resistors

A floating GPIO pin (nothing connected) will give random readings. A resistor anchors the pin to a known voltage when the switch is open.

ConfigurationResistor connectsIdle (switch open)Active (switch closed)
Pull-upGPIO → 3.3 VHIGHLOW (switch to GND)
Pull-downGPIO → GNDLOWHIGH (switch to 3.3 V)

The ESP32 has built-in ~45 kΩ pull-up resistors on every GPIO — enable with pinMode(pin, INPUT_PULLUP). External 10 kΩ pull-ups provide a stronger reference and are preferred when the wire run is long (>30 cm) or the signal line is near power wiring that could induce noise.

NPN Transistors — Driving Higher Loads

An ESP32 GPIO can source/sink a maximum of 40 mA (12 mA recommended). For higher loads — multiple LEDs, a buzzer, a relay coil — use an NPN transistor as a low-side switch. The GPIO drives the base through a resistor; the transistor switches the load.

TransistorIC maxUse case
2N2222600 mASingle LED strings, small buzzers
BC547 / BC337100–800 mAAnnunciator LED banks, relay coils
TIP120 (Darlington)5 AMotor control, large LED arrays, solenoids

Base resistor calculation: RB = (VGPIO − VBE) ÷ IB, where IB = IC ÷ hFE. A 1 kΩ base resistor is a safe starting point for most NPN transistors at GPIO logic levels.

Capacitors — Decoupling & Filtering

Capacitors appear in two roles in cockpit builds: decoupling (suppressing voltage spikes near ICs) and filtering (smoothing power rails). They are not optional near motor drivers and stepper controllers.

ValueTypeUse case
100 nF (0.1 µF)CeramicDecoupling cap across VCC/GND on every IC; place as close as possible
10 µFElectrolytic or ceramicBulk decoupling near ESP32 VIN; helps with Wi-Fi transmit spikes
100 µFElectrolyticRequired across VMOT/GND on A4988 / DRV8825 stepper drivers
1 000 µF +ElectrolyticMain power rail filter when multiple servos share a supply
Diodes — Protection

Two diode types appear regularly in cockpit wiring:

DiodePurposeWhere to use
1N4007 (rectifier)Flyback / freewheeling — absorbs voltage spike when inductive load switches offAcross relay coils, motor driver outputs, solenoid valves
1N4148 (signal)Reverse-polarity protection; signal isolation in diode matrix keyboardsButton matrices, input protection on sensitive GPIO lines
Schottky (e.g. 1N5819)Low forward voltage drop (0.3 V) — power path selection, OR-ing suppliesDual-power schemes (USB + bench supply), OR-ing two ESP32 power inputs