DC-Motor with Quadrature Encoder Controller
Like the Stepper Motor Controller, the idea is to have an autonomous controller for a DC-motor, featuring a closed loop based on a quadrature encoder and an additional input for reference or limit switch.
The controller acts as an I²C slave connected to the Robo TX or the Robotics TXT. |
Hardware
The first element is the quadrature encoder. I've taken a reference with a 25 mm diameter case and a 4 mm diameter shaft for compatibility with the fischertechnik system. The encoder is rated 200 pulses per rotation, or 800 with a maximum response frequency of 30 kHz.
The quadrature encoder adds the Z phase to the standard A and B phases. The Z phase goes low once per rotation. This allows a precise synchronisation for reference and reset. |
Initially, I wanted to use a C2000 MCU as Texas Instruments brands it for real-time closed loop motor control.
But the Cortex-M4 TM4C MCU provides all the libraries for quadrature encoders in ROM with the TivaWare solution. The TM4C123 also feature two TTL-compatible quadrature encoder inputs, up to 20 MHz. The motor controller comes from the large range offered by Texas Instruments. The DRV8848driver integrates two H-bridges with internal protection functions.
|
3D-Printed Support
Software
The software was developed with the tools I use for embedded computing. The central element is a PID controller, for proportional–integral–derivative controller (reference).
The PID controller monitors the position and the speed of the motor and adjust the pulse-width modulation signal (reference) for the motor accordingly. |
where u = output, e = input = error,
and Kp, Ki, Kd are proportional, integral and derivative factors |
I've investigated three modes:
|
Links
|