Raspberry pi 3 + altimu 10 V5

hi all
i bought the altimu 10 V5 i connect it to raspberry pi 3 like this
Sensor raspi
vin --> 3.3v
sda --> pin 3
scl --> pin 5
gnd --> pin 39

so as i dont have a raspi library i just send command from i2c library witch come in hardware io processing library
the Accelerometer work with no problem
my problem it was with LPS25H
if a read register 0x28,0x29,0x2A these three register output de same value ex: 53,53,53 and it is not stable it can be 39 and -119 and .10 …

i use this code

void setup(){
 writeReg(pressureAddress, 0x20, 0x90); //CTRL1
 writeReg(pressureAddress, 0x10, 0x00);//Res Config
}

void readPressure() {
  i2c.beginTransmission(pressureAddress); //0x5D
  i2c.write(0x28);
  byte[] pressureRaw = i2c.read(3);
 
  byte pxl = pressureRaw[0];
  byte pl = pressureRaw[1];
  byte ph = pressureRaw[2];

  pressure = (int)pressureHigh << 16 | (int)pressureLow << 8 | (int)pressureXL;
  println(pxl);
  println(pl);
  println(ph);
  println(pressure);
}

i read the accelerometer with this methode and its work i have missed up somewhere ?
sorry for my poor english
Danny

Hello.

It looks like you aren’t setting the most significant bit of the register address. As the datasheet says:

In order to read multiple bytes incrementing the register address, it is necessary to assert
the most significant bit of the sub-address field. In other words, SUB(7) must be equal to 1
while SUB(6-0) represents the address of the first register to be read.

Could you try writing 0xA8 instead of 0x28 in i2c.write(0x28); in your code?

-Jon

hi thx for your response
with the 0xa8 register the low and high pressure seem to have good value
but the pxl register have again a weird output Maybe it’s normal
the output pxl at rate of 1 hz show 88, -123, 162, 68,-43,-12…
the problem is when the pxl goes to negative value the millibar value return 0.00567814 instead of a 1013 normal
i correct this by force positive value in the processing script but i dont know if is it the “legit” methode to do that
this is how i force the positive value from pxl

pressure = (int)pressureHigh << 16 | (int)pressureLow << 8 | (int)(pressureXL & 0xff);

can you say me if is it correct ?
thx
Danny

It looks like you are having problems because you are casting pressureLow and pressureXL to signed values, when they should be unsigned (and you should not need to even cast pressureXL). Try:

pressure = (int)pressureHigh << 16 | (unsigned int)pressureLow << 8 | pressureXL;

-Jon

hi
the problem with the pressure its Ok now it work
but now i have a problem with magnetometer
when i read the xHigh register and the sensor was rotated i have this value
0 when its turned half i have 16 if i continue to rotate de value go down and return to 0

ex: 0 = 0
90 = 7
180=16
270=7
360=0
there is my configuration

  i2cWriteReg(addressMag, 0x20, 0x10);
  i2cWriteReg(addressMag, 0x21, 0x00); 
  i2cWriteReg(addressMag, 0x22, 0x00);
  i2cWriteReg(addressMag, 0x23, 0x00);

thx
danny

I am glad your pressure sensor is working now. I do not see anything obviously wrong with how your magnetometer data changes as the board is rotated in full circle like that. To get meaningful compass magnitudes, you should concatenate the 8-bit high and low magnetometer data registers. If you are not sure how to do that, you might look at how we did it in our LIS3MDL Arduino library.

By the way, this Raspberry Pi program should work with the AltIMU-10 v5. We have not added it to the Resources tab of the AltIMU’s product page yet, but we plan to add it soon.

-Jon