Problem compass/accelerometre LSM303DLH

Hello, I'm currently working on designing a robot to move across a lawn and why I bought a compass with accelerometer to guide him in his spot!

Problem: I went to the following site:

and I got a lot of info as well as some code for testing ...

the compilation is fine, but when I set off the monitor series to read information of the module, nothing happens ...
any info on the monitor and even led the Arduino does not flash to the rhythm information sent ...
I tried with UNO and MEGA but no change. Unable to read any info on the monitor.

Do you have an idea to get me out of this misery, because after three days of testing and tweaking, I have no idea!

Thank you in advance!

Have fun!

It is best to start with the Uno and the module.
Do you know this tutorial, Overview | LSM303 Accelerometer + Compass Breakout | Adafruit Learning System

Can you tell us how it is connected ?

To be sure it is connected properly, use the i2c_scanner, Arduino Playground - I2cScanner
It should be detected by the i2c scanner before you can try to use a library for the module.

Erdin:
It is best to start with the Uno and the module.
Do you know this tutorial, Overview | LSM303 Accelerometer + Compass Breakout | Adafruit Learning System

Can you tell us how it is connected ?

To be sure it is connected properly, use the i2c_scanner, Arduino Playground - HomePage
It should be detected by the i2c scanner before you can try to use a library for the module.

Hello and thank you for your reply. I started with an audit of the port as you suggested me and:

I put the monitor on, it looks and when I plug the unit he said:

"
Scanning ...
I2C device found at address 0x18!
I2C device found at address 0x1E!
"

but not "DONE"!

and that's it, I think it then blocks because no other scan.

(I tested the scanner with another I2C module and scanner test loop and does not block and displays "DONE" each time)

we say that as soon as the Arduino access to the module, it freeze.

How is it connected ?

Erdin:
How is it connected ?

Arduino Uno/Duemilanove LSM303 board
5V -> VIN
GND -> GND
Analog Pin 5 -> SCL
Analog Pin 4 -> SDA

Do you have the old LSM303 with a low voltage level of I2C bus, LSM303 Breakout Board - Tilt Compensated Compass - SEN-09810 - SparkFun Electronics
Or the new one with normal levels, LSM303 Breakout Board - Tilt Compensated Compass - SEN-10703 - SparkFun Electronics

If you can manage to get this module working, that doesn't mean you have the right sensor for the robot. The accelerometer values will go wildy up and down when riding across a bumpy lawn, you need a gyro for stability.

Erdin:
Do you have the old LSM303 with a low voltage level of I2C bus, LSM303 Breakout Board - Tilt Compensated Compass - SEN-09810 - SparkFun Electronics
Or the new one with normal levels, LSM303 Breakout Board - Tilt Compensated Compass - SEN-10703 - SparkFun Electronics

If you can manage to get this module working, that doesn't mean you have the right sensor for the robot. The accelerometer values will go wildy up and down when riding across a bumpy lawn, you need a gyro for stability.

sorry but I have no idea of ??the model I have in my possession ...

here is the link to my purchase, if it can help you.

http://cgi.ebay.fr/ws/eBayISAPI.dll?ViewItem&item=330747258116&ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649#ht_1774wt_1186

Erdin:
It is best to start with the Uno and the module.
Do you know this tutorial, Overview | LSM303 Accelerometer + Compass Breakout | Adafruit Learning System

Can you tell us how it is connected ?

To be sure it is connected properly, use the i2c_scanner, Arduino Playground - HomePage
It should be detected by the i2c scanner before you can try to use a library for the module.

I went to see the tutorial link you asked me, it is very boring but no way to compile without error program ...

Do you use Arduino 1.0.5 ?

I studied the photos and have some bad news for you.
You have a sensor with I2C levels that are too low.
But then again, perhaps it was not the right sensor for you, since this sensor is specifically ment for a tilt compensated compass.

The adafruit board has one 3.3V voltage regulator and two I2C level shifters, Triple-axis Accelerometer+Magnetometer (Compass) Board - LSM303 : ID 1120 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits
That could be wrong, the chip does need 1.8V, and I can't find the schematic for that Adafruit board.

The old Sparkfun board has a 3.3V and a 1.8V voltage regulators, and no I2C level shifters.
The new Sparkfun board has both voltage regulators and I2C level shifters.

Your board has a 3.3V and a 1.8V voltage regulator, and no I2C level shifters, therefor you can not use it in a reliable way with an Arduino Uno.

You could buy a level shifter for the I2C, but I suggest to toss this sensor module away.

ok, thank you for your research and consulting ... you seem to know the subject well! that you advise me as to have a product compensated compass (magnetometer compass +) that is consistent and easy with a arduino mega?

Thank you again!

with I2C scanner

without resistance pullup series monitor the plant.

two pullup resistance, it shows this ...

I2C Scanner
Scanning...
I2C device found at address 0x18 !
I2C device found at address 0x1E !
Unknow error at address 0x46
done

Scanning...
I2C device found at address 0x18 !
I2C device found at address 0x1E !
Unknow error at address 0x4B
done

Scanning...
I2C device found at address 0x18 !
I2C device found at address 0x1E !
Unknow error at address 0x44
done

Scanning...
I2C device found at address 0x18 !
I2C device found at address 0x1E !
Unknow error at address 0x43
done

Scanning...
I2C device found at address 0x18 !
I2C device found at address 0x1E !
Unknow error at address 0x46
Unknow error at address 0x7B
done

Scanning...
I2C device found at address 0x18 !
I2C device found at address 0x1E !
Unknow error at address 0x43
done

Scanning...
I2C device found at address 0x18 !
I2C device found at address 0x1E !
Unknow error at address 0x44
done

etc....

I think that is what you get with I2C levels that are not good, it's an indication that the I2C is not stable (= unusable).

You can look at the Sparkfun and Adafruit site for a seperate accelerometer and magnetometer. There is no difference between a single chip or a few sensor boards.

The HMC5883L is the most common magnetometer. You have to calibrate it, but I think you have to calibrate all magnetometers.
There are many accelerometers, and also 9DOF/6DOF/10DOF or IMU boards, they have a number of sensors, some include an magnetometer.

But what do you want to achieve ?
If the robot is on 4 wheels, it is more or less horizontal. You can use the magnetometer as it is.
Or is the lawn on a steep hill ?
The accelerometer is sensitive for vibrations. To get a normal tilt angle, you would have to stop the robot to calculate the tilt compensated compass.

You can try to make the robot with magnetometer first and add new sensors along the way. That is how I make my projects: start with something, see where it ends.

Erdin:
I think that is what you get with I2C levels that are not good, it's an indication that the I2C is not stable (= unusable).

You can look at the Sparkfun and Adafruit site for a seperate accelerometer and magnetometer. There is no difference between a single chip or a few sensor boards.

The HMC5883L is the most common magnetometer. You have to calibrate it, but I think you have to calibrate all magnetometers.
There are many accelerometers, and also 9DOF/6DOF/10DOF or IMU boards, they have a number of sensors, some include an magnetometer.

But what do you want to achieve ?
If the robot is on 4 wheels, it is more or less horizontal. You can use the magnetometer as it is.
Or is the lawn on a steep hill ?
The accelerometer is sensitive for vibrations. To get a normal tilt angle, you would have to stop the robot to calculate the tilt compensated compass.

You can try to make the robot with magnetometer first and add new sensors along the way. That is how I make my projects: start with something, see where it ends.

indeed, the use of HMC5883L is a good solution. I started by using the magnetometer with the purchase of LSM303. The purpose of the robot is to make straights at 0 ° (for example) and then turn 180 degrees and repeat exactly a straight line and turn back to 180 ... it must be the bands in the lawn. And use of HMC5883L lack of stability, as and as the vehicle moves, the magnetic north changes bisarement place for the sensor ... have you ever used this type of sensor for a similar project.?

I used it, but only for testing, not on a robot.
Perhaps the motors and wires of the robot disturb the magnetometer, it is sensitive. I tried using it as metal detector, by detecting a disturbance in the earth magnetism and that worked a little. So it is very sensitive.

The accelerometer for tilt compensation is when you hold the sensor tilted. I think it will do no good on a robot that is moving on a lawn.

To get something stable, you could scale up to accel + gyro + compass.
Those sensors, with filtering, will result in a better orientation in 3D.
http://forum.arduino.cc/index.php/topic,58048.0.html