Projects / LED and Zener tester

LED and Zener tester

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANOLM317

    Build the current source

    LM317 OUT to the 100 Ω resistor, the resistor's other end to ADJ. The current is 1.25 V / 100 Ω, about 12.5 mA.

  2. NANO

    Add the divider

    Test node to A0 through 10 kΩ, and from A0 to GND through another 10 kΩ.

  3. NANO

    Add the test sockets

    Two breadboard rows or crocodile clips for the part: positive at the ADJ node, negative at GND.

  4. NANO13.8 mASSD1306

    Wire the Nano and display

    Power the Nano from VIN and the OLED on A4 and A5.

  5. NANO

    Check with nothing connected

    Display shows No part.

  6. NANO

    Test an LED

    Long leg to the test node, short leg to GND. Note the voltage.

  7. NANO

    Test a zener

    Cathode (stripe) to the test node. The display shows its zener voltage.

In short

How do you build an LED and Zener tester?

A constant-current source shows LED colour, forward voltage and zener voltage on a display. You need Arduino Nano, LM317 adjustable regulator, Resistor 100 Ω, Resistor 10 kΩ × 2, SSD1306 OLED Display, 12 V 2 A DC adapter, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
12 V adapter +LM317 IN and Nano VINSupply
12 V adapter -Nano GNDCommon ground
LM317 OUT100 Ω resistor, then to the ADJ pinSets about 12.5 mA (1.25 V divided by 100 Ω)
ADJ pin (test node)Part under test + side, and 10 kΩ divider topLED anode or zener cathode here
Part under test other sideGNDLED cathode or zener anode here
10 kΩ + 10 kΩ dividerTest node to A0 to GNDHalves the voltage for the ADC
OLED SDA and SCLNano A4 and A5Display

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "Adafruit SSD1306" and "Adafruit GFX Library". The LM317 needs about 3 V of headroom, so the tester reads up to about 8 V, which covers LEDs and most zeners up to 6 to 7 V. The guesses are rough because colour ranges overlap.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 oled(128, 64, &Wire, -1);

float readVolts() {
  long sum = 0;
  for (byte i = 0; i < 32; i++) sum += analogRead(A0);
  return (sum / 32.0) * 5.0 / 1023.0 * 2.0;      // divider of two equal resistors
}

const char *guess(float v) {
  if (v < 1.1)  return "Diode or short";
  if (v < 1.5)  return "Infrared LED";
  if (v < 2.1)  return "Red LED";
  if (v < 2.5)  return "Yellow / green";
  if (v < 3.6)  return "Blue / white";
  return "Zener or other";
}

void setup() {
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  oled.setTextColor(SSD1306_WHITE);
}

void loop() {
  float v = readVolts();
  oled.clearDisplay();
  oled.setTextSize(1); oled.setCursor(0, 0); oled.print("Test current 12.5 mA");
  if (v > 8.0) {                                  // nothing connected: the source climbs to its limit
    oled.setTextSize(2); oled.setCursor(0, 24); oled.print("No part");
  } else {
    oled.setTextSize(3); oled.setCursor(0, 16); oled.print(v, 2); oled.setTextSize(2); oled.print(" V");
    oled.setTextSize(1); oled.setCursor(0, 50); oled.print(guess(v));
  }
  oled.display();
  delay(300);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Red LEDAbout 1.8 to 2.1 V
White LEDAbout 2.8 to 3.4 V
1N4148 diodeAbout 0.6 to 0.7 V
Zener 5.1 VAbout 4.8 to 5.3 V depending on the part

If it does not work

Always shows No part

The LED is backwards or the test node is not connected to A0.

LM317 gets warm

It drops most of 12 V at 12.5 mA, so it dissipates little, but check the resistor value.

Readings jump

Use short leads and the 32-sample average. A noisy 12 V adapter can also shift readings, so add 100 nF across Nano 5V and GND.

Zener above 8 V reads No part

The source runs out of headroom. Use a higher supply for those parts.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the LED and Zener tester?

Arduino Nano, LM317 adjustable regulator, Resistor 100 Ω, Resistor 10 kΩ × 2, SSD1306 OLED Display, 12 V 2 A DC adapter, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the LED and Zener tester take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the LED and Zener tester works?

Red LED: About 1.8 to 2.1 V. White LED: About 2.8 to 3.4 V. 1N4148 diode: About 0.6 to 0.7 V.

Always shows No part: what should I check?

The LED is backwards or the test node is not connected to A0.

LM317 gets warm: what should I check?

It drops most of 12 V at 12.5 mA, so it dissipates little, but check the resistor value.

Readings jump: what should I check?

Use short leads and the 32-sample average. A noisy 12 V adapter can also shift readings, so add 100 nF across Nano 5V and GND.

Zener above 8 V reads No part: what should I check?

The source runs out of headroom. Use a higher supply for those parts.