Electronics

LEDs

Close up on three LED lights.

The forward current of a LED depends on its color. The regular cheap 3-10 mm LED diodes range from (red, orange, yellow, etc) to (white, green, warm white, etc). They have typical a forward current of , and a maximum forward current of 1 (for reference, a GPIO pin of an ESP32 provides up to ca max ).

Color
White - -
Warm White - -
Blue - -
Red - -
Green - -
Yellow - -
Orange - -
Pink - -
UV - -

Resistance

Since these LEDs all generally have consistent forward currents and forward voltages, we can just use Ohms law and work out a reference table for common supply voltages.

Supply voltage

The resistor values are assume the typical forward current of 20 mA.

Forward voltage

The voltage across the circuit is equal to the sum of the voltage across the components in the circuit, the resistor and the LED.

So for an LED with a forward d voltage that is connected to a supply voltage , the voltage across the resistor is .

>>> I = 0.02     # 20 mA == 0.02 A
>>> Vs = 3.3
>>> Vf = 1.8
>>> V = Vs - Vf
>>> V/I          # R = V/I
75               # 75 Ohm

So to connect LED with a forward voltage of 1.8 V to 3.3 V, it should be protected by a 75 Ω resistor.

Wiring schematics

Schematics
LED circuit - series
Multiple LEDs connected in series.
LED circuit - parallel
Proper way to connect multiple LEDs in parallel, each LED has its own current limiting resistor.

Pinout

LED
Pinout of LED diode
LED pinout2.
Anatomy of a 5mm green LED3
  • The cathode leg ( or ) is the shorter leg (usually ).
  • The anode leg ( or ) is the longer leg (usually ).
RGB LED
Pinout of RGB LED diode
RGB LED pinout4

Potentiometers

Potentiometer
Pinout of a regular potentiometer.
3

Wikipedia: Light emitting diode