Cable Tester

Hi Guys, I am trying to make a cable tester (each cable has 4 wires). Basically, I am looking for continuity

test, also if there is any short circuit/open circuit. An LED to indicate the status of each wire would be

great. Based on that I can pass or fail the cable. I have tried

couple of techniques already discussed on the forum but unfortunately they have cost me 2 Arduino UNO

boards. I think with my basic knowledge, I haven't been able to implement them correctly. Can anyone

please guide me through the process with circuit diagram and a piece of code. Thanks in advance.

Is it a problem to connect both ends to the same arduino? If not, just do that and check each wire by making it high with the rest as input (with pull down) and check to see only the corresponding other end goes high. Done :)

Do you need to identify the wires, or are they already colour-coded?

Thanks for your response guys.

@septillion:

Connecting to the same Arduino is not a problem. Are you suggesting:

Digital Output Pin------------wire under test--------Dig. Input-----10k pull down....GND?

Would this kind of arrangement not have adverse effect on the board in case of a short circuit?

@MarkT

I am not too fussed about identifying the wires. However, if its something I can implement easily, that

would be great.

Thanks.

Hi.

Digital Output Pin------------wire under test--------Dig. Input-----10k pull down....GND?

Would this kind of arrangement not have adverse effect on the board in case of a short circuit?

Try.

Digital Output Pin----Series 1K Resistor-------wire under test--------Dig. Input-----10k pull down....GND?

The series 1K will limit any current due to shorts to ground yet not drop any significant voltage when small current flowing to Input, may need to increase 10K to 22K to GND at Input. Tom... :)

I was thinking for the remote end connecting the ends via resistors and then probing the resistance between pairs at the sending end to identify which is which - shorts and open-circuits would be obvious.

Simply doing something like

A -- 1k -- B -- 2k -- C -- 4k -- D

So if two wires show as about 6k that means they are B and D:

The six possible parings give unique values, so it ought to be possible to map out the difference in ordering at the two ends easily.

So at the sending end you need to drive each wire via something like a 1k resistor from one pin and sense its voltage directly with another, analog pin.

Select two outputs to drive (OUTPUT), one high, one low, read their analog pins and determine the resistance, repeat for multiple pairings.

Thanks Tom for your response. Seems quite easy to implement. Do you mean the arrangement as shown

in the attached figure?

!(http://C:\Users\muhammad.usama\Desktop\fig.png)

MarkT, I haven’t been quite able to follow your idea, (please excuse my lack of knowledge). May be able to

understand it better with a bit of code.

Thanks.

technophile: Would this kind of arrangement not have adverse effect on the board in case of a short circuit?

Not as long as you just test one wire at a time. Then there is only one output HIGH and the rest is connected to GND via a resistor. No direct path to GND. But adding a series resistor like TomGeorge suggested doesn't hurt.

technophile: Thanks Tom for your response. Seems quite easy to implement. Do you mean the arrangement as shown

in the attached figure?

![](http://C:\Users\muhammad.usama\Desktop\fig.png\)

MarkT, I haven't been quite able to follow your idea, (please excuse my lack of knowledge). May be able to

understand it better with a bit of code.

Thanks.

No, not that, 4 digital pins driving via 1k resistors, 4 analog pins sensing voltage:

Digital pin ---- 1k ---- Analog pin ------ wire1 Digital pin ---- 1k ---- Analog pin ------ wire2 Digital pin ---- 1k ---- Analog pin ------ wire3 Digital pin ---- 1k ---- Analog pin ------ wire4

Then at the remote end:

wireA -- 1k -- wireB -- 2k -- wireC -- 4k -- wireD

You probe a pair of wires at a time (the other digital pins set to pinMode INPUT), and measure the voltage due to the resistor(s) at the other end to measure the resistance. That tells you about the correspondance of wires at one end (which I call 1,2,3,4) to the wires at the remote end (labelled A,B,C,D). And you can see any open-circuits or shorts.

Thanks @Septillion for your response. I have written a piece of code, can you please confirm this is the

sort of arrangement you were referring to:

int Out = 3;
int In1 = 4;
int In2 = 4;
int In3 = 5;


void setup() {


pinMode(Out, OUTPUT);
pinMode(In1, INPUT);
pinMode(In2, INPUT);
pinMode(In3, INPUT);
Serial.begin(9600);

}

void loop() {

digitalWrite(Out, HIGH);
 if (digitalRead(In1)==HIGH){
  Serial.print("wire 1 passed");
 }
 else{
  Serial.print("wire 1 failed"); 
    }
    
 if (digitalRead(In2)==HIGH){
  Serial.print("wire 2 passed");
 }    
 else{
  Serial.print("wire 2  failed"); 
    }
    
 if (digitalRead(In3)==HIGH){
  Serial.print("wire 3 passed");
 }   
 else{
  Serial.print("wire 3 failed"); 
    }


}

MarkT, Thanks for the explanation. I will give it a go and get back to you.

Regards

That will not work… With only one output, how do you test for shorts?

And watch your indentation. And when you number variables, arrays, always arrays.

const byte OutPins[] = {3, 4, 5, 6};
const byte InPins[] = {7, 8, 9, 10};

void setup() {
  Serial.begin(9600);
}

void loop() {
  bool passAll = true;
  for(byte i = 0; i < sizeof(OutPins); i++){
    byte passWire = true;
    
    pinMode(i, OUTPUT);
    digitalWrite(i, HIGH);
    
    for(byte j = 0; j < sizeof(InPins); j++){
      if(digitalRead(j) != (j == i)){
        passWire = false;
        passAll = false;
        
        Serial.print(F("FAIL! Wire "));
        Serial.print(i);
        if(j == i){
          Serial.println(F(" unconnected!"));
        }
        else{
          Serial.print(F(" shorted with wire "));
          Serial.print(j);
          Serial.println('!');
        }
      }
    }
    
    if(passWire){
      Serial.print(F("PASS! Wire "));
      Serial.print(i);
      Serial.println(F(" connected correct."));
    }
    
    digitalWrite(i, LOW);
    pinMode(i, INPUT);
  }
  
  if(passAll){
    Serial.println(F("Total wire is correct!"));
  }
  
  delay(2000); // better use millis....
}

@steptillion Thanks for your help, i'll try that and post the results as soon as possible. Kind Regards.