I'm trying to make a cable checker to help me make custom cables for my computer. I'm thinking I plug the cable ends into sockets on the device, then the Arduino checks between different pins to make sure that no wires are in the wrong spot or unplugged.
So I'm thinking it runs through like this:
I plug the cable into connectors on the device. The Arduino has the PSU pinouts saved. Pin 1 represents one end of the cable, pin 2 represents the opposite end. Same with 3-4/5-6 etc. If the cable is assembled correctly, it should act as a connection between pins 1-2, pins 3-4, 5-6 etc.
tests pin 1 - 2 to see if they're connected, if yes, light up a green LED, if not, light up a red LED
tests pin 3 - 4, does the same thing
Repeats this for every wire in the cable
Am I on the right track? How would I do this? I've seen people talking about pullup resistors but I'm also seeing people say that shorting can damage the board
1 Answer 1
The scope of your question is too wide for a simple answer so let us constrain it to slow signals (audio frequencies or less) over short cables (not more than several meters) in a electrically clean environment (such as found in most homes).
That said, it is likely most looking for similar solutions reading your question will have different specific requirements. So to make this question and answer useful to others let us consider the most generic, economical and Arduino based solution.
- Most cables worth automatically testing will have far more individual connections than common Arduino boards, such as the Arduino Uno, have GPIO pins. Consider using a GPIO expander or multiple Arduinos which communicate with each other to coordinate efforts.
- When testing a cable that will be used for low frequencies, short distance and low immunity to noise it is likely the only faults that are of concern are OPENS and SHORTS.
- As this design uses GPIO pins we have the following options at any given GPIO pin: Drive High, Drive Low and Input With Pull Ups.
- Build a cable test rig where one end (the near end) of the cable under test is connected to GPIO pins designated as the driver side and the other end of the cable under test (the far end) is connected to GPIO pins designated as the sensing side.
- For a SHORTS and OPENS test set all the sensing and driving GPIO pins to Input With Pull Ups. Verify that all sensing GPIO pins report a 1. Next change one and only one of the driver GPIO pins to an output and send a 0. Record that state of all sensing GPIO pins. Return the driver GPIO pin to Input with NO PULL UPS and repeat these steps for the next GPIO driver pin.
- If this is a STRAIGHT THROUGH cable only 1 sensing GPIO pin should report a 0 in each testing pattern recorded. If more than 1 sensing GPIO pin reports a 0 then there is a short between the 0 reporting pins. If none of the GPIO pins reports a 0 then there is an open for that GPIO pin.
- Use the same test for cables containing intentional SHORTS (perhaps multiple ground pins are shorted together) expecting to see the associated GPIO pins to all change to 0 at the same time.
- For even more complex cables containing loop backs at both ends consider only the "GPIO pin set to an output sending 0" as the driver and record the state of ALL OTHER GPIO pins as they are now all possible outputs.
Am I on the right track?
... that depends on whether pins 1 and 2 are supposed to be shorted togethertests pin 1 - 2 to see if they're connected
is not anywhere near one line of code ......... a cable has two ends ... call themleft
andright
... I am talking about a description something like,set each pin on left as inputs, set each pin on right as inputs, set left pin 1 to output, output LOW on left pin 1, check state of right pin 1 ......