MinIMU-9 v2 Gyro, Accelerometer, and Compass (L3GD20 and LSM

Hello,

I just got this sensor and trying to figure out some basic things.

I want to make my own AHRS but i’m stuck in a probably trivial thing, which tho is basicly too.

Having the sensor connected to an Arduino board i only try to read the values the sensor outputs in SCL and SDA pins. I’m trying to find out in which form is the output throughout Datasheet but i can’t find anything.

Can you please help me and explain what are the values and in which type,that being outputed on those pins so i can read them correctly?

The code i’m using is this;

void setup(){
Serial.begin(9600);
}
void loop() {
int an4 = analogRead(A4);
int an5 = analogRead(A5);

Serial.println(an4);
Serial.println(an5,);
delay(1000);
}

In serial output i’m getting 3Digit values 892 or 893

Thank you in andvance,
Minas

Hi Minas,

You need to read the values using the I2C protocol.

I would suggest looking at and running the Arduino demo program for the MiniIMU-9:

github.com/pololu/MinIMU-9-Arduino-AHRS

Mike

Hello Mike,

Firstly, thanks for answering.

Now as it consides my problem, unfortunately i’v already tried the Arduino code but that doesn’t serve my purpose.

What i want to do is this;

Print in serial the output that the sensor gives me and take that output and proccess it in Matlab.
In order to proccess it, i need the data aquired from the sensor.

The problem is that i’m beginer in all these, it’s a part of my Thesis, and the I2C code used for arduino is too complicated for me to understand it because it includes many AHRS essentials inside.

I’v already read alot about I2C in order to understand how it works and still having problems.

Can you please point a way to write a simple code in order just to read the data?

I will use an ARM proccessor “Stellaris LM4F120” for the implementation.
although all the starting coding and testing will be done in Arduino.

With respect,

Minas

You should use the Wire library to read the I2C bus that the sensors output their data on.

Hi, Minas.

I am not sure what code you are looking at. I recommend looking at the individual libraries for the LSM303* and the L3G*; combining the examples together in your own sketch as needed.

- Ryan