Controlling BRUSHED dc motors with quadrature encoders?
Posted: Sun May 20, 2018 9:46 pm
I'm working on a self balancing robot (ie: like a minature segway) which has two brushed DC gearmotors with hall effect quadrature encoders on them. I'm using DRV8871 https://www.adafruit.com/product/3190 as the motor driver.
The first robot I built was using an Adafruit feather m0 board and I controlled the motor driver using the analog and digital write pin commands to switch the control pins and send PWM.
On ESP32 I see there is the MCPWM unit. Can MCPWM be setup to read the quadrature encoders AND control the motor PWM? I have seen an example that does motor PWM but NOT one that also has MCPWM reading the quadrature encoders. If the hardware can do this it would be a big help as these robots have tight timing requirements so having hardware reading/saving encoder info would help.
Also, does MCPWM have any way to also use the encoder output to manage motor speed? Or would that have to be done in software with a PID loop or something similar that reads the encoder count and adjusts the PWM output?
By the way I'm using ARDUINO right now because I'm building several robots with different CPUs and the cross platform support is helpful, can MCPWM be used from ARDUINO IDE?
Any help/examples would be appreciated.
The first robot I built was using an Adafruit feather m0 board and I controlled the motor driver using the analog and digital write pin commands to switch the control pins and send PWM.
On ESP32 I see there is the MCPWM unit. Can MCPWM be setup to read the quadrature encoders AND control the motor PWM? I have seen an example that does motor PWM but NOT one that also has MCPWM reading the quadrature encoders. If the hardware can do this it would be a big help as these robots have tight timing requirements so having hardware reading/saving encoder info would help.
Also, does MCPWM have any way to also use the encoder output to manage motor speed? Or would that have to be done in software with a PID loop or something similar that reads the encoder count and adjusts the PWM output?
By the way I'm using ARDUINO right now because I'm building several robots with different CPUs and the cross platform support is helpful, can MCPWM be used from ARDUINO IDE?
Any help/examples would be appreciated.