This dual-channel resistance tester measures two independent resistive inputs and displays their values on an SSD1306 OLED screen. Channel 1 measures resistances from 1 to 200 ohms, while Channel 2 handles the 1k to 200k ohm range, making it useful for testing photoresistors, thermistors, and other variable resistors in maker projects.
The guide provides a complete parts list, wiring diagram showing how to connect the OLED display and build the two measurement channels using voltage dividers, and the Arduino firmware for the ESP32 that calculates resistance values and renders them with logarithmic gauge displays. Assembly takes about 30 minutes and requires only basic soldering skills.
Wiring diagram

Gather all the parts
Assemble it in 3 steps
1. Connect the OLED
With USB unplugged, connect the 0.96-inch SSD1306 OLED. VCC goes to 3V3, GND to GND, SDA (data) to GPIO0 and SCL (clock) to GPIO1. Follow the labels on your screen, not the order of the pins.
2. Build the R1 input
Connect one LDR leg to GND and the other to GPIO3. Connect a 150 Ω resistor from 3V3 to GPIO3, and a 100 nF capacitor from GPIO3 to GND.
- Only connect loose, unpowered parts to the test inputs.
3. Build the R2 input
Connect one LDR leg to GND and the other to GPIO4. Connect a 150 kΩ resistor from 3V3 to GPIO4, and a 100 nF capacitor from GPIO4 to GND.
- Only connect loose, unpowered parts to the test inputs.
Review all connections
1. Connections between "oled" and "ESP32"
2. Connections between "ldr1" and "ESP32"
3. Connections between "top1" and "ESP32"
4. Connections between "filter1" and "ESP32"
5. Connections between "ldr2" and "ESP32"
6. Connections between "top2" and "ESP32"
7. Connections between "filter2" and "ESP32"
Deploy the firmware
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <math.h>
#include <string.h>
constexpr int SDA_PIN=0, SCL_PIN=1, R1_PIN=3, R2_PIN=4;
// Measure 3V3 relative to GND under USB power; replace this default if needed.
constexpr float SUPPLY_MV=3300.0f;
Adafruit_SSD1306 oled(128,64,&Wire,-1);
struct Channel { float top, low, high; };
constexpr Channel r1={150,1,200};
constexpr Channel r2={150000,1000,200000};
float resistance(float adc, const Channel &c) {
if(adc>=SUPPLY_MV) return INFINITY;
return c.top*adc/(SUPPLY_MV-adc);
}
struct Gauge { char text[12]; int tick; };
Gauge gauge(float ohms, const Channel &c, bool kilo) {
Gauge g={};
float f=logf(constrain(ohms,c.low,c.high)/c.low)/logf(c.high/c.low);
g.tick=lroundf(f*24);
const char *unit=kilo?"k":"";
const char *prefix=ohms<c.low?"<":ohms>c.high?">":"";
const float value=constrain(ohms,c.low,c.high)/(kilo?1000.0f:1.0f);
snprintf(g.text,sizeof(g.text),value<10?"%s%.2f%s":"%s%.1f%s",prefix,value,unit);
return g;
}
void centered(int x,int y,const char *s) {
oled.setCursor(x-int(strlen(s))*3,y); oled.print(s);
}
void draw(int x,const char *name,const Gauge &g) {
int px=x-27, py=41;
for(int i=1;i<=24;++i){
const float a=PI*(24-i)/24;
int nx=x+lroundf(27*cosf(a)),ny=41-lroundf(27*sinf(a));
oled.drawLine(px,py,nx,ny,SSD1306_WHITE); px=nx;py=ny;
}
const float a=PI*(24-g.tick)/24;
oled.drawLine(x,41,x+lroundf(23*cosf(a)),41-lroundf(23*sinf(a)),SSD1306_WHITE);
centered(x,1,name); centered(x,46,g.text); centered(x,56,"ohms");
}
void setup(){
analogReadResolution(12);
analogSetPinAttenuation(R1_PIN,ADC_11db);
analogSetPinAttenuation(R2_PIN,ADC_11db);
Wire.begin(SDA_PIN,SCL_PIN);
if(!oled.begin(SSD1306_SWITCHCAPVCC,0x3C,true,false)) while(true) delay(1000);
oled.setTextColor(SSD1306_WHITE);
oled.setTextWrap(false);
}
void loop(){
unsigned long a=0,b=0;
for(int i=0;i<64;++i){
analogReadMilliVolts(R1_PIN); a+=analogReadMilliVolts(R1_PIN);
analogReadMilliVolts(R2_PIN); b+=analogReadMilliVolts(R2_PIN);
delayMicroseconds(350);
}
const Gauge g1=gauge(resistance(a/64.0f,r1),r1,false);
const Gauge g2=gauge(resistance(b/64.0f,r2),r2,true);
static Gauge old1={},old2={};
if(g1.tick!=old1.tick || g2.tick!=old2.tick || strcmp(g1.text,old1.text) || strcmp(g2.text,old2.text)){
oled.clearDisplay(); draw(31,"R1",g1); draw(96,"R2",g2); oled.display();
old1=g1; old2=g2;
}
delay(130);
}Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.




