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.
Motor RPM using interrupt ESP IDF
-
- Posts: 4
- Joined: Fri Jan 12, 2018 1:48 pm
Motor RPM using interrupt ESP IDF
- Attachments
-
- motor.jpg (973.5 KiB) Viewed 5197 times
Re: Motor RPM using interrupt ESP IDF
I think the pulse counter peripheral may be more suited for your application.
Documentation and example code can be found here: https://docs.espressif.com/projects/esp ... /pcnt.html.
Best,
Jakob
Documentation and example code can be found here: https://docs.espressif.com/projects/esp ... /pcnt.html.
Best,
Jakob
-
- Posts: 4
- Joined: Fri Jan 12, 2018 1:48 pm
Re: Motor RPM using interrupt ESP IDF
Thanks Jakob,
I tested the code but it only gives the pulse but for time-based calculation I need help.
Can you?
I tested the code but it only gives the pulse but for time-based calculation I need help.
Can you?
Who is online
Users browsing this forum: Bing [Bot] and 236 guests