Build it step by step
0 of 7 doneBuild 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.
Add the divider
Test node to A0 through 10 kΩ, and from A0 to GND through another 10 kΩ.
Add the test sockets
Two breadboard rows or crocodile clips for the part: positive at the ADJ node, negative at GND.
Wire the Nano and display
Power the Nano from VIN and the OLED on A4 and A5.
Check with nothing connected
Display shows No part.
Test an LED
Long leg to the test node, short leg to GND. Note the voltage.
Test a zener
Cathode (stripe) to the test node. The display shows its zener voltage.
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
- Development BoardsBuyArduino Nano × 1
- PowerBuy
- PassivesBuyResistor 100 Ω × 1
- PassivesBuyResistor 10 kΩ × 2
- DisplaysBuy
- PowerBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 12 V adapter + | LM317 IN and Nano VIN | Supply |
| 12 V adapter - | Nano GND | Common ground |
| LM317 OUT | 100 Ω resistor, then to the ADJ pin | Sets about 12.5 mA (1.25 V divided by 100 Ω) |
| ADJ pin (test node) | Part under test + side, and 10 kΩ divider top | LED anode or zener cathode here |
| Part under test other side | GND | LED cathode or zener anode here |
| 10 kΩ + 10 kΩ divider | Test node to A0 to GND | Halves the voltage for the ADC |
| OLED SDA and SCL | Nano A4 and A5 | Display |
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.
| Check | Expected |
|---|---|
| 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 |
| Zener 5.1 V | About 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 →
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.
