LED Current Regulator Schematic

This page describes the schematic for lighting a variety of LEDs as part of an LED test tool with LCD display. This circuit is very similar to the original LM317 constant current schematic, but with additional components to support measurement. You should read that page to understand how the basic circuit works and to learn the current range formula.

LED Tester current regulator schematic

LED Tester current regulator schematic

The enhanced circuit now includes:

SW1: Power switch. One thing I loved about the original LED tester is that it didn’t need to be turned on or off; the LED completed the circuit. Without the LED, no current flowed. With some thought, I might be able to come up with a transistor switch to power up the microcontroller when an LED is placed on the pads. In the meantime, a simple switch prevents the battery from draining when the tool is not in use.

D1, C1, VR1, R2, R1: These components are identical to the original LED tester. See that page for details.

LED Test Pads: The test pads are now closer to each other than in the previous design. This makes it easier for small surface-mount LEDs to bridge the gap. The original test pads scratched pretty heavily over time, but not so much that they stopped working. I anticipate the same outcome for the new tester. In particular, the nice gold plating won’t last long.

LED test pads worn from ten years of use

LED test pads worn from ten years of use

Exposed pads like this are potentially hazardous to the circuitry. What happens when an LED lead, tweezers, or needle-nose pliers shorts across the pad? Well, not much. Remember, this is a current-limited circuit. Ultimately, 20 mA will flow across R6 (47 ohms), which will dissipate a lame 18 mW. The TO-92 package will dissipate the remainder (162 mW), which is below the TO-92 maximum heat dissipation (600 mW).

Now we get to some new interesting bits...

R4, R5: A fresh 9V battery measures 9.6V. Subtract 1.5 V drop for the LM317L at room temperature delivering low current. This means that the top LED test pad could be as high as 8.1V. That’s too much for a 5V microcontroller. This pair of 10 kilohm resistors divides the voltage in half, allowing the microcontroller to safely measure the voltage on the top of the test pad. (The microcontroller simply doubles the measured value in its calculations to determine the actual voltage.)

R6: A 47 ohm resistor immediately beneath the low LED test pad provides three pieces of information:

  1. If the voltage is zero, then there isn’t an LED connected.
  2. Subtracting the high pad voltage from the low pad voltage gives the voltage drop of the LED.
  3. Calculating the low voltage over a fixed 47 ohm resistance determines the current. For example, 0.94 volts ÷ 47 ohms = 20 milliamps.

C4, C6: These 0.1 microfarad capacitors steady the voltages on the test pads for measurement.

Split Circuit

But, where’s the microcontroller and display?

The thing I like most about this test tool is that the current limiting and LED lighting is independent of the measurement and display. Even if there is a bug in the microcontroller code, the LED is lit and safe.

Only four wires are shared with the microcontroller-side of the circuit:

Let’s see how the microcontroller uses those connections.