How to update values from I2C in Simulink using Arduino hardware for the MMA8541 Accelerometer
1 view (last 30 days)
Show older comments
I have followed the tutorial listed on to connect my MMA8541 Accelerometer to an Arduino Uno using Simulink. Iunderstand that the board in the tutorial is different, but I doubt that is the problem, as it should work in a similar fashion: https://ww2.mathworks.cn/help/supportpkg/freedomboard/examples/read-acceleration-data-from-the-onboard-mma8451q-3-axis-digital-accelerometer-via-i2c.html
Unfortunately, no matter how much i research and try various things, I cannot manage to get it to work. This is what my "main" simulink block looks like:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365866/image.jpeg)
The board I am using is the Arduino Uno. I am trying to connect it using I2C. When I do so, no error shows, I this is what i see when I execute the .slx file:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365869/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365872/image.jpeg)
My read configuration:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365875/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365878/image.jpeg)
The output I get stays the same, it doesn't change one bit... Could someone please help me? Ii attached the file below just in case
0 Comments
Answers (1)
Nagasai Bharat
on 28 Sep 2020
Hi,
As the tutorial is given for the onboard accelerometer and the hardware architecture for FRDM Board would be different from Arduino Uno and hence leading to the issue.
Try going through the datasheet for the accelerometer you are using and get the registers right.
Try the model in the above model as it could be of some help.
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!