You are on page 1of 5

3D gForce Mouse

Introduction

"Our 3D gForce Mouse will enable use to move the curser in the air freely with the capacity of scrolling" The rationale for this design is two fold. We wanted to do this design because we wanted to make a zero-impact pointing device for those with injury. We also wanted to implement this injury conscious device for its business opportunities. We are using the 2-axis ADXL202 accelerometer to measure acclecration and tilt to operate the mouse. We measure the analog output signal and perform A/D conversion on the Mega32 MCU and the STK500 protoboard. Then the MCU generates serial signal packets on STK500 output pins to drive the computer mouse according to the PS/2 standard protocal. This mouse will perform horizontal and vertical movements in addition to scrolling. We will simulate clicking of the mouse buttons by having push buttons on our design breadboard. We origionally designed mouse to calcuate displacement in space due to 3-D acceleration. However we found out that the accelerometer is more accurate in measuring tilt than measuring short pulses of movement. Also, we had to work with the PS/2 protocal because we wanted to implement the scrolling function with our mouse. Making the PS/2 protocal function is the biggest challenge of our project. The PS/2 protocal is a two way serial transmittion protocal, where the computer (or host) can request to send information to the device. There are no "official" documentation on the PS/2 protocal, but there is execellent information on http://govschl.ndsu.nodak.edu/~achapwes/PICmicro/

This is our hardware design for the mouse. We uses a palm-sized coconut shell for the mouse casing. We have considered other casing possibility for usability testing. We first used an plastic egg shaped container that is about the size of an egg, however we consider it too small and the cutting of plastic is unpleasent to the user. Our mouse also has push buttons that serve as the click buttons for the mouse. It is mounted on the front of the coconut shell. The user will be comfortably able to click the mouse buttons. We use the Analog Device ADXL202 accelerometer for sensing the mouse motion. The ADXL202JE chip layout is as follows:

The ADXL202 has both digital and analog outputs. We will mainly use the analog output since the Atmel Mega32 has 8 available slots to receive analog inputs for A/D conversion. The capacitor Cy determines the bandwidth of the analog output. The Xout is the analog output for the x-axis acceleration, and Yout is the analog ouptut for the y-axis acceleration. The ADXL202 chip is also capable of generating digital signal, by using a pulse modulated duty cycle. The Rset resistor value will set the proportion of the data versus the period of the duty cycle. Since our mouse is based on tilt, the cursor will move when the mouse is tilted, within some histerysis factor. This means there is a grace degree, and within that degree from being flat the mouse will stop moving. Our ADC circuit is similar to previous labs. We connect the ADC to port A on the STK500 board. We uses port C for the push buttons. We may eventually build an standalone design, however that will only be done if we have extra time. We also amplify the analog output signal by using an op-amp. The Op-Amps used is the LM358 (lower power dual Op-Amps) from National Semiconductor. The Op-

Amp is used for impedance matching in order for the signal to be strong enough for reading.

High Level Design

The hardware design block diagram of our gMouse will be as follows

The MCU will generate output signals according to the PS/2 standard protocol. There are two output pins, the first one is DATA, and the second one is CLOCK. In the PS/2 protocol, the device will drive the CLOCK signal. Both the CLOCK and DATA will float default at VCC. During transmission, the mouse will drive the CLOCK and DATA lines. The PS/2 protocol requires the device to send clock between about 10 kHz to 16 kHz. In our specific implementation, our clock speed is 12.50 kHz, which is about 60 microseconds per clock cycle. The host can inhibit device transmission by pulling the CLOCK signal low for more than 100 microsends. The host could pull the CLOCK signal low for two reasons: one is to inhibit transmission because the host is processing data, and the other is to request to send information to the mouse. In the second case the host will pull the DATA line low to generate a start bit and wait for the device to generate the clock signal. More information on the PS/2 protocol can be found on http://govschl.ndsu.nodak.edu/~achapwes/PICmicro/.

We also uses three ports on the MCU for ADC conversion. This is similar to the digital thermometer lab. We hook up the analog output from the chip, which is soldered to a PCB provided by the professor. The software design on the MCU will be as follows:

Our software will measure the ADC input and convert it to PS/2 mouse data packets. First, we will introduce the PS/2 protocol. A PS/2 byte has 11 bits. (A) 1 start bit. This is always 0. (B) 8 data bits, least significant bit first. (C) 1 parity bit (odd parity, 1 when number of bits is even). (D) 1 stop bit. This is always 1. On a device-to-host transmission, the keyboard/mouse writes a bit on the Data line when Clock is high, and it is read by the host when Clock is low. The host-todevice is request or transmission is a little more complicated. The host will pull the clock to ground for more than 100 microseconds, and then the host will bring the data line low to signal a start bit. Then the host will start waiting for the device to generate a clock signal, the host will send bits of data to the device based on the device generated clock. The device should expect to receive the initial start bit, 8 data bits, a parity bit, and a stop bit. The data bits are valid for the device to read when the clock is high. The device is also expected to generate an ACK bit back to the host after receiving the stop bit, and the host should be able to read the ACK bit when the clock is low. There will be more detailed information on how we implemented the PS/2 protocol in the program design section.

You might also like