SparkFun LSM9DS1 with Simulink

2 views (last 30 days)
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?

Accepted Answer

Tarik Zengin
Tarik Zengin on 5 Apr 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 Comment
Andrew Rich
Andrew Rich on 3 Nov 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.

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!