BMA180 Calibration Example

Have questions about a SparkFun product or board? This is the place to be.

Moderator: phalanx

BMA180 Calibration Example

Postby marzubus » Thu Apr 05, 2012 9:52 am

Hi Guys,

Im totally new to i2c and arduino. I just got my first batch of components I ordered and I am trying to understand / decipher calibration of the BMA180 from its datasheet.

I have the sparkfun BMA180 up and running over i2c and I am getting a skewness from all three axis.

Setup:
Arduino FIO 3v + BMA180 hooked up to analog 4,5 for i2c.
BMA180 set for 8G mode and 10Hz sampling rate

Reading raw acceleration values after gently rotating the BMA180 to all 6 sides I consistently ( give or take 50 ) get these results:

min_x:-1212
min_y:-1250
min_z:-809
max_x:822
max_y:813
max_z:1309

Now by my calculations at 0.99mg * value, ( 8G mode ), I get to 1.2G in one direction and 0.8G in the other direction.
I think 1G should be around 1035 in 8G mode, is that right?

So I clearly need to recalibrate somehow, since my negative axis are all like 250 off. I have looked at the datasheet and tried to understand the fine calibration chapter, but all my attempts to enable calibration by setting offset_finetuning ( 0x22 ) to 11 or 10 and then setting en_offset_x to 1 have yielded no change in my X axis values at all.

So im wondering if im writing to the correct memory location, since I find the same en_offset_x and offset_finetuning in higher memory registers eg 0x42. But the datasheet doesnt say if purple is rw/ro or if green is rw/ro? what is white and greyed out?

The alternative is to actually change the offset_x/y/z values but I dont quite understand how to do that. I know that my deviations are:
min_x:-1277 // -1036 = +241
min_y:-1245 // -1036 = +209
min_z:-785 // -1036 = -251
max_x:810 // 1036 = + 226
max_y:853 // 1036 = +183
max_z:1289 // 1036 = -253

So do I simply read back my current offsets and add or subtract these numbers directly?
My current offsets are:
X:1644 Y:1800 Z:2447

from what I understand 2048 is the zero trim offset. So is each number here a multiple of 0.99mg in 8G mode? or does the sensor itself take care of the conversion?

Can anyone help me with some code examples of actually calibrating a BMA180 and if im using the correct memory registers?

Thanks for any help!

Kegan
marzubus
 
Posts: 4
Joined: Sat Mar 31, 2012 8:04 am

Re: BMA180 Calibration Example

Postby wozley » Tue May 22, 2012 4:14 am

Just wondering if you got any further with this? I am trying to get the BMA180 working and finding very little info on example sketches, circuits, projects, etc...
wozley
 
Posts: 2
Joined: Tue May 22, 2012 4:10 am

Re: BMA180 Calibration Example

Postby marzubus » Wed May 23, 2012 2:56 am

Not yet. Still not found anything online about it. I bought the ADXL345 and that so far has just worked without needing any calibration.

Kegan
marzubus
 
Posts: 4
Joined: Sat Mar 31, 2012 8:04 am

Re: BMA180 Calibration Example

Postby wozley » Thu May 24, 2012 6:19 pm

Damn, I cant believe theres no arduino library for it! what a waste of cash :(. Gonna have to try the ADXL345 then, did you have a library for that particular one, or is it relatively easy to find on the net?

http://bildr.org/2011/03/adxl345-arduino/ this seems like a pretty good library.
wozley
 
Posts: 2
Joined: Tue May 22, 2012 4:10 am

Re: BMA180 Calibration Example

Postby marzubus » Fri May 25, 2012 6:05 am

Hi.

I went with freeimu library for my application. But there are many out there. I just googled adxl345 and github.

Kegan
marzubus
 
Posts: 4
Joined: Sat Mar 31, 2012 8:04 am

Re: BMA180 Calibration Example

Postby marzubus » Fri May 25, 2012 6:11 am

marzubus
 
Posts: 4
Joined: Sat Mar 31, 2012 8:04 am


Return to SparkFun Product Questions

Who is online

Users browsing this forum: No registered users and 5 guests