Labs / Basics · Beginner · 20 min
LED current limiting
Calculate the series resistor R = (Vs - Vf) / If.
Engineering instrumentation: This lab includes an instrument-style virtual test setup and parameter-driven waveform. For physical measurements, use the Practical Bench.
Parts
- LED red
- Resistor set
- Breadboard
- 5 V source
Steps
- Pick the LED forward voltage Vf from its datasheet.
- Calculate R for 10 mA.
- Pick the nearest standard value and build the circuit.
- Measure the actual current.
Safety: check polarity and power off before changing the circuit.
ESP32 code (Arduino IDE)
const int LED=2;
void setup(){ pinMode(LED,OUTPUT); }
void loop(){ digitalWrite(LED,HIGH); delay(500);
digitalWrite(LED,LOW); delay(500); }Viva questions
What happens with no resistor?
Current is limited only by the supply, and the LED burns out.
Why is Vf about 2 V for a red LED?
It is set by the semiconductor material, red LEDs use about 1.8 to 2.2 V.
ESP32 GPIO max current?
About 12 mA recommended, so use 220 ohm or more at 3.3 V.