how to convert digital pulses into RPM ?

66 views (last 30 days)
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 Comments
hussam sukkar
hussam sukkar on 12 Apr 2022
Can i have the code please I want get RPM By using ir sensor with Arduino uno Please help

Sign in to comment.

Answers (3)

Mathieu NOE
Mathieu NOE on 2 Feb 2022
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 Comments
Walter Roberson
Walter Roberson on 5 Feb 2022
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 on 11 Sep 2023
Can you explain how the freq counter block works?

Sign in to comment.


Walter Roberson
Walter Roberson on 2 Feb 2022
Edited: Walter Roberson on 12 Apr 2022
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 Comment
Walter Roberson
Walter Roberson on 2 Feb 2022
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.

Sign in to comment.


SASANK DAS
SASANK DAS on 5 Feb 2022
for simulation of pid controller what should I use ND filter coefficient value 1 or 100?

Categories

Find more on Arduino Hardware 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!