Ethernet (LAN RJ45) cable tester with Arduino

In this article you can find instruction on how to make a simple ethernet cable tester driven by an Arduino.

I was inspired by this page that simply and clearly describes how to make a tester for ethernet cables (straight or cross) with a master and a slave unit, so to be able to test also cable already in place.

I did nothing more than following the instructions and writing few lines of code for Arduino.


What you need:

  • eight LED
  • eight resistor (I’ve used 33 ohm resistors)
  • two ethernet plug (female)
  • a switch (to be able to test straight and cross cables)
  • and, obviously, wires and two small pieces of board

We need to build to separate small boards:

  • a master board, that will be inserted into the Arduino and that will be plugged into one side of the ethernet cable that we need to test
  • a slave board, that will be plugged into the other side of the ethernet cable that we need to test

This is the circuit:


The process implemented with the software is very simple:

  • Arduino set an HIGH value (5 V) on each wire of the cable for one second (and then reset a LOW value) one wire after the other
  • If everything is ok, you should see LEDs on the slave unit turning on one after the other for one second each
  • If there is some broken wire, the corresponding LED will not turn on
  • If there is some inverted wire in the cable, you will see the LEDs turning on not in a sequential order
  • The switch tells Arduino the type of cable under test (straight or cross)

This is the software:

//#define VERBOSE

char straight[8] = {2, 3, 4, 5, 6, 7, 8, 9};
char cross[8] = {4, 7, 2, 5, 6, 3, 8, 9};

void setup() {
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(12, INPUT); // Straight (normal) cable or cross cable
  pinMode(13, OUTPUT); // Control LED
#ifdef VERBOSE

void loop() {
  if (digitalRead(12) == LOW) { // Cross cable
#ifdef VERBOSE
    Serial.println("Cross cable");
    for (char n = 0;n < 8;n++) {
#ifdef VERBOSE
      Serial.print(n+1, DEC);
      Serial.print(": line ");
      Serial.print(cross[n]-1, DEC);
      Serial.print(" (pin ");
      Serial.print(cross[n], DEC);
      PulseOut(cross[n], 1000);
      PulseOut(13, 50);
  } else { // Straight (normal) cable
#ifdef VERBOSE
    Serial.println("Straight cable");
    for (char n = 0;n < 8;n++) {
 #ifdef VERBOSE
      Serial.print(n+1, DEC);
      Serial.print(": line ");
      Serial.print(straight[n]-1, DEC);
      Serial.print(" (pin ");
      Serial.print(straight[n], DEC);
      PulseOut(straight[n], 1000);
      PulseOut(13, 50);

void PulseOut(char pin, int ms)
  digitalWrite(pin, HIGH);
  digitalWrite(pin, LOW);

The final result

These are the two separate boards of the tester (the master is the one connected to the Arduino):

And these are videos showing the cable tester at work. While testing a straight cable:

While testing a cross cable (when I change the switch):

9 thoughts on “Ethernet (LAN RJ45) cable tester with Arduino

  1. How are you doing this without grounding the LED?

    I have tried this project a few time and failed. I even tried bypassing the RJ45 connectors and wire the slave directly to the arduino by just connecting the blue lines in the schematic above.

  2. hi there, what if one of the cable is broken?
    the tester not work for the broken cable, if one cable broken, we don’t know which one is broken. cause the wiring, take the ground from one cable, and positive from one cable.

    btw, nice idea…

  3. What is needed to make this better than one of those cheap chinese RJ45 testers is to detect crosstalk and identify cables that are not T568 – wrongly wired cables work mostly on short lengths but I’ve seen a 50′ cable fail that had good crimping but wrong coloured wires. If you can build an EMF detector with an arduino you ought to be able to sense crostalk, no?

  4. Pingback: Arduino Ethernet Cable Tester - Arduino collector blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s