Filter löschen
Filter löschen

how to convert digital pulses into RPM ?

35 Ansichten (letzte 30 Tage)
Aamir Shaikh
Aamir Shaikh am 15 Okt. 2018
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 Kommentare
hussam sukkar
hussam sukkar am 12 Apr. 2022
Can i have the code please I want get RPM By using ir sensor with Arduino uno Please help
Walter Roberson
Walter Roberson am 12 Apr. 2022
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.)

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Mathieu NOE
Mathieu NOE am 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 Kommentare
Walter Roberson
Walter Roberson am 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 am 11 Sep. 2023
Can you explain how the freq counter block works?

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 2 Feb. 2022
Bearbeitet: Walter Roberson am 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 Kommentar
Walter Roberson
Walter Roberson am 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.

Melden Sie sich an, um zu kommentieren.


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

Kategorien

Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by