TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: Grimstone on April 16, 2014, 09:28:05 AM

Title: Compass Shield Quandary
Post by: Grimstone on April 16, 2014, 09:28:05 AM
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?
Title: Re: Compass Shield Quandary
Post by: Grimstone on May 13, 2014, 03:39:26 PM
Buggy board or...?
Title: Re: Compass Shield Quandary
Post by: tinybuilder on May 29, 2014, 08:38:27 AM
Hi-

Could you post your code?
Title: Re: Compass Shield Quandary
Post by: Grimstone on June 03, 2014, 08:08:48 AM
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.