CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to port the compass library for tilt compensation...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Stroi



Joined: 17 Oct 2006
Posts: 2

View user's profile Send private message

How to port the compass library for tilt compensation...
PostPosted: Sun Dec 31, 2006 1:47 am     Reply with quote

Hi,

I need to realise a tilt compensation for my 3-axis compass module (PNI11096). The library only supports a simple 2 axis compass.
As I expect, I'm not the first one who needs a compass with the 3rd axis compensation. So I've been searching for a sample code but I can't find any. Has someone probably allready worked out some working code?

Thanks in advance and a happy new year!
Kind Regards,
Michael
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Dec 31, 2006 4:19 pm     Reply with quote

Most of the documents on the net suggest that an additional device
is needed to measure pitch and roll, in order to do tilt compensation.
Does your compass have the pitch & roll sensors mentioned in the
following web pages ?
Quote:

For the tilt-compensation this design employs the ADXL202E, a 2-axis
micro-machined accelerometer with digital duty-cycle outputs.
See page 24:
http://www.ece.ubc.ca/~elec474/reports/dec03/team5.pdf


PNI has this comment:
Quote:
a tilt sensor is required to perform this function in addition to the magnetometers.
http://www.pnicorp.com/supportProduct?nodeId=c4b19


Quote:

Generally, the magnetic compass module consists of three magnetic
compass sensors and two inclino-meters, all used to compensate the
tilt error.
See page 1:
http://nesl.snu.ac.kr/publication/papers/j_int/12.pdf
Stroi



Joined: 17 Oct 2006
Posts: 2

View user's profile Send private message

PostPosted: Tue Jan 02, 2007 10:41 am     Reply with quote

Hello,

thanks a lot for the very informative information.
Am I right, that there is no need for an Z-axis?
So there should only be this ADXL202E and a 2-axis compass circuit.

I've found correction data for tilt errors from Honeywell but not from PNI. Do you think that there is a great difference between those sensors?

Thanks a lot!
Kind Regards
Michael
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 02, 2007 1:14 pm     Reply with quote

I haven't used these sensors before. The only experience I have
with this type of project is because someone here at the company
bought a Sparkfun UAV board.
http://www.sparkfun.com/commerce/product_info.php?products_id=707
I wrote a simple test program for it with CCS, just to prove that all
the senors were working, and that they would display reasonable
output values. I don't have any more experience with the tilt and
roll sensor. The person who bought it finished the project on their own.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Jan 02, 2007 2:13 pm     Reply with quote

For a tilt compensated magnetic compass you need either a gymballed or mechanically floating sensor, or a three axis magnetic sensor and 2 axis tilt sensor.
Here on Cape Cod Mass USA the magnetic vector is about 40 degrees from vertical. If you had two fixed magnetic sensors they could tilt such that they were both perpendicular to the magnetic vector. Then neither would see any magnetic field and the compass would have no data to work with.

I designed the hardware of a three axis flux gate and tilt sensor compass a few years ago. Another guy did the software, and the company mathematician came up with the compass algorythms. It ain't easy!
_________________
The search for better is endless. Instead simply find very good and get the job done.
Ttelmah
Guest







PostPosted: Wed Jan 03, 2007 3:33 am     Reply with quote

I suspect the 'difference' between the PNI unit, and the Honeywell, is that the former is available as a complete corrected module, with the calculations already perfromed. People using their seperate chips, tending perhaps to be working in magnetometry, rather than compass applications. The Honeywell sensor, is the simpler/smaller solution, for compass applications, and this has therefore tended to be the more 'common' solution in this area, and hence the amount of code examples existing.
To develop a properly corrected module, you need three magnetometer axes, to give you a compass 'vector', and then either two tilt axes, or a three axis accelerometer, to give the inclination. Mathematically, it is fairly simple, but tends to be bulky, so for smaller PICs, requires some tidy 'shortcutting' on the trig functions, making it harder work.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group