how to convert digital pulses into RPM ?

29 visualizaciones (últimos 30 días)
Aamir Shaikh
Aamir Shaikh el 15 de Oct. de 2018
Comentada: Phongsathorn Ketsaming el 11 de Sept. de 2023
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 comentarios
hussam sukkar
hussam sukkar el 12 de Abr. de 2022
Can i have the code please I want get RPM By using ir sensor with Arduino uno Please help
Walter Roberson
Walter Roberson el 12 de Abr. de 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.)

Iniciar sesión para comentar.

Respuestas (3)

Mathieu NOE
Mathieu NOE el 2 de Feb. de 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 comentarios
Walter Roberson
Walter Roberson el 5 de Feb. de 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 el 11 de Sept. de 2023
Can you explain how the freq counter block works?

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 2 de Feb. de 2022
Editada: Walter Roberson el 12 de Abr. de 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 comentario
Walter Roberson
Walter Roberson el 2 de Feb. de 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.

Iniciar sesión para comentar.


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

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by