ESP32 GPIO Interrupts Missing

BivvyCoder
Posts: 18
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: 1821
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.

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

Re: ESP32 GPIO Interrupts Missing

Postby BivvyCoder » Tue Nov 26, 2024 11:11 am

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

Who is online

Users browsing this forum: No registered users and 46 guests