Topics

► Games

► Sound & Music

► Watches & Clocks

► GPS

► Power Supplies

► Computers

► Graphics

► Thermometers

► Wearables

► Test Equipment

► Tutorials

► Libraries

► PCB-Based Projects

By processor

AVR ATtiny

► ATtiny10

► ATtiny2313

► ATtiny84

► ATtiny841

► ATtiny85

► ATtiny861

► ATtiny88

AVR ATmega

► ATmega328

► ATmega1284

AVR 0, 1, and 2-series

► ATmega1608

► ATmega4808

► ATmega4809

► ATtiny1604

► ATtiny1614

► ATtiny202

► ATtiny3216

► ATtiny3224

► ATtiny3227

► ATtiny402

► ATtiny404

► ATtiny414

► ATtiny814

AVR DA/DB-series

► AVR128DA28

► AVR128DA32

► AVR128DA48

► AVR128DB28

ARM

► ATSAMD21

► RP2040

► RA4M1

About me

  • About me
  • Twitter
  • Mastodon

Feeds

RSS feed

LED Probe

20th May 2025

This is a simple LED tester that provides a convenient way of testing most types of through-hole or surface-mount LEDs:

LEDProbeATtiny85.jpg

The LED Probe tests a wide range of LEDs in a single operation, and automatically shows their polarity.

I built two versions of the LED Probe, one based on an ATtiny85, and another based on the more recent 0‑Series ATtiny202, to compare how they performed.

Introduction

You may wonder why one might want a dedicated LED tester. After all, most multimeters have an LED function, or even if you don't have such a multimeter, all you need is a battery and a resistor.

However, for another project I recently had to test a large number of LEDs, both to check that they were working, and to determine their polarity, and I found using a multimeter quite annoying because 50% of the time you have to swap the leads and try again, which makes the process more time-consuming.

These are the features I wanted in an ideal LED tester:

  • Small and portable.
  • Doesn't draw current when you're not using it, so no need for an on/off switch.
  • Lights up the test LED irrespective of which way round the test leads are, so you can tell that it's working and what colour it is.
  • Tells you the LED's polarity.
  • Tells you whether the test LED is working even if you can't see it light up, such as for infra-red LEDs.

This LED Probe meets all these requirements in a low-cost convenient tool.

Using the LED Probe

To test an LED you touch the probe to one side of the LED, and the flying lead to the other side.

Irrespective of its orientation the LED will light up, and the state of the LED is shown by a bi-colour red/green LED at the top of the probe:

Indicator State Meaning
Off Open circuit Leads not connected or open-circuit LED.
Red+Green (Yellow) Short circuit Leads touching or shorted LED.
Red Probe positive Probe is on the LED + (anode).
Green Probe negative Probe is on the LED – (cathode).
Flashing Error Error; not an LED.

Sleep

The LED Probe automatically goes to sleep after not being used for 60 seconds; touch the flying lead to the probe to wake it up before testing an LED. The current consumption is less than 0.2µA in sleep.

How it works

The LED Probe connects a voltage across the LED being tested through a current-limiting resistor, and swaps the polarity of this voltage every 10 milliseconds. This ensures that the LED will light up, irrespective of its polarity. The polarity changes at 100Hz, which is faster than the persistence of vision, so the LED will appear to glow steadily.

For each polarity of the voltage, the LED tester measures the voltage drop across the current-limiting resistor, using an analogue input on the ATtiny85/ATtiny202:

LEDTesterStates.gif

How the LED Probe tests an LED in either of the two polarities.

The diagram on the left shows the state in which the probe is at +3V and the flying lead is at 0V. If the LED lights up in this "Probe positive" state, the analogue input will measure the LED's forward voltage: typically 1V for an infra-red LED, 1.8V for a red LED, 2.6V for a blue or white LED, and 2.9V for an ultra-violet LED. Otherwise the LED isn't conducting, and the analogue input will be at 3V.

The diagram on the right shows the state in which the probe is at 0V and the flying lead is at +3V. If the LED lights up in this "Probe negative" state the analogue input will measure 3V minus the LED's forward voltage; this will be between 2V and 0.1V. Otherwise the LED isn't conducting, and the analogue input will be at 0V.

With these two readings, v1 and v2, it's possible to distinguish between the four possible states of the test LED: open circuit, short circuit, probe to LED +, or probe to LED –, as shown in the following diagram:

LEDProbeStateDiagram.gif

The four possible states of an LED, and the corresponding voltages on the analogue input for
each of the two readings v1 and v2 (axes not to scale).

Compatibility

I've tested the LED Probe with a wide range of LEDs, including infra-red, red, yellow, green, blue, white, and ultra-violet.

It may not work with novelty LEDs, such as flashing, flickering, or colour-changing LEDs. It may also not give consistent readings with LEDs in a circuit.

The circuit

ATtiny85 version

Here's the circuit of the ATtiny85 version of the LED Probe:

LEDProbeATtiny85.gif

Circuit of the ATtiny85 version of the LED Probe.

This version will also work with an ATtiny25V or ATtiny45V. I recommend the V versions because they are rated down to 1.8V.

ATtiny202 version

Here's the circuit of the ATtiny202 version of the LED Probe:

LEDProbeATtiny202.gif

Circuit of the ATtiny202 version of the LED Probe.

This version will also work with an ATtiny402, ATtiny212, or ATtiny412.

Polarity indicator

I used a surface-mount 1205 bi-colour red/green LED for the polarity indicator [1]. The PCB will alternatively accommodate two separate surface-mount red and green LEDs if you have difficulty sourcing a bi-colour LED.

Battery

The circuit is designed to work with a CR2032 coin cell; this has a capacity of 225mAh, a maximum discharge current of 3mA, and a maximum pulse discharge current of 15mA.

Note: don't choose the apparently similar BR2032, which has a different carbon-monofluoride lithium chemistry, and is only suitable for lower-current applications.

Here's the full parts list (click to expand):

► Parts list

Construction

I built a prototype on a mini breadboard using through-hole components to test out the circuit:

LEDProbeBreadboard.jpg

The initial prototype of the LED Probe built on a mini breadboard.

For the final versions I designed two boards in Eagle and sent them to JLCPCB for fabrication.

The ATtiny85 or ATtiny202 is in an SOIC package, and the resistors and LED are 0805 SMT components, so it should be possible to solder them by hand. I used a Miniware MHP50-B5 50x50mm hotplate [2] [3] set to 235°C to solder the components after applying dots of Chip Quik SMD291AX10T3 solder paste to the pads with a pin:

HotplateTiny.jpg

Soldering the LED Probe surface-mount components using a Miniware MHP50-B5 hotplate.

Battery holder

The battery is fitted in a surface-mount CR2032 battery holder. Note that, because of the dangers of swallowing a coin cell battery, if children might have access to the LED probe please glue or solder in the battery so it can't be removed.

Probe

For the probe I used an ordinary dressmaking pin, the point blunted with a file.

Flying lead

For the flying lead I used flexible silicone wire [4] terminated in a crimped header pin, but you could use a ready-made lead.

ATtiny202 version

Here's the ATtiny202 version of the LED Probe:

LEDProbeATtiny202.jpg

The ATtiny202 version of the LED Probe for testing LEDs.

The program

There are two separate versions of the program, one for the ATtiny85, and one for the ATtiny202, although they are largely identical:

Target voltages

Four constants define the ADC values for each of the key target voltages defined in the state diagram shown earlier:

// Target ADC values
const int Max  = 1007;                     // 2.95V
const int High =  768;                     // 2.25V
const int Low =   256;                     // 0.75V
const int Min =    17;                     // 0.05V

The main loop

The main loop then repeatedly reads the two ADC values, v1 and v2, for the two possible polarities of the test LED:

    // Probe positive
    digitalWrite(Lead, LOW);
    digitalWrite(Output, HIGH);
    delay(10);
    v1 = analogRead(Input);
    
    // Probe negative
    digitalWrite(Lead, HIGH);
    digitalWrite(Output, LOW);
    delay(10);
    v2 = analogRead(Input);

Note that on the ATtiny85, depending on which version of Spence Konde's ATTinyCore you're using, you may not be able to call analogRead() with the digital pin number. To avoid problems I refer to the ADC using the symbol A1 rather than the digital pin symbol Input

Depending on the two voltages v1 and v2 the program then sets the bicolour LED to show one of five possible states:

    if (v1 > Max && v2 < Min) {
      digitalWrite(RedLED, LOW); digitalWrite(GreenLED, LOW);     // Open circuit
    } else if (v1 < Low && v2 > High) {
      digitalWrite(RedLED, HIGH); digitalWrite(GreenLED, HIGH);   // Short circuit
      Time = millis();
    } else if (v1 > Low && v1 < Max && v2 < Min) {
      digitalWrite(RedLED, HIGH); digitalWrite(GreenLED, LOW);    // Probe to LED +
      Time = millis();
    } else if (v1 > Max && v2 > Min && v2 < High) {
      digitalWrite(RedLED, LOW); digitalWrite(GreenLED, HIGH);    // Probe to LED -
      Time = millis();
    } else {
      int state = (Flash & 0b1000) ? HIGH : LOW;
      digitalWrite(RedLED, state); digitalWrite(GreenLED, state); // Error
    }
    Flash++;

Sleep

After one minute without any input on the ADC the program puts the processor to sleep to reduce the power consumption. This involves the following steps:

  • The ADC is turned off on the ATtiny85 to reduce power consumption. This isn't necessary on the ATtiny202.
  • The interrupt on the probe Input pin is enabled. On the ATtiny85 I used the external interrupt INT0, and on the ATtiny202 I used a low level sense interrupt on PA6.
  • The Output pin is taken high, to hold the probe at 3V through the 1kΩ resistor, and the Lead output is taken low.
  • The program calls sleep_enable() and sleep_cpu() to put the processor to sleep.

Touching the flying lead onto the probe takes the Input pin low, generating an interrupt that wakes up the processor.

On the ATtiny85 the interrupt service routine doesn't need to do anything, as executing it automatically clears the interrupt flag:

ISR (INT0_vect) {
}

On the ATtiny202 you have to explicitly clear the interrupt flag:

ISR(PORTA_PORT_vect) {
  PORTA.INTFLAGS = PORT_INT6_bm;
} 

This is one of the key differences between the two processors, and forgetting to do this will prevent the processor from staying asleep.

Execution continues after the sleep_cpu() call, and the program performs the following steps:

  • The interrupt on the probe Input pin is disabled.
  • The global variable Time is set to the current time in milliseconds, millis(), to reset the countdown timer.

Power consumption

The approximate current consumption in each state is as follows:

State ATtiny202 ATtiny85
Open circuit 0.7mA 1.0mA
Short circuit 5.0mA 5.2mA
Probe to LED + 2.5mA 2.7mA
Probe to LED – 1.6mA 1.8mA
Error 1.8mA 2.0mA
Sleep 0.03µA 0.06µA

The ATtiny202 slightly improves over the earlier ATtiny85 in every case.

Compiling and uploading

ATtiny85 version

Compile the program using Spence Konde's ATTiny Core [5]. Select the ATtiny 25/45/85 (No bootloader) option under the ATtinyCore heading on the Boards menu. Check that the subsequent options are set as follows (ignore any other options):

Chip: "ATtiny85"
Clock Source (Only set on bootload): "1 MHz (internal)"

I connected to the ATtiny85 using a clip that fitted to the top of the chip [6], using the Sparkfun Tiny AVR Programmer [7]. Then proceed as follows:

  • Choose Burn Bootloader to set the clock speed.
  • Then choose Upload from the Arduino IDE Tools menu to upload the program.

ATtiny202 version

Compile the program using Spence Konde's megaTinyCore [8]. Choose the ATtiny412/402/212/202 option as appropriate under the megaTinyCore heading on the Board menu. Check that the subsequent options are set as follows (ignore any other options):

Chip: "ATtiny202"
Clock: "1 MHz internal"
Reset pin function: "Input (no output, ever)" 

To program the processor the recommended option is to use a 5V or 3.3V USB to Serial board, such as the SparkFun FTDI Basic board [9], or a USB to Serial cable [10], connected with a Schottky diode as follows. You can substitute a 4.7kΩ resistor for the Schottky diode:

SerialUPDIProgSchottky.gif

Connect the +5V, GND, and UPDI pins to the three pin terminals on the bottom edge of the LED Probe. I held three pins in contact with the terminals to avoid the need to permanently solder a header to the board. If there's a coin cell fitted to the board leave the +5V lead unconnected. Then proceed as follows:

  • Set Programmer to "SerialUPDI - 230400 baud".
  • Select the USB port corresponding to the USB to Serial board in the Port menu.
  • Choose Upload from the Arduino IDE Tools menu to upload the program.

Resources

Here's the ATtiny85 version of the LED Probe program: LED Probe (ATtiny85 Version).

and here's the ATtiny202 version of the LED Probe program: LED Probe (ATtiny202 Version).

Get the Eagle or Gerber files for the PCBs on GitHub here: https://github.com/technoblogy/led-probe.

Or order boards from OSH Park here: LED Probe (ATtiny85 version) or LED Probe (ATtiny202 version).


  1. ^ Wurth 156125RG73000P on RS-Online.
  2. ^ MHP50-B5 on Adafruit.
  3. ^ MHP50-B5 on AliExpress.
  4. ^ Silicone Cover Stranded-Core Wire - 26AWG Black on The Pi Hut.
  5. ^ ATTinyCore on GitHub.
  6. ^ IC test Clip - SOIC 8-pin on SparkFun.
  7. ^ Tiny AVR Programmer on Sparkfun.
  8. ^ megaTinyCore on GitHub.
  9. ^ SparkFun FTDI Basic Breakout - 5V on Sparkfun.
  10. ^ FTDI Serial TTL-232 USB Cable on Adafruit.

blog comments powered by Disqus