Shop OBEX P1 Docs P2 Docs Learn Events
Help with HM55B Compass Module — Parallax Forums

Help with HM55B Compass Module

clambclamb Posts: 7
edited 2011-03-01 18:40 in Accessories
Hi All,

I am trying to read angles from the compass module. I have wired and calibrated as shown in the manual. However when i run the "test calibrated sensor program" , the values shown on the debug terminal jump all over the place with differences as much as 43 degrees apart. The same thing happened even before I calibrated.

I am using a BS2 Rev E board. Below is an attached picture of my circuit. Does anyone know why this might be happening cos I have exhausted all my possible reasons. Thank you.
1024 x 1365 - 98K
1024 x 768 - 71K

Comments

  • dandreaedandreae Posts: 1,375
    edited 2011-02-22 07:27
    Do you have any magnetic fields near by, such as a device with a strong magnet? Make sure that you have a strong 9v battery, it should measure at least 9.1v or higher.

    Dave
  • clambclamb Posts: 7
    edited 2011-02-23 05:44
    Hi Dave,

    After reading your reply I decided to explore 2 possibilities: 1) Something about my test location makes it go crazy. 2) My battery voltage isn't strong enough

    TEST LOCATION:
    There are no magnets around me but I moved my testing to another location and the values on the debug terminal were generally less erratic but still wavered considerably.

    BATTERY VOLTAGE (At new location):
    I measured the voltage from my 9V battery using a digital multimeter. It read 8V. As a control, I fed 9.2v to the basic stamp board using a DC power supply. Here are the results:

    With the Battery, on the average there was a difference of 3 degrees in values observed on the debug terminal and an extreme of 7 degrees every once in a while.

    With the Dc power supply, on the average there was a difference of 3 degrees in values and an extreme of 7 degrees every once in a while.

    My application requires a high degree of accuracy at all times. Is it normal to have a difference as high as 5 degrees?

    If I borrowed some principles from Electromagnetics to build a shield for the compass against magnetic fields (to reduce fluctuation), would this render the compass useless being that the core of its functionality is a magnetic sensor?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-23 06:55
    It's normal for the compass to get jumps of around 6 degrees. That's the resolution of the calibrated compass. It's measuring the magnetic field strength along two axes to 11 bit resolution (+-1024), then computing the arctan to get the compass direction. The arctan function has limited accuracy and the whole system only has 6 bit accuracy (360 / 64) at best.

    Given that the compass actually measures the field strength and converts to compass angle, it's very sensitive to small field changes in areas of the compass circle where the X value is near zero and you can get large jumps with small magnetic field changes.

    A magnetic field shield would shield the compass from just the signal you're trying to measure. If there are motors or large conductors nearby, you need to shield those or move the sensor away from them. There's a square law effect and small distance changes can have large effects when the compass is close to an interference source.
  • TtailspinTtailspin Posts: 1,326
    edited 2011-02-23 07:06
    One of the "features" of this device is..
    6-bit (64-direction) resolution after calibration

    To Me, that translates into..
    You only get 64 positions out of a possible 360.. So there might be a little jitter in the compass heading.

    I have not tried to run the heading thru a Kalman Filter, I wonder if that would help the heading jitter's?
    You know, the same type of code that Makes PID work with Prop Bots.. it smooths out the servo movements.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-03-01 18:40
    I use the compass and find it useful, but it does have limited resolution and you'll see a little jitter. A running average of a few readings would likely smooth out the jitter. But what I do instead is maintain a computed heading based upon wheel encoders and a compass heading. At controlled points during the navigation I sync the computed heading with the compass heading.
Sign In or Register to comment.