[I posted this on s.e.design, but all of the people who responded were
too stupid to know what "fun challenge" meant, and tried to talk me
out of the *design* of the tester, ignoring the purpose of the
posting. So, I'm copying it here, because people here tend to be more
intelligent than that, and might enjoy a mental challenge without
missing the whole point of the posting.]
I had this idea, and toyed with it a while (including some computer
simulations), but didn't go very far with it. I thought I'd post it
here in case anyone wants a brain teaser for the weekend.
Consider this tool: a cat-5 cable tester.
Goal: To make a tester that works entirely from the user's side,
without needing batteries at the far end.
Circuit:
+-----+
| | P0/AD0 R1 R11
| |----------\/\/\--< <--------> >----\/\/\ ---+
| | P1/AD0 R2 R12 |
| |----------\/\/\--< <--------> >----\/\/\ ---+
| | P2/AD2 R3 R13 |
| |----------\/\/\--< <--------> >----\/\/\ ---+
| | P3/AD3 R4 R14 |
| |----------\/\/\--< <--------> >----\/\/\ ---+
| uP | P0/AD0 R5 R15 |
| |----------\/\/\--< <--------> >----\/\/\ ---+
| | P1/AD0 R6 R16 |
| |----------\/\/\--< <--------> >----\/\/\ ---+
| | P2/AD2 R7 R17 |
| |----------\/\/\--< <--------> >----\/\/\ ---+
| | P3/AD3 R8 R18 |
| |----------\/\/\--< <--------> >----\/\/\ ---+
| | cable
+-----+
The idea is that each GPIO pin can either drive high, drive low, or
measure the voltage present. I.e. you're creating a programmable
resistor divider network. So you can set up various combinations of
resistors being driven from various combinations of voltages, and use
the A/D converters to measure the voltage, and compare with what you
"think" it should be.
The challenge: Select values of R1..R18 such that you can accurately
detect the following cable errors:
* shorts between any N (2..8) conductors.
* opens in any one or more conductor.
* swapped (or N>2 miswired) conductors.
Bonus points for minimizing the number of A/D bits you need.
My idea was to provide eight red/green or RGB leds on the uP side to
indicate the status of each conductor (green=OK, other
combinations=various error conditions), with a serial or usb port for
diagnostics to a laptop. I have a cable tester now, but the battery
is at one end and the lights are at the other.