Hello,I am using the dCompass on a boat. Thus the sensor does not stay flat , it rocks back and forth and up and down due to the motion of the boat. Because of that, I am getting an inaccurate reading with the compass. Is there a way to fix that? I also have tilt sensor available.Thank you.Cheers.

You can only fix that if have an accelerometer to calculate your tilt values. Once you know that, you can use the three magnetic fields to calculate your magnetic north heading. The math of this is not something I can conjure up off the top of my head (or any other part of my head, for that matter).

Edit: this is why ships' compasses are always mounted in a way that allows them to move around and stay level

You could do as Xander said and make a leveling gyro for the compass. Or get a three-axis compass

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

Mon Mar 11, 2013 10:24 am

theboss4545

Rookie

Joined: Sun Sep 25, 2011 1:52 pmPosts: 16

Re: dCompass Accurate reading

Coder A wrote:

Does the boat rock just back and forth or just left and right or all? If you answered 1 or 2 I can help with the tilt math.

Both ! The boat rock back and forth and left and right. I can buy an accelerometer (dIMU) if that would make it work. I think it is only a matter of figuring out the math. I would really appreciate it if you help me ! Thank you.

Mon Mar 18, 2013 2:26 pm

Coder A

Moderator

Joined: Thu Jan 03, 2013 5:10 pmPosts: 202Location: The plateau north of the Ohio River Valley, also known as Cave Country.

Re: dCompass Accurate reading

To figure out the tilt you would squareroot the sum of the squares of the forces felt along 2 of the axes(confusing? Don't worry). Then you do some math wilth arctangent, and add in the third axis, and do some more math, and you have the tilt both ways. however, it is up to you and the others to figure out how this helps get a reading from the compass. Do you want me to post the code? It could be a while, as I have not actually made it.

_________________I'm not a robot! I'm british! ~ quote from an asparagusI am not a robot! I am a unicorn! ~ quote from a robot

Joined: Thu Jan 03, 2013 5:10 pmPosts: 202Location: The plateau north of the Ohio River Valley, also known as Cave Country.

Re: dCompass Accurate reading

All it is is the third-dimensional extension of the point downwards program. I will try to make it.

_________________I'm not a robot! I'm british! ~ quote from an asparagusI am not a robot! I am a unicorn! ~ quote from a robot

Wed Mar 20, 2013 2:11 pm

theboss4545

Rookie

Joined: Sun Sep 25, 2011 1:52 pmPosts: 16

Re: dCompass Accurate reading

Coder A wrote:

To figure out the tilt you would squareroot the sum of the squares of the forces felt along 2 of the axes(confusing? Don't worry). Then you do some math wilth arctangent, and add in the third axis, and do some more math, and you have the tilt both ways. however, it is up to you and the others to figure out how this helps get a reading from the compass. Do you want me to post the code? It could be a while, as I have not actually made it.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum