Keyboard Side Hardware:

 

The keyboard side hardware setup is shown in the figure below. The keyboard connects to the microcontroller through a 6-pin mini-DIN socket.  The Data line of the keyboard is connected to pin 7 of PORTD and the Clock line of the keyboard is connected to pin 17, which is external interrupt 1 of the microcontroller.  On the falling edges of the Clock line, the microcontroller’s interrupt triggers and either a bit of data is read in or one bit of data is sent out to the keyboard.  The data that is to be transmitted to the computer is on the TXD pin of the UART.  This pin connects to the data input of the Radiotronix transmitter (RCT-433-AS) and is transmitted. For the transmitter’s antenna, we use a dipole antenna made from a piece of wire that is approximately 2 feet long.

            One of the problems that we experienced involved one of the external interrupts.  Originally, we used interrupt 2, which is an asynchronous edge triggered interrupt.  When using this interrupt, our code refused to work.  After days of work, we finally realized that the interrupt would get triggered at the incorrect times.  In some cases, small noise spikes would trigger the interrupt and in other cases it would trigger for no apparent reason.  Once we changed our code to use external interrupt 1, we didn’t encounter any of these errors.  Based on our experience, it appears that the external interrupt is very sensitive to external noise and isn’t suited to our use.