Hey All, I've got the SparkFun ADXL320 accelerometer hooked up to my arduino and it's doing some strange stuff. It starts off working fine but as I leave my project running, the z-axis value keeps creeping slowly down. Is this an indicator of a blown cap, bad solder joint, bad A/D input? Any ideas are appreciated. I need this working in less than a week.
The ADXL320 is a two-axis accelerometer. It only outputs X and Y accelerations. If you get an ADXL330 it gives accelerations in all three axes.
So you are probably measuring nothing.
Sorry, I meant ADXL330. I'm using this board: http://www.sparkfun.com/commerce/product_info.php?products_id=692
And the Z index definitely works as I can detect transient pulses if I knock on the table, tilt or whatever. I just get this steady drift as the device runs longer. It gets up to 5% or more after 20 or 30 minutes.
Ersatz, I tried this myself and the Z-axis did not drift. The original numbers are like 513, 512, 650 for X, Y, and Z on my a/d. I am using aref at the 3v VDD for the accelerometer. I recommend doing this. All you need to do is put a jumper from the VDD pin on the accel to the AREF pin on the Arduino, then add the following to your code:
// at the beginning... #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #endif #ifndef sbi #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif // in setup... cbi(ADMUX, REFS1); //clear REFS1 bit (0) cbi(ADMUX, REFS0); //clear REFS0 bit (0)
I found this to improve the stability of the data a lot.
Awesome. I'll give this a shot and maybe resolder my z-pin.