Hey everyone. I am relatively new to some of these concepts so just keep that in mind. I bought the MinIMU-9 v3 last week along with the Teensy 2.0 pjrc.com/store/teensy.html.
I connected the two as follows.
Teensy 2.0 → MinIMU-9
SCL PD0 → SCL
SDA PD1 → SDA
Vcc → Vin
GND → GND
I attached pictures of my setup.
I am using the following libraries:
L3G: github.com/pololu/l3g-arduino
LSM303: github.com/pololu/lsm303-arduino
I am running the simple script, “Serial”, from the examples in the LSM303 library. Here is the code:
#include <Wire.h>
#include <LSM303.h>
LSM303 compass;
char report[80];
void setup()
{
Serial.begin(9600);
Wire.begin();
compass.init();
compass.enableDefault();
}
void loop()
{
compass.read();
snprintf(report, sizeof(report), "A: %6d %6d %6d M: %6d %6d %6d",
compass.a.x, compass.a.y, compass.a.z,
compass.m.x, compass.m.y, compass.m.z);
Serial.println(report);
delay(100);
}
Here is a sample of the outputs.
A: -12436 77 11178 M: 14913 530 -32768
A: -12392 47 11171 M: 14889 538 -32768
A: -12406 57 11179 M: 14889 538 -32768
A: -12398 100 11170 M: 14905 554 -32768
A: -12415 91 11108 M: 14910 540 -32768
A: -12428 50 11129 M: 14910 540 -32768
A: -12430 54 11103 M: 14902 535 -32768
A: -12445 70 11161 M: 14897 572 -32768
A: -12423 70 11164 M: 14897 572 -32768
A: -12392 68 11211 M: 14899 534 -32768
A: -12363 19 11166 M: 14911 546 -32768
A: -12380 61 11146 M: 14911 546 -32768
A: -12421 59 11181 M: 14901 552 -32768
A: -12375 70 11156 M: 14909 526 -32768
A: -12399 75 11144 M: 14909 526 -32768
A: -12442 78 11137 M: 14896 538 -32768
A: -12460 88 11146 M: 14910 537 -32768
All of the values do what I expect as I move the chip, except for the z-axis of the magnetometer. The z-axis of the magnetometer is always -32768. I assume it is an overflow but I have been unsuccessful in troubleshooting the issue.
Thanks in advance.