A fitter in Witbank (eMalahleni) is building a status panel for a conveyor: an Uno drives a few LEDs from its 5 V pins, and the rest hang off the plant's 24 V supply. Each needs a series resistor, and guessing gives a dim LED, a dead one or a hot resistor. This calculator works the value out and picks the standard part. The board itself is on Arduino Uno.
What the resistor has to drop
An LED holds roughly its forward voltage across itself, whatever the supply. The resistor takes the rest and sets the current: resistance = (supply less the LED voltages) / current. The forward voltage depends on colour: about 2.0 V for red, 2.1 V for yellow, 2.2 V for older yellow green, around 3.0 to 3.1 V for bright green, blue and white, and 1.3 V for infrared. Those are typical figures; the LED's datasheet gives the real range at your current.
Worked example: one red LED on a 5 V pin
The starting figures are a 5 V pin, one red LED at a typical 2.0 V and 10 mA:
| Figure | Result |
|---|---|
| Across the resistor | 3 V |
| Exact resistor | 300 Ω |
| Next E12 value | 330 Ω, giving 9.09 mA |
| Next E24 value | 300 Ω, giving 10 mA |
| Resistor power | 30 mW |
| LED power | 20 mW |
A 1/8 W resistor already has double the margin, and the common 1/4 W part is fine.
The 24 V side of the panel
The table under the calculator runs the same LED on other supplies. At 3.3 V it needs 130 Ω, 150 Ω in E12. At 12 V it is 1 kΩ and 100 mW. At 24 V it is 2.2 kΩ and 220 mW: too close to a 1/4 W rating, so the calculator suggests 1/2 W. LEDs in series can share one resistor if their forward voltages add up to well under the supply; LEDs side by side each need their own.
Pin limits and when to use a transistor
20 mA is a common maximum for 5 mm indicator LEDs, and 5 to 10 mA is often bright enough indoors. A microcontroller pin has its own limit, per pin and for the whole chip, and the datasheet gives both. For bright LEDs, many LEDs or anything over about 20 mA, let the pin switch a transistor or MOSFET and let the supply carry the current.
Frequently asked questions
What resistor do I need for an LED on 5 V?
For a red LED at 10 mA, (5 less 2.0) / 0.010 = 300 Ω, so 330 Ω from the E12 series. A blue or white LED at about 3.1 V needs 190 Ω, so 220 Ω. Check the LED's datasheet for its forward voltage and rated current.
Can I connect an LED without a resistor?
Not to a voltage source. Nothing limits the current, so the LED, the pin or both can fail. Boards with a built in LED already have its resistor, and LED modules and strips usually do too; a bare LED always needs one or a constant current driver.
Why is my blue LED dim on a 3.3 V board?
A blue or white LED needs about 3.1 V, which leaves only 0.2 V for the resistor on a 3.3 V pin. The current then swings with every small change in voltage. Power the LED from 5 V and switch it with a transistor from the 3.3 V pin.
Who will quote me for LEDs, resistors or a panel build in Witbank (eMalahleni)?
Electronics shops, component distributors and builders of small control panels who work in and around Witbank. Send the request on this page with the parts or the job; we pass it on and they quote you directly. We sell, build and program nothing ourselves.
Read more
More tools
- Resistor colour codeFour, five or six colour bands, or a value, tolerance and band count: the resistance, its tolerance range, the bands in order and the nearest E12 and E24 values
- Voltage divider calculatorInput voltage and two resistors, or the highest input and a safe output: the output voltage, ratio, current, power in each resistor, an E24 pair and the ADC step at the input
- Battery life calculatorBattery capacity, usable share, awake and sleep currents, awake time and wakes per hour, and an optional solar panel: average current, hours, days and whether the panel keeps up
- Stepper motor calculatorStep angle, microstepping, belt and pulley or lead screw, speed and motor current: steps per mm, resolution, step rate, rpm and the driver's reference voltage
- PCB trace width calculatorCurrent, copper weight, temperature rise, layer and trace length: the minimum width in mm and mil, the trace's resistance, voltage drop and power lost
- Board pickerLogic voltage, pins, analogue inputs, radio, camera, Linux, battery and the kind of job: a short list of three board families with a reason for each
- PLC I/O calculatorField devices, spare capacity and module sizes: digital and analogue I/O counts with spare, the modules to fit and the points left free
