필터 지우기
필터 지우기

Reading sensor data off a ICM-20948 via i2c with Arduino uno

조회 수: 42 (최근 30일)
Nathaniel Lee-Chen
Nathaniel Lee-Chen 2021년 10월 4일
댓글: Belal 2023년 8월 17일
So I have a project where I have to read Sparkfun's ICM-20948's data (Gyro, accelerometer, and magnetometer) through matlab, and down the line, I need to perform calculations with those numbers. Im not too familiar with matlab, but the sensor does work with arduino IDE. I have the sensor hooked up via I2C pins. This is my code so far:
a = arduino("COM4","Uno","Libraries","I2C")
s.BaudRate = 115200;
fs = 100;
IMU = device(a,'I2CAddress','0x69');
write(IMU, 0x0, 'uint8');
data = read(IMU, 4, 'uint16')
the output from data was [234, 0, 16384, 65]. Im not sure what these numbers mean. The ICM-20948 was suppose to be a "upgrade" to the mpu9250 according to adafruit's website, but the mpu() command that matlab has does not work with this sensor. My uno is also from sparkfun. The pinout diagram provided by arduino explorer app seems to have SDL and SDH flipped, so im not sure if that would cause any problems? Any ideas on what I should do?

채택된 답변

Gayatri Menon
Gayatri Menon 2022년 3월 13일
편집: Gayatri Menon 2022년 6월 6일
Hi,
Even though ICM20948 is the recommended sensor over MPU9250, the register settings for both the sensors are different. Hence using mpu9250() wouldn't work since this functionality is implemented considering MPU9250 registers.
ICM20948 sensor is supported in MATLAB & Simulink from R2022a.
a = arduino
imu = icm20948(a)
imu.read
imu.readAcceleration
See below links for more info
Hope this helps
Thanks
Gayatri
  댓글 수: 2
Matthew Kirchner
Matthew Kirchner 2023년 4월 17일
I have this chip and use the simulink suport package to read IMU data. Accelerometer and Mag reads correctly, but there appears to be an error in reading the gyro data. It just outputs a bunch of noise. I have purchased from 2 different manufacturers that both implement with the ICM20948 chip and they both produce the same error. It also is present for different platforms: I run in with a Raspberry Pi and also Arduino. Both produce the same gyro read problem.
Belal
Belal 2023년 8월 17일
I'm experiencing the same thing.
Apparently, this library has a problem with the gyro reading.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by