I have this idea on creating a Atmel-based board with PS/2 connector for testing of old keyboards.

So I'm looking for a way to assign 5V, ground or signal to each pin of the connector after board has been manufactured. All 3 lines do exist - also I have 6 digital pins to control all this - but I'm not sure what is the best solution here.

My original idea was to have logic gate and then set of NPN - but that sounds a bit too complicated.

Any feedback is greatly appreciated!


1 Answer 1


Six bits are not going to be enough to select between three states for each of the six pins. The number of different combinations is 3^6 (729). You need at least 12 bits to hold that value. If you can get eight bits for selection, you can use multiplexers to select the states. If you have an arduino, I would suggest ordering an ATMega328p or similar, and programming it through your Arduino with the included ArduinoISP sketch. This would give you plenty of I/O for the job.

  • 1
    \$\begingroup\$ The number of different combinations when you have six pins with three states each is 3^6 = 729, requiring 10 bits of precision. In practice you would have 12 bits (2*6) for ease of implementation. \$\endgroup\$
    – jms
    Mar 10, 2016 at 14:46
  • \$\begingroup\$ Oh my gosh again! I am so bad at math :( I'll fix it. Sorry \$\endgroup\$ Mar 10, 2016 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.