Build it step by step
0 of 8 doneWire the jig
D8 to node N1, A1 to N1, A0 to node N2.
Add a resistor
10k from N1 to N2.
Add a diode
Anode at N2, banded end to GND.
Upload
Open the serial monitor.
Type 10000
Read the low current result.
Swap to 1k then 330
Type each value and note the lines.
Swap the diode
Repeat for all three diodes.
Plot
Voltage against current for each diode.
How do you build a three diodes compared?
Measure the forward voltage of three common diodes at different currents and print the results as a table. You need Arduino Nano, Signal Diode 1N4148, 1N4001 rectifier diode, 1N5408 rectifier diode (3 A), Resistor 10 kΩ, Resistor 1 kΩ, Resistor 330 Ω, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points. It takes 8 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 9
Parts list
- Development BoardsBuyArduino Nano × 1
- SemiconductorsBuy
- SemiconductorsBuy
- SemiconductorsBuy
- PassivesBuyResistor 10 kΩ × 1
- PassivesBuyResistor 1 kΩ × 1
- PassivesBuyResistor 330 Ω × 1
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Nano D8 | Breadboard node N1 | Drive pin, held high |
| Nano A1 | Node N1 | Reads the voltage before the resistor |
| Test resistor (10k, 1k or 330 ohm, swapped by hand) | N1 to node N2 | Sets the current |
| Nano A0 | Node N2 | Reads the voltage on the diode |
| Diode anode | Node N2 | Diode under test |
| Diode cathode (banded end) | Nano GND | Return |
Code
A diode drops a voltage when it conducts, and that forward voltage is not one fixed number: it creeps up as the current rises, and it depends on the type of diode and its temperature. This lab shows that with a Nano. One pin drives a test resistor in series with the diode, and two analog inputs measure the voltage before the resistor and across the diode, so the current is found from the voltage across the resistor divided by its value, which is more accurate than assuming the pin voltage. Use three resistors, 10 kilohm, 1 kilohm and 330 ohm, to get roughly 0.4, 4 and 13 milliamps, and test three diodes: a small 1N4148 signal diode and two rectifier diodes, the 1N4001 and the big 1N5408. Type the resistor value into the serial monitor and the sketch prints the diode voltage and current. Expect roughly 0.5 to 0.6 volts at the lowest current and about 0.65 to 0.8 volts at 13 milliamps, with differences between diodes. Warm a diode with your fingers and its voltage falls by about 2 millivolts per degree, which is how diodes can be used as temperature sensors. The test current stays below the 20 milliamp pin limit of the Nano and the sketch switches the drive off between readings.
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).
// Diode forward voltage lab: swap the resistor (10k, 1k, 330) and the diode, press Enter in the serial monitor to read.
const int DRIVE = 8, V_DIODE = A0, V_DRIVE = A1;
const float VCC = 5.0; // measure your Nano 5V pin and enter it here
float resistor = 1000.0;
float avg(int pin) {
long s = 0;
for (int i = 0; i < 64; i++) s += analogRead(pin);
return (s / 64.0) * VCC / 1023.0;
}
void setup() {
pinMode(DRIVE, OUTPUT);
digitalWrite(DRIVE, LOW);
Serial.begin(9600);
Serial.println("Type the resistor value in ohms (10000, 1000 or 330), then press Enter.");
}
void loop() {
if (Serial.available()) {
long r = Serial.parseInt();
while (Serial.available()) Serial.read();
if (r > 0) resistor = r;
digitalWrite(DRIVE, HIGH);
delay(300); // let the diode settle
float vd = avg(V_DIODE);
float vn1 = avg(V_DRIVE);
digitalWrite(DRIVE, LOW); // switch the current off between tests
float current = (vn1 - vd) / resistor * 1000.0; // milliamps
Serial.print("R = "); Serial.print(resistor, 0);
Serial.print(" ohm Vd = "); Serial.print(vd, 3);
Serial.print(" V I = "); Serial.print(current, 2);
Serial.println(" mA");
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Type the resistor value in ohms (10000, 1000 or 330), then press Enter.
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| 1N4148 at about 0.4 mA | About 0.5 to 0.6 V |
| 1N4148 at about 13 mA | About 0.7 to 0.8 V |
| 1N4001 at 4 mA | About 0.6 to 0.7 V |
| 1N5408 at 13 mA | About 0.6 to 0.8 V |
| Warm the diode | Voltage falls slightly |
If it does not work
Vd near 4.5 V
The diode is reversed, swap it.
Current reads negative
Check A0 and A1 are on the right nodes.
Readings vary
Keep wires short and measure the real VCC.
No output
Check the serial monitor ends lines with newline.
Pin warm
Use at least 330 ohm and switch the drive off between tests.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the three diodes compared?
Arduino Nano, Signal Diode 1N4148, 1N4001 rectifier diode, 1N5408 rectifier diode (3 A), Resistor 10 kΩ, Resistor 1 kΩ, Resistor 330 Ω, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points.
How long does the three diodes compared take to build?
About 90 minutes for a beginner maker, in 8 steps.
How do I know the three diodes compared works?
1N4148 at about 0.4 mA: About 0.5 to 0.6 V. 1N4148 at about 13 mA: About 0.7 to 0.8 V. 1N4001 at 4 mA: About 0.6 to 0.7 V.
Vd near 4.5 V: what should I check?
The diode is reversed, swap it.
Current reads negative: what should I check?
Check A0 and A1 are on the right nodes.
Readings vary: what should I check?
Keep wires short and measure the real VCC.
No output: what should I check?
Check the serial monitor ends lines with newline.
