led resistor
led_resistorCalculates the current-limiting resistor for driving one or more LEDs in series from a DC supply. Computes the exact resistance from R = (Vsupply - n*Vf) / I, then selects the nearest E24 standard resistor value. Reports the actual current with the standard resistor, power dissipation, and voltage across the resistor. Supports series LED strings by specifying led_count. Validates that supply voltage exceeds total forward voltage. Chain from ohms_law for power budgeting or into trace_width for PCB layout.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| led_count | No | Number of LEDs in series. Defaults to 1. | |
| led_forward_v | No | LED forward voltage in volts (V). Defaults to 2.0V (typical red LED). | |
| led_current_ma | No | Desired LED current in milliamps (mA). Defaults to 20mA. | |
| supply_voltage_v | Yes | Supply voltage in volts (V). Must be positive. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resistance_ohm | Yes | Exact calculated resistance in ohms. | |
| nearest_e24_ohm | Yes | Nearest standard E24 series resistor value in ohms. | |
| actual_current_ma | Yes | Actual LED current in milliamps (mA) when using the nearest E24 resistor. | |
| power_dissipation_mw | Yes | Power dissipated by the resistor in milliwatts (mW), using the E24 value. | |
| voltage_across_resistor_v | Yes | Voltage drop across the current-limiting resistor in volts. |