Compass Shield Quandary

Grimstone

  • Sr. Member
  • ****
    • Posts: 64
  • Still downloading...
    • View Profile
What is the expected output from the compass shield? I have connected the shield to the TinyDuino and ran the example sketch. Sure enough I am getting x, y, and z outputs on the serial monitor. Though now, it gets interesting...

1) If you rotate the instrument in place, the x, y, z numbers do change which is good. However, the values are not relative to each other. For example, the sum of their squares are not equal whether it is at 0 or 90 degrees. So is the sensor not calibrated in respect to each axis?

2) Using an LED shield for output to the compass, I get different values dependent on whether or not I am plugged into the usb shield with the serial monitor going or separate from the shield. Definitely makes debugging interesting.

3)Also noticed that on a few occasions, a small movement of the sensor causes the x to read -4096 which is worrisome. It does not seem related to actual magnetic field strength or orientation. This makes me think, I may have a faulty chip or it is not mounted correctly.

Thoughts?


Grimstone

  • Sr. Member
  • ****
    • Posts: 64
  • Still downloading...
    • View Profile


Grimstone

  • Sr. Member
  • ****
    • Posts: 64
  • Still downloading...
    • View Profile
I found the solutions.

1. The x, y, z outputs are in no way equivalent and need to be scaled appropriately. When looking for max/min ranges, did not consider that one or more values may never slip under 0. I always had one axis give positive numbers regardless of rotation. Fixed code.

2. The -4096 value though is a read error. Was able to minimize it with mounting the boards in a more permanent fixture.


 

SMF spam blocked by CleanTalk