
Get full C++ & Python code + lifetime access
⚡ Smart Resistor Meter on ESP32
Stop squinting at tiny colour bands. Let the ESP32 do the math.
Every electronics hobbyist has a drawer full of loose resistors and no idea which is which. Reading colour bands under a desk lamp is slow and easy to get wrong. In this project, we turn an ESP32 and a 1.8" TFT display into a smart resistor meter. Clip any resistor between two probes and it instantly shows the exact value, draws the colour bands on screen, and tells you the nearest standard resistor value.
It's a perfect project for learning how real measuring instruments work: voltage dividers, ADC readings, auto-ranging, calibration and colour graphics, all built on a single breadboard.
✨ Features Instant resistance reading: shows the value with 4 significant digits, like 10.19 kΩ or 327.4 Ω. Auto-ranging: three reference resistors cover about 30 Ω to 800 kΩ, and the ESP32 picks the most accurate range on its own. Live colour bands: the screen draws a resistor with its 4 colour bands, so you can match it to the one in your hand. Standard value matching: finds the nearest E24 standard value and shows how far off your resistor is in %. Tolerance check: the deviation line turns green within ±5% and orange outside it. Band names in words: shows the colours as text too, like Brown-Black-Orange-Gold. Open and short detection: shows OPEN when nothing is connected and a warning when the probes are shorted. One-time calibration: type one command in the Serial Monitor with a known resistor, and the meter corrects itself. Saved calibration: your calibration is stored in the ESP32's flash memory, so it survives power-off. Flicker-free display: the screen only redraws when the value actually changes. One-side wiring: everything connects to a single header row of the ESP32, so it fits on a small breadboard. 🧰 Components Required Component Quantity Notes ESP32 NodeMCU (ESP-32S, 38-pin) 1 Any ESP32-WROOM-32 dev board works 1.8" TFT Display (ST7735, SPI, 128×160) 1 The common red module with 8 pins 1 kΩ Resistor 1 Reference for the low range (1% metal film is best) 2 kΩ Resistor 1 Reference for the middle range 87 kΩ Resistor 1 Reference for the high range (any 47 kΩ – 220 kΩ works) Breadboard 1 Full or half size Jumper Wires ~15 Female-to-male for the display Probe Leads 2 Jumper wires or crocodile clips USB Cable 1 Must be a data cable, not charge-only Multimeter (optional) 1 Only needed once, for calibration 🔌 Pin Connections Component Component Pin ESP32 Pin TFT Display VCC 3V3 TFT Display LED 3V3 TFT Display RESET 3V3 TFT Display GND GND TFT Display CS GPIO 26 TFT Display A0 / DC GPIO 27 TFT Display SCK GPIO 14 TFT Display SDA GPIO 13 1 kΩ Resistor One leg GPIO 32 (other leg → Node) 2 kΩ Resistor One leg GPIO 33 (other leg → Node) 87 kΩ Resistor One leg GPIO 25 (other leg → Node) Node — GPIO 34 Probe A — Node Probe B — GND
Leave these pins empty: EN, SVP, SVN, GPIO 35 and GPIO 12.
📐 Wiring Diagram ESP32 NodeMCU (one side) ┌───────────────────┐ │ │ │ 3V3 ●──────────┼────┬──────────────► TFT VCC │ │ ├──────────────► TFT LED │ │ └──────────────► TFT RESET │ │ │ GPIO34 ●──────────┼──────────┐ │ │ │ │ GPIO32 ●──[ 1kΩ ]─┼──────────┤ │ GPIO33 ●──[ 2kΩ ]─┼──────────┤ NODE │ GPIO25 ●──[ 87kΩ]─┼──────────┤ │ │ │ │ │ └───────────► Probe A │ │ │ GPIO26 ●──────────┼───────────────────► TFT CS │ GPIO27 ●──────────┼───────────────────► TFT A0 / DC │ GPIO14 ●──────────┼───────────────────► TFT SCK │ GPIO13 ●──────────┼───────────────────► TFT SDA │ │ │ GND ●──────────┼────┬──────────────► TFT GND │ │ └──────────────► Probe B │ │ └───────────────────┘
┌───────────────────┐ Probe A
│ 1.8" TFT │ │
│ ┌─────────────┐ │ ┌───┴───┐
│ │ 10.19 kΩ │ │ │ Rx │ ← resistor
│ │ ▌▌▌ ▌ │ │ │unknown│ to measure
│ └─────────────┘ │ └───┬───┘
│ │ │
│ LED SCK SDA A0 RESET CS GND VCC Probe B
└──┬───┬───┬──┬───┬───┬───┬───┬┘ │
3V3 G14 G13 G27 3V3 G26 GND 3V3 GND
Node tip: the "node" is just one empty row on the breadboard. The three resistor legs, the GPIO 34 wire and Probe A all plug into that same row. When you're done, that row should have exactly 5 things in it.
🛠️ Step-by-Step Build Guide Step 1: Place the ESP32 on the breadboard
The 38-pin board is wide, so place it so the side labelled 3V3, EN, SVP, SVN, 34, 35, 32, 33, 25, 26, 27, 14, 12, GND, 13 has free holes next to it. Everything in this project uses only that side.
Step 2: Connect the display
Use female-to-male jumpers so the display doesn't need any breadboard space.
VCC, LED and RESET → 3V3 GND → GND CS → GPIO 26 A0 / DC → GPIO 27 SCK → GPIO 14 SDA → GPIO 13 Step 3: Make the node row
Pick an empty breadboard row past the end of the ESP32 (for example, row 40). Run a jumper from GPIO 34 into that row.
Step 4: Add the reference resistors
Each resistor has one leg in its own empty row and the other leg in the node row:
1 kΩ: free leg wired to GPIO 32 2 kΩ: free leg wired to GPIO 33 87 kΩ: free leg wired to GPIO 25
Resistors have no polarity, so either leg can go either way.
Step 5: Add the probes Probe A: one end in the node row, the other end free Probe B: one end in GND, the other end free Step 6: Double-check everything
Before plugging in USB, check every wire against the pin table. Most problems come from a single wire in the wrong hole.
💻 Software Setup
Go to Sketch → Include Library → Manage Libraries and install:
Adafruit ST7735 and ST7789 Library Adafruit GFX Library (if asked to install dependencies, click Install All)
The Preferences library used for saving calibration comes with the ESP32 package, so there's nothing extra to install.
Out of the box, readings can be 5–12% low. A one-minute calibration fixes that.
Measure a resistor with a multimeter and note its real value, for example 327 Ω. Open Serial Monitor at 115200 baud and set the line ending to Newline. Put the resistor between Probe A and Probe B. Type cal 327 and press Enter. The meter prints the old and new reading and saves the correction to flash.
Each range is calibrated separately, so use one known resistor per range:
Range Calibrate with a resistor of 1 kΩ About 100 Ω – 3 kΩ 2 kΩ About 1 kΩ – 6 kΩ 87 kΩ About 20 kΩ – 500 kΩ
The bottom line of the display shows which range a resistor is using.
Serial commands:
Command What It Does cal <ohms> Calibrate the current range using a known resistor show Print the current calibration values reset Clear calibration and go back to the defaults 📏 How to Use Power the ESP32 over USB. The screen shows RESISTOR OHMMETER at the top. With nothing connected, the value box shows OPEN in red. Clip a resistor between Probe A and Probe B. Read the value in the big green box, for example 10.19 kΩ. Check the colour bands drawn above it against the resistor in your hand. Look at the E24 line: green means your resistor is within ±5% of its standard value. Swap in the next resistor. The reading updates about 4 times per second. ⚙️ How It Works The voltage divider
The meter is built on a voltage divider: a known resistor on top, the unknown resistor below, and the ESP32 reads the voltage in the middle. When a GPIO pin goes HIGH (about 3.3 V), the voltage at the node depends only on the ratio of the two resistors:
Vout = Vdrive × Rx / (Rref + Rx)
The ESP32 measures Vout on GPIO 34, then solves the formula for the unknown resistor:
Rx = Rref × Vout / (Vdrive − Vout) Why three ranges?
One reference resistor is only accurate near its own value. Measure a 330 kΩ resistor against a 1 kΩ reference and the node sits at almost 3.3 V, where a tiny ADC error becomes a huge resistance error. So the meter uses three references on three pins and switches between them.
Pin Reference Best For GPIO 32 1 kΩ About 30 Ω – 3 kΩ GPIO 33 2 kΩ About 1 kΩ – 6 kΩ GPIO 25 87 kΩ About 3 kΩ – 800 kΩ Auto-ranging
Every reading, the ESP32 does the same steps:
Disconnects all reference pins by setting them to INPUT (high impedance). Drives one pin HIGH at maximum drive strength and waits 5 ms for the voltage to settle. Takes 64 ADC samples, sorts them, and averages only the middle 32 to throw away noise spikes. Rejects bad readings below 150 mV or above 3000 mV, where the ESP32 ADC is unreliable. Repeats for the other two ranges. Keeps the best range, the one whose voltage is closest to half of 3.3 V, where the divider is most precise. Colour code decoding
The meter rounds the reading to the nearest E24 standard value (the 24 values used for 5% resistors). The first two digits become the first two bands, the power of ten becomes the multiplier band, and the fourth band is drawn gold for ±5%.
Calibration
The formula assumes the GPIO pin is a perfect 3.30 V source. In reality the pin has a little internal resistance, the 3V3 rail is rarely exactly 3.30 V, and the ADC has a small error. The cal command measures a resistor you already know and works backwards to the true effective reference value, which absorbs all three errors at once. That value is saved with the Preferences library, so it only needs to be done once.
⚠️ Common Beginner Mistakes (and How to Fix Them)
There are a few versions of the ST7735 module. Change INITR_BLACKTAB in the code to INITR_GREENTAB or INITR_REDTAB and upload again.
Change DISPLAY_ROTATION from 3 to 1 at the top of the code.
You haven't calibrated yet. This is the most common issue. Follow the Calibrate It section above. Uploading the code alone doesn't fix it.
The Serial Monitor line ending must be set to Newline. With "No line ending", the ESP32 never knows you finished typing.
Something is connected to GPIO 12. It's a strapping pin, and pulling it high at power-up stops the ESP32 from starting. Keep it empty.
That may be correct. A normal resistor has ±5% tolerance, so a 330 Ω resistor can really be anywhere from 314 Ω to 346 Ω. Check it with a multimeter before blaming the meter.
Other components connected in parallel change the reading. Always measure resistors out of circuit. Never touch the probes to a powered circuit: it can damage the ESP32's ADC pin.
Calibration is stored in flash memory, so re-uploading the code doesn't clear it. Type reset in the Serial Monitor to go back to the defaults.
All settings are at the top of the code, so there's no need to dig through the logic.
Setting What It Does Default DISPLAY_ROTATION Screen orientation (1 or 3 for landscape) 3 REF_DEFAULT Starting values of the three reference resistors {1000, 2000, 87000} RANGE_PIN GPIO pins that drive each reference resistor {32, 33, 25} NUM_RANGES Number of reference resistors fitted 3 V_DRIVE_MV Drive voltage in millivolts 3300 SAMPLES ADC samples per reading (more = smoother, slower) 64 V_LOW_MV Lowest voltage accepted as a valid reading 150 V_HIGH_MV Highest voltage accepted as a valid reading 3000 SETTLE_MS Wait time after switching ranges 5 LOOP_MS Time between readings 250 Using different reference resistors
Don't have a 2 kΩ or 87 kΩ? Use what you have. Put the values in REF_DEFAULT from smallest to largest, then calibrate each range. Adding a 10 kΩ reference gives the best accuracy in the 3–10 kΩ zone.
🔧 Troubleshooting Quick Reference Problem Most Likely Cause Fix White or blank screen SCK/SDA swapped or CS/DC wrong Recheck the display wiring Garbage on one edge Wrong ST7735 variant Try INITR_GREENTAB or INITR_REDTAB Screen upside down Rotation setting Change DISPLAY_ROTATION to 1 Readings 5–12% low Not calibrated Run cal <ohms> with a known resistor Always shows OPEN Node not connected to GPIO 34 Check the node row has all 5 wires Reading jumps around Loose contact or noise Use clips, add a 10 nF capacitor cal does nothing Wrong Serial line ending Set line ending to Newline Board won't boot Something on GPIO 12 Keep GPIO 12 empty Upload stuck Charge-only cable or no boot mode Change cable, hold BOOT 🚀 Ideas to Take It Further Make it portable: add a small LiPo battery and a TP4056 charging module to turn it into a pocket tester. 3D-printed case: design a handheld enclosure with the display on top and two probe sockets. Measure capacitors: time how long a capacitor takes to charge through a reference resistor. Continuity beeper: add a buzzer that beeps when the resistance is below 50 Ω. Wi-Fi readout: use the ESP32's Wi-Fi to show readings on your phone through a web page. Resistor sorter: log every reading over Serial and sort your resistor drawer in minutes. Custom PCB: move the whole circuit off the breadboard onto a compact board. 📚 What You'll Learn How a voltage divider works and how to solve it for an unknown value Reading analog voltages with the ESP32's ADC How auto-ranging works in real multimeters Filtering noisy readings with sorting and averaging Calibrating a sensor against a known reference Drawing colour graphics on an SPI TFT display Decoding the resistor colour code and E24 standard values Saving data permanently with flash memory