bigmessowires
Well-known member
Here's the auto-detection keyboard cable circuit. It uses a diode and a 5V DPDT relay - something like http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_139977_-1
The four lines from the RJ11 connector are labeled A, B, C, and D. If A is +5 V, then the relay is energized, connecting D to the board's ground. If A is GND, then the coil is not energized, and it connects A to the board's ground. D is also passed through to the microcontroller as a digital input, so the program can reverse the meanings of data lines B and C in software.
The flyback diode is there to prevent a voltage surge or spark when the relay turns off.
The four lines from the RJ11 connector are labeled A, B, C, and D. If A is +5 V, then the relay is energized, connecting D to the board's ground. If A is GND, then the coil is not energized, and it connects A to the board's ground. D is also passed through to the microcontroller as a digital input, so the program can reverse the meanings of data lines B and C in software.
The flyback diode is there to prevent a voltage surge or spark when the relay turns off.