Motor RPM using interrupt ESP IDF
Posted: Thu Jun 10, 2021 10:49 am
Hello Members,
I hope you all are doing well. I am new to ESP IDF and need your help to develop a small code to measure the RPM of a Motor. I used a proximity sensor to detect the pulse at every rotation of a motor. Add its photo for a better idea.
I have the logic but I don't know how to write code for IDF.
Logic:
so using interrupt I want to measure the time between 2 pulses and out of that I want to calculate the RPM.
Example Let's say in 100 milliseconds will get 1 pulse, so in a minute/60 second/60000 milliseconds how many? so x=60000/100 so x=600 pulse in a minute which means the motor is rotating with 600RPM.
Can you please help me to write code for this?
Attaching the image for a better idea about I connect the sensor to get 1 pulse for a rotation.
I hope you all are doing well. I am new to ESP IDF and need your help to develop a small code to measure the RPM of a Motor. I used a proximity sensor to detect the pulse at every rotation of a motor. Add its photo for a better idea.
I have the logic but I don't know how to write code for IDF.
Logic:
so using interrupt I want to measure the time between 2 pulses and out of that I want to calculate the RPM.
Example Let's say in 100 milliseconds will get 1 pulse, so in a minute/60 second/60000 milliseconds how many? so x=60000/100 so x=600 pulse in a minute which means the motor is rotating with 600RPM.
Can you please help me to write code for this?
Attaching the image for a better idea about I connect the sensor to get 1 pulse for a rotation.