MyRoboPathOpen Robotics Lab
All cheatsheets
ElectronicsQUICK REFERENCE

Resistors & LEDs

Read polarity and choose a resistor before lighting your first LED.

Ohm’s lawMyRoboPath / Robotics field notes
Download PDF

01LED polarity

Anode (+)
Usually the longer lead on an untrimmed through-hole LED.
Cathode (−)
Usually shorter lead / flat case edge; confirm with diode-test mode.
Series circuit
GPIO → resistor → LED anode; LED cathode → GND. Resistor may also go on the cathode side.

02Choose resistance

Formula
R = (Vsupply − Vforward) / Iled, with current in amperes.
Example
5 V supply, 2 V red LED, 5 mA: R = 600 ohm; choose 680 ohm.
Power
Presistor = I² × R. Choose a power rating with margin.

03Bench values

Common values
220, 330, 470, 680 ohm; 1 kohm, 4.7 kohm, 10 kohm. Calculate for your circuit.
4-band code
First two bands = digits, third = multiplier, fourth = tolerance. Brown-black-red-gold = 1 kohm ±5%.
Digits
Black 0, brown 1, red 2, orange 3, yellow 4, green 5, blue 6, violet 7, gray 8, white 9.

Datasheets & further reading

SparkFun: voltage, current & resistance