The Smart Ethernet Tester diagnoses network cable integrity and connectivity status using an ESP32 microcontroller. It combines an OLED display for real-time feedback, a rotary encoder for user input, and an MCP23017 I/O expander to systematically test all eight conductors in an Ethernet cable across two RJ45 breakout jacks.
This guide provides a complete wiring diagram, parts list, and step-by-step assembly instructions to build a portable tester that checks for open circuits, shorts, and network link status. The included firmware handles cable scanning, Ethernet detection, and DHCP negotiation, displaying results on the small OLED screen.
Wiring diagram

Gather all the parts
Assemble it in 4 steps
1. Wire the screen and knob
With USB unplugged, connect OLED SDA to GPIO1 (data) and SCL to GPIO2 (clock). Connect encoder CLK to GPIO15, DT to GPIO16 and SW to GPIO17. Power both from 3V3 and GND. Match the Grove cable labels, not the wire colors.
2. Add the cable-checking chip
Place the MCP23017 across the breadboard gap. With the notch up, pin 1 is top left; count down the left side and then up the right. GPB0–7 are pins 1–8, VDD is 9, VSS is 10, SCL is 12, SDA is 13, A0–A2 are 15–17, RESET is 18 and GPA0–7 are 21–28. Connect according to the wiring diagram and put the 100 nF capacitor close to pins 9 and 10.
3. Label the two offline jacks
Connect each numbered terminal through its own 1 kΩ resistor as shown. Label both breakout jacks OFFLINE ONLY. Leave their shields unwired. Use the Waveshare board's own jack for live link and DHCP checks.
- Never connect either breakout jack to a router, switch, PoE source, or powered cable. The offline circuit is not protected against network power. Unplug both cable ends from equipment first.
4. Check with a known-good patch cable
Put both ends of a spare straight-through cable into the offline jacks. Turn the knob to Cable map, press to scan, and turn to see the numbered connections. Turning past either end of the map returns to Live port.
Review all connections
1. Connections between "oled" and "ESP32"
2. Connections between "knob" and "ESP32"
3. Connections between "io" and "ESP32"
4. Connections between "bypass" and "ESP32"
5. Connections between "r1" and "ESP32"
6. Connections between "b1" and "ESP32"
7. Connections between "r2" and "ESP32"
8. Connections between "b2" and "ESP32"
9. Connections between "r3" and "ESP32"
10. Connections between "b3" and "ESP32"
11. Connections between "r4" and "ESP32"
12. Connections between "b4" and "ESP32"
13. Connections between "r5" and "ESP32"
14. Connections between "b5" and "ESP32"
15. Connections between "r6" and "ESP32"
16. Connections between "b6" and "ESP32"
17. Connections between "r7" and "ESP32"
18. Connections between "b7" and "ESP32"
19. Connections between "r8" and "ESP32"
20. Connections between "b8" and "ESP32"
Deploy the firmware
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Ethernet.h>
#include <U8g2lib.h>
U8G2_SSD1306_64X48_ER_F_HW_I2C oled(U8G2_R0,U8X8_PIN_NONE,2,1);
uint8_t mac[6], mapRow[8];
bool cable=false, scanned=false, ioError=false, shorted=false, leased=false;
int row=0, ticks=0, prevAB;
uint32_t nextNet=0;
char net[3][17]={"Live port","Checking",""}, last[4][17];
bool reg(uint8_t r,uint8_t v){Wire.beginTransmission(0x20); Wire.write(r);Wire.write(v);return Wire.endTransmission()==0;}
int readReg(uint8_t r){Wire.beginTransmission(0x20);Wire.write(r);if(Wire.endTransmission(false)||Wire.requestFrom(0x20,1)!=1)return -1;return Wire.read();}
void scan(){
scanned=true;shorted=false;
ioError=!(reg(0,255)&®(1,255)&®(0x0c,255)&®(0x0d,255)&®(0x14,0)&®(0x15,0));
for(int bank=0;bank<2&&!ioError;bank++) for(int i=0;i<8;i++){
if(!reg(bank,255^(1<<i))){ioError=true;break;}
delay(4);int a=readReg(0x12+bank), b=readReg(0x13-bank);
bool released=reg(bank,255);
if(a<0||b<0||!released|| (a&(1<<i))){ioError=true;break;}
if((uint8_t)~a!=(1<<i))shorted=true;
if(!bank)mapRow[i]=(uint8_t)~b;
}
reg(0,255);reg(1,255);
}
void network(){
if(Ethernet.hardwareStatus()==EthernetNoHardware){strcpy(net[1],"No Ethernet");return;}
if(Ethernet.linkStatus()!=LinkON){leased=false;strcpy(net[1],"Link down");net[2][0]=0;return;}
if(!leased){leased=Ethernet.begin(mac,1500,500)==1;}
else {int r=Ethernet.maintain();if(r==1||r==3)leased=false;}
strcpy(net[1],leased?"Link + DHCP":"Link; no IP");net[2][0]=0;
if(leased){auto ip=Ethernet.localIP();snprintf(net[2],sizeof net[2],"%u.%u.%u.%u",ip[0],ip[1],ip[2],ip[3]);}
}
void draw(){
char s[4][17]={};
if(!cable){for(int i=0;i<3;i++)strcpy(s[i],net[i]);strcpy(s[3],"Turn: cable");}
else {
strcpy(s[0],"Cable map");strcpy(s[3],"Push: scan");
if(!scanned)strcpy(s[1],"Offline only");
else if(ioError)strcpy(s[1],"Wiring/I2C err");
else {
bool straight=true, open=false;for(int i=0;i<8;i++){straight &= mapRow[i]==(1<<i);open |= !mapRow[i];}
strcpy(s[1],shorted?"Short found":open?"Open wire":straight?"Straight OK":"Pins swapped");
snprintf(s[2],sizeof s[2],"%d> ",row+1);
if(!mapRow[row])strcat(s[2],"open");
for(int i=0;i<8;i++)if(mapRow[row]&(1<<i)){size_t n=strlen(s[2]);s[2][n]='1'+i;s[2][n+1]=0;}
}
}
if(memcmp(last,s,sizeof s)==0)return;memcpy(last,s,sizeof s);
oled.clearBuffer();oled.setFont(u8g2_font_4x6_tr);for(int i=0;i<4;i++)oled.drawStr(0,8+i*12,s[i]);oled.sendBuffer();
}
int ab(){return digitalRead(15)*2+digitalRead(16);}
void setup(){
pinMode(15,INPUT_PULLUP);pinMode(16,INPUT_PULLUP);pinMode(17,INPUT_PULLUP);prevAB=ab();
Wire.begin(1,2);oled.begin();draw();
uint64_t id=ESP.getEfuseMac();mac[0]=2;for(int i=1;i<6;i++)mac[i]=id>>(8*(i-1));
pinMode(14,OUTPUT);digitalWrite(14,HIGH);pinMode(9,OUTPUT);digitalWrite(9,LOW);delay(2);digitalWrite(9,HIGH);delay(10);
SPI.begin(13,12,11,14);Ethernet.init(14);Ethernet.begin(mac,IPAddress(0,0,0,0));
}
void loop(){
static const int8_t q[]={0,1,-1,0,-1,0,0,1,1,0,0,-1,0,-1,1,0};
int v=ab();ticks+=q[prevAB*4+v];prevAB=v;
if(abs(ticks)>=4){int d=ticks>0?1:-1;ticks=0;if(!cable){cable=true;row=d>0?0:7;}else{row+=d;if(row<0||row>7){cable=false;row=0;nextNet=0;}}}
static bool raw=HIGH, stable=HIGH;static uint32_t edge=0;bool b=digitalRead(17);
if(b!=raw){raw=b;edge=millis();}if(raw!=stable&&millis()-edge>25){stable=raw;if(!stable){if(cable)scan();else nextNet=0;}}
if(!cable&&(int32_t)(millis()-nextNet)>=0){network();nextNet=millis()+1500;}
draw();delay(1);
}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.




