How to get accurate RPM using a Raspberry pi board with Simulink?

11 次查看(过去 30 天)
I'm using a Raspberry pi 2 model B with three photo interrupter sensors (https://www.waveshare.com/photo-interrupter-sensor.htm) to get the RPM of three different BLDC motors. I want to use Simulink as control interface. To get the RPM of each motor, I made a basic matlab function, that computes the motor speed when a sensor detects an obstacle (the obstacle is in fact a disk encoder with 20 holes). However, when I run the model and take some measures, the reading is not accurate at all. It does'nt measure the motor's real speed and the simulation is limited on speed (500RPM max). I guess is a problem with timing, but I don't have much experience dealing with timing in Simulink. Any tips or advice would be really appreciate. Thanks!
Below is the block diagram in Simulink:

回答(1 个)

MULI
MULI 2024-9-23,4:50
Hi Jorge,
I understand you are facing an issue with timing for the RPM measurement in Simulink. To improve accuracy and handle timing problems, consider the following suggestions:
Reduce Sample Time:
  • Simulink uses discrete time steps, so if the sample time is too large, it may miss fast sensor changes.
  • Reduce the step size in your Simulink model to capture state changes more accurately.
Debouncing:
Accumulate State Changes:
  • Instead of calculating RPM after every single state change, try accumulating several state changes and then average the time. This will make the RPM readings more stable.
Implementing these changes can improve the accuracy and reliability of your RPM measurements in Simulink.

类别

Help CenterFile Exchange 中查找有关 Raspberry Pi Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by