SparkFun LSM9DS1 with Simulink

6 visualizaciones (últimos 30 días)
Tarik Zengin
Tarik Zengin el 5 de Abr. de 2021
Comentada: Andrew Rich el 3 de Nov. de 2021
Hi,
Simulink Support Package for Raspberry Pi has a block for LSM9DS1 IMU sensor. However, this block belongs to the SenseHat group. So it acquires data from the sensehat board. SenseHat has this sensor working in SPI mode, see the SenseHat Schematics . (This IMU IC has I2C mode as well.)
Sparkfun also has a breakout board having the same IC. SparkFun 9DoF IMU Breakout - LSM9DS1. It supports both SPI and I2C interfaces.
Is it possible to read this breakout board using the Simulink LSM9DS1 block? If so, how would the connection be? I have tried directly connecting the I2C pins to Raspi GPIO (SDA, SCL) but it didn't work. Breakout board was set to I2C mode. There are some jumpers on the PCB to set the board to SPI mode. These have to be cut in order to use it with SPI connection. I didn't want to cut the traces without knowing it will work or not. SenseHat schematics show that the interrupt pins of LSM9DS1 are connected to an ATtiny MCU. I could't find the realted part in the sensehat firmware. Therefore I don't know what to connect the interrupt pins of the Sparkfun breakout board.
Is there anyone who could read this breakout board using only simulink? An s-function would be a solution but it will take some time to implement the LSM9DS1 library to simulink. Any recommendations?

Respuesta aceptada

Tarik Zengin
Tarik Zengin el 5 de Abr. de 2021
Apparently it was possible. I just found out how to do it when I compare the schematics of the two boards.
So pulling up the CS pins to VDD and pulling down the SDO pins to ground on the Sparkfun breakout board were enough. Not Simulink block of LSM9DS1 reads all the 3 sensors.
PS: I was wrong with the SenseHat reading the sensor in SPI mode. It reads the sensor in I2C mode.
  1 comentario
Andrew Rich
Andrew Rich el 3 de Nov. de 2021
Hey just out of curiousity, how did you get this work? I am trying to use the gyro on the breakout board but I can not get it to work. Please let me know.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Raspberry Pi Hardware en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by