Hello! I’m currently working on developing an ESPHome device that incorporates a motor with an encoder. Here’s a brief overview of the setup and the challenges I’m facing.
Motor Specifications
- Motor Type: Encoder motor
- Pulses per Revolution: 1 pulse
- Gear Reduction Ratio: 1/520
- Output Shaft Revolutions: Every 520 motor revolutions corresponds to 1 revolution of the output shaft.
- Motor Speed: 6400 RPM
Current Implementation
I have implemented a pulse counter and a lambda function that halts the motor after it receives 520 pulses. In my test case, I aim to run the motor until it accumulates 520 pulses and then stop it.
Observations
While testing, I’ve noticed that:
- Most of the time, the motor shaft turns exactly 1 revolution.
- Occasionally, it either turns too much or too little.
Adjustments Made
To improve performance, I changed the update interval to 10 milliseconds. However, this adjustment has not resulted in a stable solution.
Questions for Improvement
- How can I accurately count the pulses?
- Is there a limit on pulses per minute (PPM) that I should consider to ensure accuracy?
I appreciate any insights or suggestions on how to enhance the accuracy of pulse counting in my ESPHome device. Thank you