LSM303 problem

I am using the LSM303DLH board from pololu, I am working on an arduino uno and I have connected the sensor in the following way: Uno LSM303DLH 5V -> VIN GND -> GND Analog Pin 5 -> SCL Analog Pin 4 -> SDA

The library https://github.com/ryantm/LSM303DLH doesn’t work for me, I can’t interface the sensor by using the Wire library because my arduino freezes at Wire.beginTrasmission(). Any idea? Does this breakout board work at 5V or at 3.3V? Thanks.

The I2C bus requires pull-up resistors on both lines. If the breakout board doesn't have them you have to provide them.

the board has the pullup resistors.

Is it hanging when you call the enable function?

I supply 3.3V to it haven't tried the 5V

daddym85: The library https://github.com/ryantm/LSM303DLH doesn’t work for me, I can’t interface the sensor by using the Wire library because my arduino freezes at Wire.beginTrasmission().

If your code isn't working you might get better advice if you posted your code.

They say the Vin line will take 2.6V to 5.5v and there are two regulators to provide 3.0V VDD and 1.8V VIO. The chip requires 2.5V to 3.3V for VDD and is run off the 3.0V regulator. I guess if you give it 2.6V for Vin you can get 2.5V out of the regulator.

btsp:
the board has the pullup resistors.

Is it hanging when you call the enable function?

I supply 3.3V to it haven’t tried the 5V

Yes, my arduino is hanging when I call the enable function. It freezes at Wire.beginTrasmission.
My code comes from the example:
#include <Wire.h>
#include <LSM303DLH.h>

LSM303DLH compass;

void setup() {
Serial.begin(9600);
Wire.begin();
compass.enable();
}

void loop() {
compass.read();

Serial.print("A ");
Serial.print("X: “);
Serial.print(compass.a.x);
Serial.print(” Y: “);
Serial.print(compass.a.y);
Serial.print(” Z: ");
Serial.print(compass.a.z);

Serial.print(" M ");
Serial.print("X: “);
Serial.print(compass.m.x);
Serial.print(” Y: “);
Serial.print(compass.m.y);
Serial.print(” Z: ");
Serial.println(compass.m.z);

delay(100);
}

void LSM303DLH::enable(void)
{
//Enable Accelerometer
Wire.beginTransmission(ACC_ADDRESS);
Wire.send(CTRL_REG1_A);
//0x27 = 0b00100111
// Normal power mode, all axes enabled
Wire.send(0x27);
Wire.endTransmission();

//Enable Magnetometer
Wire.beginTransmission(MAG_ADDRESS);
Wire.send(MR_REG_M);
//0x00 = 0b00000000
// Continuous conversion mode
Wire.send(0x00);
Wire.endTransmission();
}

Can I try to supply 3.3V?

i am assuming the void LSM303DLH::enable(void) function is in the LIB. and you are not putting it in the code?

but try supply the 3.3 volts to it and let me know how that goes.

Yes, the void LSM303DLH::enable(void) function is only in the library

you tried using 3.3v?

btsp: you tried using 3.3v?

Yes, I have connected VIN to 3.3v but my code doesn't work. Any idea? Thanks.

daddym85: I am using the LSM303DLH board from pololu, I am working on an arduino uno and I have connected the sensor in the following way: Uno LSM303DLH 5V -> VIN GND -> GND Analog Pin 5 -> SCL Analog Pin 4 -> SDA

The library https://github.com/ryantm/LSM303DLH doesn’t work for me, I can’t interface the sensor by using the Wire library because my arduino freezes at Wire.beginTrasmission(). Any idea? Does this breakout board work at 5V or at 3.3V? Thanks.

I have the same problem , do you solve it??