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

6 ビュー (過去 30 日間)
Jorge Polo
Jorge Polo 2020 年 9 月 9 日
回答済み: MULI 2024 年 9 月 23 日
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 件のコメント
Irem Uzun
Irem Uzun 2024 年 5 月 11 日
hello! could you solve that? Does it work?

サインインしてコメントする。

回答 (1 件)

MULI
MULI 2024 年 9 月 23 日
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 Center および File ExchangeRaspberry Pi Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by