Build it step by step
0 of 7 doneBuild the divider
One reference and a clip lead.
Read a known resistor
Compare with the meter.
Add the second and third ranges
Switch pins to inputs.
Choose the best range
Reading in the middle.
Snap to E24
Nearest standard value.
Show the colours
Two digits and a multiplier.
Test twenty resistors
Check against the colour code.
How do you build a resistor value reader?
Clip a resistor in and an Arduino measures it and shows the nearest standard value and colour bands. You need Arduino Nano, Resistor 1 kΩ, Resistor 10 kΩ, Resistor 100 kΩ, SSD1306 OLED Display and Crocodile clip test leads (10 pack). It takes 7 steps and about 90 minutes.
- Level
- Intermediate
- Time
- About 90 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Nano × 1
- PassivesBuyResistor 1 kΩ × 1
- PassivesBuyResistor 10 kΩ × 1
- PassivesBuyResistor 100 kΩ × 1
- DisplaysBuy
- Connectors
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Reference 1 kΩ | Nano D2 to the test node | Range one |
| Reference 10 kΩ | Nano D3 to the test node | Range two |
| Reference 100 kΩ | Nano D4 to the test node | Range three |
| Test node | Nano A0 and the unknown resistor's clip | Measurement point |
| Unknown resistor other clip | Nano GND | Return |
| OLED SDA, SCL, VCC, GND | Nano A4, A5, 5V, GND | Display |
Code
A Nano pin set to HIGH is a 5 V source, so one reference resistor to the test node and the unknown one to ground make a voltage divider; the reading says what the ratio is, and the unknown value is the reference times the reading over 1023 minus the reading. A single reference is only accurate near its own value, so the sketch tries the 1 kΩ, then 10 kΩ, then 100 kΩ range, switching the others off by making their pins inputs, and uses the first range that puts the reading between 15 and 85 percent. The result snaps to the nearest standard E24 value and shows the first two colour bands plus the multiplier for a four-band resistor, in colour names. Accuracy depends on the reference resistors; with 1 percent parts, expect about 2 to 3 percent overall, so use it to sort and identify and not for precision. Never connect it to a resistor that is part of a powered circuit. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
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).
// Resistor reader: three reference resistors form a divider with the unknown one. Library: U8g2 (text-only U8x8). Board: Arduino Nano.
#include <U8x8lib.h>
U8X8_SSD1306_128X64_NONAME_HW_I2C oled(U8X8_PIN_NONE);
const int PINS[3] = {2, 3, 4};
const float REF[3] = {1000.0, 10000.0, 100000.0};
const float E24[24] = {1.0,1.1,1.2,1.3,1.5,1.6,1.8,2.0,2.2,2.4,2.7,3.0,3.3,3.6,3.9,4.3,4.7,5.1,5.6,6.2,6.8,7.5,8.2,9.1};
const char* COL[10] = {"Blk","Brn","Red","Org","Yel","Grn","Blu","Vio","Gry","Wht"};
float measure() {
for (int i = 0; i < 3; i++) {
for (int k = 0; k < 3; k++) pinMode(PINS[k], INPUT); // all references off (high impedance)
pinMode(PINS[i], OUTPUT); digitalWrite(PINS[i], HIGH);
delay(5);
long a = 0; for (int s = 0; s < 16; s++) a += analogRead(A0);
a /= 16;
if (a > 150 && a < 870) return REF[i] * a / (1023.0 - a); // this range is accurate: use it
}
return -1;
}
void setup() {
oled.begin(); oled.setFont(u8x8_font_chroma48medium8_r);
}
void loop() {
float r = measure();
oled.clear();
if (r < 0) { oled.drawString(0, 0, "No resistor"); delay(500); return; }
float mag = pow(10, floor(log10(r)));
float m = r / mag, best = E24[0]; int bi = 0;
for (int i = 0; i < 24; i++) if (fabs(E24[i] - m) < fabs(best - m)) { best = E24[i]; bi = i; }
int d1 = (int)(best), d2 = (int)(best * 10 + 0.5) % 10;
int mult = (int)(log10(mag) + 0.5) - 1; // 4-band: two digits then a multiplier
char line[17];
dtostrf(r, 1, 0, line);
oled.drawString(0, 0, "Measured ohms:"); oled.drawString(0, 1, line);
oled.drawString(0, 3, "Nearest E24:");
dtostrf(best * mag, 1, 0, line); oled.drawString(0, 4, line);
oled.drawString(0, 6, COL[d1]); oled.drawString(4, 6, COL[d2]);
oled.drawString(8, 6, mult >= 0 && mult <= 9 ? COL[mult] : "---");
delay(800);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| 1 kΩ resistor | Reads about 1000 and brown, black, red |
| 4.7 kΩ | Yellow, violet, red |
| Nothing clipped | Shows "No resistor" |
| Sorting | Matches the markings within about 3 percent |
If it does not work
Value wrong
Check which pin goes to which reference.
Jumpy
Add 100 nF from A0 to ground and average more.
Colours off by a band
Check the multiplier calculation.
No display
Check the OLED wiring and address.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the resistor value reader?
Arduino Nano, Resistor 1 kΩ, Resistor 10 kΩ, Resistor 100 kΩ, SSD1306 OLED Display and Crocodile clip test leads (10 pack).
How long does the resistor value reader take to build?
About 90 minutes for a intermediate maker, in 7 steps.
How do I know the resistor value reader works?
1 kΩ resistor: Reads about 1000 and brown, black, red. 4.7 kΩ: Yellow, violet, red. Nothing clipped: Shows "No resistor".
Value wrong: what should I check?
Check which pin goes to which reference.
Jumpy: what should I check?
Add 100 nF from A0 to ground and average more.
Colours off by a band: what should I check?
Check the multiplier calculation.
No display: what should I check?
Check the OLED wiring and address.
