An LED on 5 V, with a multimeter on it, on an Arduino Uno
The first circuit, a 220 ohm resistor and a red LED on the Uno’s 5 V pin, with a multimeter in series reading the current. Change the resistor, switch the dial, and read amps, volts and ohms. The whole build, an Arduino Uno and 3 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner About 15 minutes to build and run. Runs in your browser. Free, and no account needed.
The parts retail for about $30. On Mokxi they're free.
What you'll learn
- Measuring current with a multimeter in series
- Ohm's law with a real LED
- Why an LED needs a resistor
- Measuring voltage across a part
- Difficulty: Beginner
- Time: About 15 minutes
- Board: Arduino Uno R3
- Parts: 4
How it works
This is the first circuit: 5V from the Uno goes through a multimeter, a 220 ohm resistor and a red LED to ground. The meter is wired in the path so all of the LED's current flows through it. There is nothing for the sketch to do, since the Uno is only a 5V supply here.
The meter should read about 14 mA. A red LED drops about 1.9 V, so the resistor gets the other 3.1 V. Ohm's law says 3.1 V divided by 220 ohms is about 14 mA. Try a 1k or 10k resistor and the current falls.
Parts list
4 parts, plus the jumper wires and a bench instrument. The parts retail for about $30; on Mokxi they're free, and so are the instruments.
- 1 × Arduino Uno R3In Starter Kit, Claw Machine Kit, Vending Machine Kit.
- 1 × Half breadboard
- 1 × Resistor, 220 ΩIn Starter Kit, Claw Machine Kit, Halloween Prop Kit.
- 1 × LED, redIn Starter Kit, Halloween Prop Kit, Logic Lab Kit.
- 1 × Multimeter
Kits that can build it
This starter kit has every part in the circuit. Each kit's page lists what else it can build.
Wiring table
Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.
| Part and pin | Connects to |
|---|---|
| LED, red pin C | Arduino Uno R3 pin GND |
| Multimeter pin A | Arduino Uno R3 pin 5V |
| Multimeter pin COM | Resistor, 220 Ω pin 1 |
| LED, red pin A | Resistor, 220 Ω pin 2 |
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// An LED on the 5 V pin, and a multimeter to see what it is doing.
//
// 5V -> the meter's A jack; the meter's COM -> 220 ohm resistor
// the resistor -> the LED's long leg (anode); the short leg (cathode) -> GND
//
// To measure a current the meter has to be part of the circuit, so all of
// the LED's current flows through it. It reads about 14 mA: a red LED takes
// about 1.9 V of the 5 V, the resistor the other 3.1 V, and Ohm's law says
// 3.1 V / 220 ohm is 14 mA.
//
// Things to try on the canvas, as the lessons do with a real meter:
// - give the resistor 1k or 10k and watch the current fall
// - turn the dial to V and move the leads across the LED or the resistor
// - stop the simulation and use the ohms range on the resistor
//
// There is no code to run: the Uno is only a 5 V supply here.
void setup() {
Serial.begin(9600);
Serial.println("Mokxi Uno: an LED on 5 V, with a multimeter reading its current");
Serial.println("Change the resistor and watch the meter");
}
void loop() {
}
Code walkthrough
The key functions of the sketch, and what each one does.
setup sketch.ino
Starts serial at 9600 and prints two lines about the circuit. That is all it does. The LED is powered straight from the 5V pin, so it lights without any code.
void setup() {
Serial.begin(9600);
Serial.println("Mokxi Uno: an LED on 5 V, with a multimeter reading its current");
Serial.println("Change the resistor and watch the meter");
}Troubleshooting
The usual mistakes with this circuit, and the fix for each.
- The meter reads nothing and the LED is off This project
To measure current, the meter must be in the circuit, between 5V and the resistor. Check the A and COM jacks. - The LED is dark This project
Check its direction: the longer leg (anode) goes toward the resistor and the shorter leg to GND. - The LED is dim, burns out, or the pin reads wrong because the resistor value is off. Resistor
Read the color bands again. A 220 ohm to 330 ohm resistor suits a typical LED on 5 V. 10k is a common pull-up or pull-down value. Check with a multimeter if unsure. - A pull-up or pull-down resistor is missing, so the input floats and reads random values. Resistor
Tie the input to 5 V or ground through about 10k. Or use INPUT_PULLUP and wire the switch to ground. - The LED does not light, or it lights once and then dies. LED
LEDs have polarity. The longer leg (anode) goes toward the positive side. Always add a series resistor, about 220 ohms to 1 k ohm on a 5 V pin. - A blue or white LED stays dark on 3.3 V. LED
Blue and white LEDs drop about 3 V, so 3.3 V leaves almost nothing for the resistor. Use a 5 V supply, or a smaller resistor and a red or green LED. - The reading is zero, negative or nonsense when measuring voltage. Multimeter
Set the dial to volts first, then touch the probes across the part, in parallel. Red goes to the more positive point. A negative number just means the probes are swapped. - Measuring current gives zero or blows the meter's fuse. Multimeter
Current must flow through the meter, so break the circuit and put the meter in series. Never put an amps setting straight across a supply. Start with the highest current range.
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.