Having trouble figuring out raw accelerometer values

Gixxerman1980

  • Newbie
  • *
    • Posts: 1
    • View Profile
I'm pretty new to all of this, but I'm learning. I'm currently trying to build a box where my tinyduino does three things.

1. Using a pot, it will act as a pulse wave modulator to control the speed of a vibration motor.
2. The on board accelerometer will monitor G total to track vibration from motor.
3. G total will be sent to LCD display for vibration level tracking

I've gone through the data sheet to the best of my knowledge and from what I can tell, the raw counts @ the 2g range should be +/- 256. Sitting still and relatively flat, I'm getting X: 9, Y: -9, Z: 261, with some slight variances over time. Inverted, I'm getting X: 13, Y: -13, Z: -250, again, with slight variances. I assumed that I shouldn't see anything higher than 256, so is there some calibration that I need to do? Also, I want to have the G total calculated and from what I've seen, I need to use the Pythagorean Theorem from my XYZ to figure that. Now, at rest, my G total should be 1.000. To figure that correctly, do I need to map my axis from +/- 256 to +/- 1.000?


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
Looks like you're on the right track. As far as the values you're seeing, those look pretty good as well- you're unlikely to see exactly +256 to -256 out of the box. Luckily this sensor is likely to have an offset but otherwise be linear- so, for example, I think you could simply subtract 5 from the Z and get -255 to 256. If you find the min/max for the other axis and adjust those similarly, you should be pretty close to seeing 1g at rest when you divide the value you calculate by 256.


 

SMF spam blocked by CleanTalk