To design a cost effective motor speed controller for high power motors compatible with incremental, absolute and analog encoders. Provision for daisy chain is preferred having single bus data transfer (or I2C communication).
Considering the operating frequency and number of pins, ATmega328P was the choice for microcontroller. G2 24v13 Motor driver form Pololu was chosen for this application. Circuit and PCB design was done in Autodesk Eagle Software considering peripherals for serial and SPI programming, Encoders, I2C for daisy chaining of motor drivers.
github link for PCB layout and codeA PID control in discrete time is implemented for the speed control of the motor. The design was carried out for a 12V 16.7rpm Cytron Motor.
First the motor’s transfer function is found by fitting a Second Order plus Dead Time transfer function to the step response of the motor.
The transfer function in discrete domain is found using the SOPDT model.
A block of the controller is shown below. The controller was simulated and tuned in MATLAB Simulink for the least settling time and oscillations possible.
An Arduino code was written for implementing the PID speed control considering data overflow, noise filtering of sensor data and loop time.