There are many devices that can be connected to a microcontroller to provide an action, or sense the environment. Here are a few items that can be connected to a microcontroller:
- Other motors (like stepping motors)
- Other ICs
- Range Finders
- and Much More.
An accelerometer measures acceleration. The unit of measurement for acceleration is m/s/s or m/(s^2): meters per second per second, or meters per second squared.
Generally, accelerometers measure gravity which is a 'g'. Specifically g = 9.8 m/(s^2). 1 'g' is normal gravity. 2 g's is twice the force of gravity.
Accelerometers have various sensitivities that are appropriate for certain applications. Typical applications for accelerometers are measuring tilt, measuring shock, and measuring something falling (i.e. you laptop is falling, lock those hard drive heads). Some examples of accelerometer sensitivities are : 1.2g, 1/5g, 3g, 5g, 16g. The 16g would be great at measuring hard shocks and vibrations. Sensitive g's like 1.2g is great for measuring tilt.
Accelerometer will contain the ability to measure one of more axes. In this case, an axis is a plane about which the accelerometer is tilted, or a direction on which the accelerometer is shocked.
The board that is tested in this case can be powered from 2.6v to 3.3v.
The accelerometer is powered by batteries and regulated by the Maxim MAX604 chip with the discrete component of 10uf electrolytic capacitors.
The MAX604 outputs 3.3v which this accelerometer accepts as a valid power level.
Since this Freescale accelerometer requires a different voltage than the AVR microcontroller, another voltage regulator is used (Maxim MAX604). The MAX604 will be positioned on the other extreme side of the breadboard. The MAX604 uses 2 10uf capacitors to smooth the power signal at the input and the output. One portion of the power rails is dedicated to the 3.3v so the accelerometer can easily be connected to power.
The AVR microcontroller offers an internal voltage reference of 2.56v to be used if so desired. If the device that is being measured by the ADC has a top value of 2.56v then this option would be a good one. The accelerometer that I am connecting to the ADC actually has a higher top voltage, but not that much more, so I selected this option.
The register that this option can be controlled is the ADMUX register. The REFS1 and REFS0 control the source of the reference voltage. In this case, to select the internal 2.56 volts as the reference, both REFS1 and REFS0 must be set.
Capacitors can be used to smooth a rough or noisy signal. In this case, an accelerometer is being read by the ADC. The ADC is seeing a very noisy signal from the accelerometer.
A 10 uf (micro farad) capacitor is used to smooth the signal coming into the ADC. The result is a smoother signal and the response is acceptable, no apparent lag.
A 100 uf capacitor is also tested to determine if the signal can be smoothed even more. The result from the 100 uf capacitor is a bit smoother, but not enough to justify the use of a larger capacitor. The lag is greater with this capacitor and would probably be unacceptable.
Much of the noise may be coming from the breadboard itself, or the internal clock and other functions of the microcontroller.
The result from the ADC using the internal 2.56v reference and the accelerometer set at 1.5g is 325 at completely vertical and rotated 180 degrees the result is 963. This makes sense since we are not seeing the .5g's on either end of the rotation since we are only getting 1g, or the measure of gravity.
To convert more than one analog signal using the ADC, multiple channels must be used. In this case, an accelerometer will be connected to channel 0 and channel 1 of the ADC. The X axis is connected to channel 0 and the Y axis is connected to channel 1.
To smooth the analog signals, 10 uf (micro farad) capacitors will be used on each channel.
To power the accelerometer, the MAX604 voltage regulator with supporting capacitors are used.