High Level Design:
The wireless keyboard consists of a wired 102-key ps/2 keyboard, two Atmega32 microcontrollers, one 433.92MHz transmitter and one 433.92MHz receiver from Radiotronix.
Our design can be divided into two parts: the keyboard side and the computer side. On the keyboard side, we have one of the microcontrollers connected to the keyboard and to the transmitter. The keyboard communicates with the microcontroller and the microcontroller sends data out to the transmitter by using it’s built in UART. On the computer side, we have the other microcontroller connected to the computer and to the receiver. The computer communicates with the microcontroller and the microcontroller gets data from the receiver through its build in UART. Note that we use the UART because they allow us to easily set the transmit and receive rate and they do all the transmitting and receiving in the background. Our setup is shown in the figure below.
Because we decided to use a ps/2 keyboard and connect to the ps/2 port on the computer, we needed to implement the ps/2 protocol on the microcontrollers. A very good reference on the ps/2 protocol is located on Adam Chapweske’s webpage. The ps/2 protocol is a bi-directional protocol, which means that not only does the keyboard send data to the computer, but the computer sends data to the keyboard. For example, the computer can do such things as tell the keyboard to reset or set the typematic delay and typematic rate, among other things. This means that in our wireless set up, not only should the keyboard be able to transmit to the computer, but the computer should be able to transmit to the keyboard. However, due to budgetary constraints, we could only purchase one transmitter and one receiver. To overcome this obstacle, we had to program the microcontroller on the keyboard side so that it would pretend to be the computer and program the microcontroller on the computers side so that it would pretend to be the keyboard. On the keyboard side, this requires that the microcontroller sends the appropriate commands to the keyboard when it boots up, and that it listens for the correct responses back from the keyboard. Furthermore, on the computer side, this requires that the microcontroller responds correctly to all the commands that the computer sends to it.
In addition, the ps/2 protocol specifies that data be sent at a maximum rate of 10kbps to 16.6kbps. However, the transmitter/receiver pair can only transmit at a maximum of 4.8kbps. As a result, the microcontroller on the keyboard side needs to buffer the keyboard data so that it can send it out at a much slower rate through the transmitter. We rely heavily on the fact that a human being can only type so fast, and that the typematic rate (the rate at which the keyboard resends a key that is held down) is well below the maximum. On the computer side, this also means that the microcontroller needs to buffer all the data that it slowly receives before passing it along to the computer at a faster rate.