how to convert digital pulses into RPM ?

30 次查看(过去 30 天)
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

请先登录,再进行评论。

回答(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
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