Page 2 of 2

Re: ESP32 GPIO Interrupts Missing

Posted: Sun Nov 10, 2024 7:59 am
by BivvyCoder
Unfortunately it looks like the motor hardware is the problem - on some motors the rising edge on CHA is before the falling edge on CHB and on others it's the other way round. I'm getting very consistent results across the batch of motors I'm testing with ~50% counting less pulses than the other 50%

However I do know which way the motor should be running, so I'm going to try a couple of different approaches:
  1. Before turning on the power to the motor, configure the counter for the expected direction.
  2. Set up two counters for each motor - one configured for clockwise rotation the other for anticlockwise, and then use these to derive the correct number of shaft rotations

Re: ESP32 GPIO Interrupts Missing

Posted: Mon Nov 11, 2024 1:43 pm
by MicroController
on some motors the rising edge on CHA is before the falling edge on CHB and on others it's the other way round.
Yuck!
Sounds like they wired up the encoders at random :roll:
Before turning on the power to the motor, configure the counter for the expected direction.
I think I was about to suggest the same. Upon initial setup, a quick 'calibration' would help; running the motor a few steps in a known direction and noting the sign of the resulting pulse count; then either switching the channel configurations if needed, or sign-correcting every future reading.

Re: ESP32 GPIO Interrupts Missing

Posted: Tue Nov 26, 2024 11:11 am
by BivvyCoder
I've given up trying to create a solution in the firmware - found a different supplier who make an (almost) identical motor with an encoder that works correctly