Reading data from BMX160 sensor to Simulink

I have an Arduino Uno connected to the DFRobot BMX160+BMP388 sensor.
I need to pull data from the sensor to the Simulink eventually on the Airspeed indicator, Horizon indicator and Heading indicator. I never used simulink before and I have been trying to do it using I2C Read block but I am not sure how to connect it or get any data from it.

Answers (1)

Hi,
I understand that you are trying to read data from a sensor connected to an Arduino into Simulink. You can follow the steps below:
  • Open Simulink
  • Create a new model
  • Add a new block, 'I2C Read,' to the model
  • Add a display block and connect it to the output of the 'I2C Read' block
  • Open the model configuration parameters and set the hardware board property under the Hardware Implementation Pane to Arduino. For more information, refer to the documentation page Set Model Configuration Parameters for a Model
  • Save the model
For reading data from a specific I2C slave address or the I2C slave register address, refer to the documentation page I2C Controller Read
I would also recommend you using MATLAB version R2015a or newer
Regards,
Anilkumar V

Categories

Products

Release

R2020a

Asked:

on 19 Nov 2020

Answered:

on 21 Mar 2024

Community Treasure Hunt

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

Start Hunting!