how to convert digital pulses into RPM ?

조회 수: 30 (최근 30일)
Aamir Shaikh
Aamir Shaikh 2018년 10월 15일
댓글: Phongsathorn Ketsaming 2023년 9월 11일
I am using IR sensor to measure rotational speed with Arduino Uno and interfacing it with MATLAB Simulink. IR sensor is generating digital pulses and I want the output in terms of RPM that can be used in the Simulink model. So help me to convert pulses into RPM...
  댓글 수: 6
hussam sukkar
hussam sukkar 2022년 4월 12일
Can i have the code please I want get RPM By using ir sensor with Arduino uno Please help
Walter Roberson
Walter Roberson 2022년 4월 12일
We would have the same questions for you that I had earlier at https://www.mathworks.com/matlabcentral/answers/424051-how-to-convert-digital-pulses-into-rpm#comment_1965635 (expand comments in this thread to see that.)

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

답변 (3개)

Mathieu NOE
Mathieu NOE 2022년 2월 2일
hello
see attached simulink file (R2020b)
using a counter you can compute the frequency of your inputs signal between successives pulses
use a fixed step solver and make sure the sampling rate is correct (second input of the block)
my output is in Hz , to have RPM simply mulitply it by 60
hope it helps
  댓글 수: 4
Walter Roberson
Walter Roberson 2022년 2월 5일
Mathieu's diagram can potentially work if the blocks including the Hit Crossing are being deployed to the Arduino — which is a valid thing to do.
However, if the model is being run entirely on the host, and the voltage readings of signal 1 are being sent to the host for analysis, then you run into significant challenges with the effective data transfer throughput and latency between the Arduino and the host, especially if (as is common) you are using the serial-over-USB connection. The situation is less bad if you use Ethernet
Phongsathorn Ketsaming
Phongsathorn Ketsaming 2023년 9월 11일
Can you explain how the freq counter block works?

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


Walter Roberson
Walter Roberson 2022년 2월 2일
편집: Walter Roberson 2022년 4월 12일
Arduino Uno
50micro sec sampling time,
Can i convert these digital pulses into rpm for tracking the speed of the motor
No, you cannot.
50 microseconds is 20000 Hz.
If you have the Arduino notify Simulink every time a pulse comes in, then you run across the problem that USB Host Controllers (at least for USB 1 and USB 2) are defined as polling the USB bus 1000 times per second, so the absolute maximum number of events per second you could register would be 1000; the practical number of events per second is much lower than that (in the 40 to 200 range.) USB 1 and USB 2 are strictly controller / controlled architecture; there is no possible way for a peripheral to interrupt a USB host controller to say that data is ready. (Apparently USB 3.1 does have some interrupt abilities.)
If you are expecting < 40 or so pulses per second, then you might be able to do approximate counting; but you would not be able to localize to less than 1 millisecond.
The situation would be a bit different if the arduino was permitted to either count on its own and send numbers periodically (such as 10 per second), or else to buffer events (and local timestamps) and send a group of them.
Also, you can get higher throughput if you use ethernet instead of serial over USB.
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 2월 2일
The rules change somewhat if you are writing a (small) model to be deployed onto the Arduino... in which case there would need to be output back to any part of the model running on the host.

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


SASANK DAS
SASANK DAS 2022년 2월 5일
for simulation of pid controller what should I use ND filter coefficient value 1 or 100?

카테고리

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