|
ADXL202-EB InterfacingThe Analog ADXL202 is a dual-axis MEMS accelerometer with a -/+2 G acceleration range. It can measure static acceleration and can be used as a tilt sensor. We're using two of them at right-angles to measure acceleration in all three axes.The code for sampling the acceleration is in onboard/avr/accel.c and onboard/avr/accel.h. Due to the necessity for accurate timing of the pulses we use this as our mainloop. We also have jitter in the servo output right now. This is very troubling. It might be caused by noise in the clock, or perhaps spurious interrupts or who knows. Unfortunately, it is not very good right now. Spurious interrupts, random timing problems and other errors mean that we do not have a useful acceleration data. You can see the noise in this plot of 600 samples (above) while sitting on a stationary desk. Mark Ramsey suggested looking for periodic interrupts that might cause problems, so I disabled the ADC and servo outputs. The resulting samples (above) are much, much better, but still noisey. The new mainloop.c that wraps everything into one function, averages samples and disables interrupts at the appropriate time makes an enormous difference, as you can see from the above plot. That data was gathered from the same stationary desk, with servo output, UART incoming and outgoing, interrupt driven ADC sampling and PID loops in the background. |
$Id: accel.html,v 1.15 2002/08/05 03:44:39 tramm Exp $ |