how to detect short/open network cable?

Thread Starter

speed1

Joined Mar 9, 2012
16
Hi all,
I'm working for a graduation project as a computer Engineer.
My project is to make a LCD network cable tester, I have done with the simple simulation to test the cable wither it is OK or not.

the project construct of two parts:

first (main part): micro controller PIC16F877 with LCD & RJ-45 socket
second: a RJ-45 socket

the idea is to send data from PIC to first cable (pin0) and receive it throw (pin1).

But the problem is how to detect the fault (short/open) if it does on the LCD?

Thank you all
Haridi
 

BillO

Joined Nov 24, 2008
999
I'm a little surprised at your request. If you have made it to the point where you are about to graduate as an engineer, I am in disbelief that you cannot at least make an attempt at this. This is not that tough, especially for someone that should be educated enough to be called an engineer.

Can you at least take a stab at it and post your best guess here so we can help you with the details?

On the other hand, send me $10,000 and I'll write your final project for you.:D
 

Thread Starter

speed1

Joined Mar 9, 2012
16
I'm a little surprised at your request. If you have made it to the point where you are about to graduate as an engineer, I am in disbelief that you cannot at least make an attempt at this. This is not that tough, especially for someone that should be educated enough to be called an engineer.

Can you at least take a stab at it and post your best guess here so we can help you with the details?

On the other hand, send me $10,000 and I'll write your final project for you.:D
Thank you BillO :D no I will not pay you 10000 $ :p

this what i have done :)



Now with this I can check the cable if it is ok or not, but I don't know if there is a problem in the cable or not

the design is work like you are sending '1' throw pin0 and the socket must connect next wire, so micro controller must receive '1' throw pin1 if the cable is working properly, but if there is a short circuit between wire 1 & 2 it also will receive the same value and this seems the cable is ok for micro controller but in fact it is a short circuit.

NOTE: in the simulation I use a 8 - LINE connector because i did not found the RJ-45 socket.
 

BillO

Joined Nov 24, 2008
999
Okay, I'll work cheaper.

It actually seems like you have the right idea.

Tell me something, are you restricted to just 1 RJ45, or can you use 2 of them? I think you need 2 anyway.

There is lots of I/O on the 877, so why not have 2 RJ45 connected to it. That way you can set it up so that:

Rich (BB code):
RJ45 'A'             RJ45 'B'
  RB0 ---------------- RD0
  RB1 ---------------- RD1
  RB2 ---------------- RD2
  RB3 ---------------- RD3
  RB4 ---------------- RD4
  RB5 ---------------- RD5
  RB6 ---------------- RD6
  RB7 ---------------- RD7
Then assert RB0 through RB7 high, one at a time. As you assert each one, check all of the port D pins.

So, make RB0 an output and set it high and all other pins on port B inputs, then check RDO to RD7. Only RD0 should be high. If any other pin on port D is high, then you have a short to that line. If RD0 is not high, then that line is open.

Next , make RB1 an output and set it high and all other pins on port B inputs, then check RDO to RD7. Only RD1 should be high. If any other pin on port D is high, then you have a short to that line. If RD1 is not high, then that line is open.

And repeat for all pins on port B.
 

Thread Starter

speed1

Joined Mar 9, 2012
16
Okay, I'll work cheaper.

It actually seems like you have the right idea.

Tell me something, are you restricted to just 1 RJ45, or can you use 2 of them? I think you need 2 anyway.

There is lots of I/O on the 877, so why not have 2 RJ45 connected to it. That way you can set it up so that:

Rich (BB code):
RJ45 'A'             RJ45 'B'
  RB0 ---------------- RD0
  RB1 ---------------- RD1
  RB2 ---------------- RD2
  RB3 ---------------- RD3
  RB4 ---------------- RD4
  RB5 ---------------- RD5
  RB6 ---------------- RD6
  RB7 ---------------- RD7
Then assert RB0 through RB7 high, one at a time. As you assert each one, check all of the port D pins.

So, make RB0 an output and set it high and all other pins on port B inputs, then check RDO to RD7. Only RD0 should be high. If any other pin on port D is high, then you have a short to that line. If RD0 is not high, then that line is open.

Next , make RB1 an output and set it high and all other pins on port B inputs, then check RDO to RD7. Only RD1 should be high. If any other pin on port D is high, then you have a short to that line. If RD1 is not high, then that line is open.

And repeat for all pins on port B.
I'm very thankful to you Billo You colored my life and my project :D
I want just to ask do yo mean by RJ45 'B' the same microcontroller ?
because I'm using only one microcontroller, Today my project advisor advise me to use a DIP switch and he told me to make micro controller receive the signal comming from DIP switch.

and regarding the RJ45 socket, yes I'm using two socket (one will be connected to micro controller and the othere will be to another part of the cable.)
 

chrisw1990

Joined Oct 22, 2011
551
hes saying, loop the cable, have one connector.. your RJ45 'A' driving the cable, with your other RJ45 'B' connector receiving, therefore if RJ45 'A' pin 1 is '1' and RJ45'B' pin 6 (?) is 0, theres a break in the cable..
 

BillO

Joined Nov 24, 2008
999
Yes, I am saying put both RJ45s on the same controller. I was saying put one an port B the other on Port D. But I see you are using port B for the LCD and port C for RJ45 'A'. Now just connect RJ45 'B' to port D. This way the microcontroller can handle everything. No dip switches required. You should be able to test the cable in a few milliseconds.
 

strantor

Joined Oct 3, 2010
6,798
It hasn't been explicitly stated, but I'm getting a feeling that the assignment doesn't allow for the cable to be looped back. Picture an ethernet cable routed through conduit & walls & crawlspaces from one end of a building to the other.

So what I would do, is solder a ladder of resistors into your RJ45 connector and plug that onto the end of the cable. Apply voltage across the ladder and you should get incrementally less voltage on each return wire. If you have any shorts or opens, it throws off the return voltages and you should register a fault.

 

Attachments

Thread Starter

speed1

Joined Mar 9, 2012
16
It hasn't been explicitly stated, but I'm getting a feeling that the assignment doesn't allow for the cable to be looped back. Picture an ethernet cable routed through conduit & walls & crawlspaces from one end of a building to the other.

So what I would do, is solder a ladder of resistors into your RJ45 connector and plug that onto the end of the cable. Apply voltage across the ladder and you should get incrementally less voltage on each return wire. If you have any shorts or opens, it throws off the return voltages and you should register a fault.

Yes you are totally correct strantor, this is really what i was try to explain. I want my cable tester to test cables that are connected throw walls from floor to another (as example).

Billo thanks you my friend for your valuable effort and help.
 

Thread Starter

speed1

Joined Mar 9, 2012
16
Isn't TDR of any use here?
Yes my friend atferrari
I will use TDR to measure the length of the cable ( so if there is any problem in the testing process techniques can know the length of the cable to replace it). but this feature I will added to the next step of my project.

Thank you all my dears, I'm very thankful for all your help and support :)
 

Thread Starter

speed1

Joined Mar 9, 2012
16
Hi strantor,
Regarding ladder resistor, do i have to use ADC (I'm using pic 16F877) it has only one ADC (10 bit).

Thank you.

It hasn't been explicitly stated, but I'm getting a feeling that the assignment doesn't allow for the cable to be looped back. Picture an ethernet cable routed through conduit & walls & crawlspaces from one end of a building to the other.

So what I would do, is solder a ladder of resistors into your RJ45 connector and plug that onto the end of the cable. Apply voltage across the ladder and you should get incrementally less voltGage on each return wire. If you have any shorts or opens, it throws off the return voltages and you should register a fault.

 

Thread Starter

speed1

Joined Mar 9, 2012
16
Hi guys :D

I have did the project for detecting short wires and it's work (put if 2 wire are shorted and they are not next to each other it display all the between wires)
for example: 1 2 3 4 5 6 7 8
if wire 2 & 4 are shorted >> it show that (2,3),(2,4) and (3,4) are shorted !!!!

I still have some issues for detecting open wires i don't know how to do it !!!

this is photo of shorted wires (2,4)



And this is my code

Rich (BB code):
void main() {
    unsigned char i,j,o,shortI[1],shortJ[1];
    double vi,vj,v0,v7,vo;

    LCD_init();
    LCD_cmd(_LCD_CLEAR);
    LCD_cmd(_LCD_cursor_off);

    
    TRISB=0;
    portB=0;
    


    while(1)
    {

    
       TRISA = 0xFF;              //port A is input
       TRISE = 0xFF;              //port E is input
       
         for(i=0; i<8; i++)
       {
        vi=adc_read(i);
        for(j=i+1; j<8; j++)
        {

          vj=adc_read(j); 
           
          LCD_cmd(_LCD_CLEAR);
          
           v0=adc_read(0);      // to read AN0

           v7=adc_read(7);      // to read AN7
           

           
           
          if(((vi-vj)*0.71428)<0.2 && (v0!=0) && (v7==0) )
          {
          

            
            
          LCD_out(1,1,"Short at: ");
          ShortI[0]=i+48;
          LCD_out(1,11,shortI);
          LCD_out(1,12,"&");
          ShortJ[0]=j+48;
          LCD_out(1,13,shortJ);
          LCD_out(1,14,"    ");
          delay_ms(500);
          }

          }
          }
           for(o=0; o<7; o++)       // cheeck for open wires
           {
                   vo=adc_read(o);
                   if(vo == 0 )
                   LCD_OUT(1,1,"open");
           }
       
        }
any idea will be helpful, thanks for all :)
 

Thread Starter

speed1

Joined Mar 9, 2012
16
sorry I forget to mention one thing
I use in my if statment <0.2

if(((vi-vj)*0.71428)<0.2 && (v0!=0) && (v7==0) )

and that is in case the cable was very long as 100m, some of the voltage will be drooped because of wire resistance, so it will not be exactly equals.
 

strantor

Joined Oct 3, 2010
6,798
in case the cable was very long as 100m, some of the voltage will be drooped because of wire resistance, so it will not be exactly equals.
That should not matter. All the wires are the same length, so assumed the same resistance, so it should work the same whether using wires 1cm or 1KM.
 

Thread Starter

speed1

Joined Mar 9, 2012
16
That should not matter. All the wires are the same length, so assumed the same resistance, so it should work the same whether using wires 1cm or 1KM.
.

and what about open wires, i think it will be different because position of open is important and will change the resistance.
 

strantor

Joined Oct 3, 2010
6,798
.

and what about open wires, i think it will be different because position of open is important and will change the resistance.
If there is an open, you won't get any voltage back on the effected conductor. and how would the position of the open change voltage on the other conductors??:confused:
 

Thread Starter

speed1

Joined Mar 9, 2012
16
If there is an open, you won't get any voltage back on the effected conductor. and how would the position of the open change voltage on the other conductors??:confused:
that's right :)
I wrote this code and it's worked :D
I'm still trying write code to check for right wires map
as we know pairs must be connected as following pairs
(1,2)(3,6)(4,5)(7,8)


Rich (BB code):
void main() {
    unsigned char i,j,o,shortI[1],shortJ[1],openz[1];
    unsigned int z,k;
    double vi,vj,v0,v7;

    LCD_init();
    LCD_cmd(_LCD_CLEAR);
    LCD_cmd(_LCD_cursor_off);

    
    TRISB=0;
    portB=0;
    


    while(1)
    {

    
       TRISA = 0xFF;              //port A is input
       TRISE = 0xFF;              //port E is input
       
        for(z=0; z<7; z++)
        {
         vi=adc_read(z);
         if((vi*0.71428)<=0.1)
         {
         LCD_OUT(1,1,"open");
         openz[0]=z+48;
          LCD_out(1,6,openz);
         delay_ms(500);
         }
         
        }
         for(i=0; i<8; i++)
       {
        vi=adc_read(i);

        for(j=i+1; j<8; j++)
        {

          vj=adc_read(j); 
           
          LCD_cmd(_LCD_CLEAR);
          
           v0=adc_read(0);      // to read AN0

           v7=adc_read(7);      // to read AN7
           
           
          if(((vi-vj)*0.71428)<0.2 && (v0!=0) && (v7==0) )
          {
            
            
          LCD_out(1,1,"Short at: ");
          ShortI[0]=i+48;
          LCD_out(1,11,shortI);
          LCD_out(1,12,"&");
          ShortJ[0]=j+48;
          LCD_out(1,13,shortJ);
          LCD_out(1,14,"    ");
          delay_ms(500);
          }

          }
          }
          
               for(k=0;k<4;k++)   // check for wire map
               {
                for(z=0;z<8;z++)
                {
                
                TRISA=0b100010;
                TRISE=0b101;
                

                if(porta.f1 == 1)
                LCD_OUT(1,1,"wire match");
                }
               }


        }
and here the protus simulation & code
http://dl.dropbox.com/u/24354621/Ladder serister design-21-5.rar
 
Top