circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

June 2006, Issue 191

Nontraditional Cursor Control
ATmega32-Based Motion Sensing


HARDWARE DESIGN

The hardware for our Airmouse project is based on information gathering and processing (see Figures 3 and 4). The accelerometer output goes through three stages. The first stage is a low-pass filter that removes the high-frequency noise from the accelerometer.

(Click here to enlarge)

Figure 3—The path of the data and signals through the system’s major components is straightforward.

(Click here to enlarge)

Figure 4—This circuit filters high-frequency noise out of the accelerometer signal, aligns the accelerometer output with the microcontroller voltage sampling range, and amplifies the output to fill a larger part of the sampling range, allowing for more resolution on sampled signals. The circuits for the accelerometer’s x- and y-axes are the same. Only one copy of the filter/amp circuit is shown.

The second stage is the differential amplifier stage, during which the signal is amplified by a factor of two. This expands the accelerometer output from 1.5 to 3.5 V (representing –1 to 1 g) to 0.5 to 4.5 V (still representing –1 to 1 g). Introducing gain into the accelerometer output enables us to use the ADC range more fully. The signal almost fills the ADC’s 0- to 5-V range instead of filling only two-fifths of it, as was the case before the signal was amplified. The negative end of the differential input is the accelerometer output. The positive end of the differential input is the output of a potentiometer whose inputs are attached to 5 and 0 V. This potentiometer enables us to tune the accelerometer 0-g level to a voltage of our choice.

The third stage is a protection stage for the ADC. Because the amplifier’s output level isn’t rail-to-rail with its power supply, we had to use a power supply that could produce potentially damaging output to the ADC. The output of the amplifier goes through a resistor and then through a diode to 5 V. The output is taken off of the junction between the resistor and the diode. This prevents the amplifier output from getting higher than 5 V plus the internal voltage drop of the diode (approximately 0.67 V).

In addition to the two accelerometer inputs to our ATmega32 microcontroller, we poll four push buttons, which provide enable/disable functionality, left click, right click, and mouse scrolling. These push buttons are tied to the ATmega32 microcontroller’s pins and ground. The pins are internally pulled up, so the buttons are active low. Pushing the button ties the pin to ground.