ESP32 GPIO Interrupts Missing

BivvyCoder
Posts: 15
Joined: Sun Jan 28, 2024 5:20 pm

Re: ESP32 GPIO Interrupts Missing

Postby BivvyCoder » Sun Nov 10, 2024 7:59 am

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

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32 GPIO Interrupts Missing

Postby MicroController » Mon Nov 11, 2024 1:43 pm

BivvyCoder wrote:
Sun Nov 10, 2024 7:59 am
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.

Who is online

Users browsing this forum: No registered users and 89 guests