Lesson 24: Choose the resistor
How bright, how safe?
- An LED with no resistor takes far too much current and burns out. The resistor sets the current.
- A bigger resistor means a smaller current and a dimmer LED. A smaller resistor means more current and a brighter LED.
- In this lesson the code is ready. Your job is to build the circuit and choose the resistors, like an electronics engineer.
Words for this lesson
| Word | Meaning |
|---|---|
| current | how much electricity flows, in mA (milliamps) |
| resistor | a part that lets less current through; measured in Ω (ohms) |
| in parallel | side by side, each on its own path |
| mA | milliamp: 1 mA = 0.001 A |
The formula
I = (5 V − 2 V) ÷ R
- The pin gives 5 V. The LED takes about 2 V. The other 3 V push the current through the resistor.
- The bench shows the real current next to D9. It is a little lower than the formula, because the pin and the LED have some resistance too.
| Resistor | Formula | Bench | One LED |
|---|---|---|---|
| 220 Ω | 13.6 mA | 12.2 mA | bright |
| 330 Ω | 9.1 mA | 8.5 mA | soft |
| 470 Ω | 6.4 mA | 6.1 mA | soft |
| 1000 Ω | 3.0 mA | 2.9 mA | dim |
LEDs in parallel
- Each LED gets its own resistor and its own path to GND.
- The pin gives the sum of the currents: three branches of 8.5 mA need about 23 mA from one pin.
- An Arduino pin must stay under 40 mA. Above that the bench warns you, and a real board can break.
| Three branches of | Pin gives | OK? |
|---|---|---|
| 220 Ω | 32.7 mA | under 40, but more than this task allows |
| 330 Ω | 23.4 mA | yes |
| 470 Ω | 17.1 mA | yes |
| 1000 Ω | 8.5 mA | too dim: under 5 mA per LED |
الصعوبة 3/5 · 200 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
A TV has a small standby light that should glow softly: 5 to 10 mA. The sketch is ready. Build the circuit from D9 through a resistor and an LED to GND (the GND line is along the top row), and choose the resistor so the current is right. The bench shows the current next to D9.
اضغط تشغيل لرؤية المخرجات هنا.
الصعوبة 4/5 · 280 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Now three LEDs, all from D9, side by side (in parallel). Each LED needs its own resistor. The pin may give at most 40 mA in total, and each LED should still get at least 5 mA: so the total must be 15 to 30 mA. Build it and choose the resistors.
اضغط تشغيل لرؤية المخرجات هنا.