Auto Tuning High Current Motor Control Unit, Journal Article
Auto Tuning High Current Motor Control Unit, Journal Article
ABSTRACT: The paper presents the design and development of a dual-channel motor control unit. It is developed
with auto-tuning feature and encoder support for both loads. DC motors are controlled using encoder feedback and
the auto-tuned result is obtained by implementation of system-identification technique and real-time hardware
simulation using MATLAB Simulink. The obtained result is then passed to the motor drive equations for control
application. The complete development with the results of the dual-channel motor control unit is explained and
clarified in this paper.
KEYWORDS: DC Motor driver, Encoder, Control System, MATLAB Simulink, Auto-tuning, System-
identification.
I. INTRODUCTION
DC motor control is very important in automation, robotics and electromotive applications. PID (Proportional –
Integral – Derivative) controller is a well-known controller implemented for motor control applications. The PID
controller requires fine manual tuning of kp, ki, kd constants, which is tedious at times.[7] The motive behind this
was to develop a single module that performs the tasks of motor control and thereby making it simpler by
implementing auto-tuning and motor control algorithms that support high current drive applications. The module is
designed to support UART communication for IoT based industrial applications. The concept proposes the idea of
implementing motor control by real-time simulation to obtain accurate run-time control parameters. The module is
designed to communicate with other similar modules by creating a network that is connected over a single
UART(Universal Asynchronous Receiver Transmitter) channel and controlled by a single master microcontroller.
Further, it explains the functions that are built to process the constants resulting from the model and executing on the
hardware we built.
II. DESIGN AND DEVELOPMENT OF BOARD
The motor-controller is developed using STM VNH5019A-E and Arduino Micro ATmega32u4. The basic purpose
of integrating the microcontroller was for the auto-tuning of motors and for establishing communication with
external controllers. As a rudimentary stage of design, a small break-out of IC VNH5019 was made with an
approximate area of the patch to sustain maximum drive current load about 30A. The required biasing components
for the ICs according to parameters are taken from the schematic provided in the datasheet of VNH5019[1] see fig 1.
The reverse battery protection is practiced by inserting a NMOS in the right direction of the positive supply line and
protects the load against the battery misconnection. In case of reversal of the battery terminals no voltage is supplied
forward and the connection is cut preventing harm to any other electronic component[2].A charge pump circuit
provides input to the gate terminal of the NMOS. Whenever battery polarity is reversed the diode to the ground as
shown in fig.2 is reverse biased and thereby disconnecting thereby charge-pump input and turning the NMOS off.
The charge pump input to the NMOS in this application is provided by the VNH5019 IC itself.
So, as per electrical requirements, the external Power NMOS used for the reverse battery protection should have the
following characteristics:[1]- BVdss > 20 V(for a reverse battery of -16 V); RDS (on) < 1/3 of H-bridge total RDS (on)
[1].Considering the above parameters a power NMOS used is CSD18511KTT 40-V N-Channel Power MOSFET
[3].
The max input power voltage of the motor-controller is 24V, for stable design parameters of the module. The input
power is then regulated by LM7805-SOT223[4] voltage regulator to 5V. This regulated 5V output is fed via a 3-pin
switch to power the microcontroller Arduino Micro-ATMega32u4 [5] as well as for the status LEDs and to power
encoders. The Arduino Micro performs the auto-tuning task when interfaced with MATLAB Simulink in external
mode. The main purpose of considering Arduino Micro as the on-board microcontroller is because there is an
Arduino Hardware add-on that Simulink supports which is lucid to develop and deploy. Also, Arduino Micro has the
provision of UART communication and five external interrupt pins that are required to interface with incremental
encoders. The onboard microcontroller is also fed with different drive functions which makes the motor controlling
task very easy for naive users. We have built functions including acceleration, de-acceleration, 2-wheel drive
equation, position tuning which are used for embedded robotics applications.
The PCB schematic is designed as per the features discussed above, and it is divided into two parts.
microcontroller, which then determines the RPM from these inputs from encoders. The VNH5019A-E ICs are
interfaced with microcontrollers via biasing resistors (1210 smd package). Following are the pin connections done
between the motor driver IC and Arduino Micro:
As mentioned in the schematic, these pins are connected via different resistors used for biasing. The resistor in series
to INA, INB and PWM pins are 1kΩ resistors. The ENA, ENB which are the enable pins are pulled up to 5V via
3.3kΩ resistors and the current sense pins CS are connected via 1kΩ series resistor and pulled down via 10kΩ
resistor to the respective Arduino Micro pin (fig.3.2).[4][1]. Decoupling capacitors are connected to the input and
output of LM7805 with 100uF at the input and 10uF output, both these capacitors (smd package 1206). The status
LED (smd package 1206) is present to indicate the power of the module. The gate of reverse polarity MOSFET is
connected to the charge-pump pin of the motor driver IC and the source is connected to the input battery terminal
(VBAT). The drain of the NMOS CSD18511KTT is the VCC output which is supplied further[3].Screw terminals
are used for the input from the battery and for the output to the motors. A dual-layered board layout is designed
with all the electrical parameters and efficient placement of the components to fulfill the complexity of multiple
traces. Different trace widths are set considering the max amount of current flowing through it.The designed unit has
maximum trace patches of 5.5mm width to drive high current up to 30A on 4OZ the copper thickness of the board.
The layout has top and bottom layered ground planes along with vias of 0.3 mm diameter. The overall dimension of
the motor-controller is 83x84mm. The complete design of the board and model is as shown in fig. 5 and fig.6
respectively.
A MATLAB Simulink model is deployed on the onboard ATMega32u4 to obtain the auto-tuned PID constants to
control the motor. These constants are then fed to the motor control equations to perform the desired operation. PID
tuning is possible in two ways 1) Physical tuning 2) Model-based tuning. Physical tuning is the manually tweaking
of constants by running the trial and error approach on physical hardware, whereas the model-based tuning is
creating a mathematical model of the system by different equations and then simulating the model to obtain the PID
constants[8]. The physical tuning is rather time-consuming and tedious; also the model-based tuning requires a lot of
mathematics. In order to overcome these problems,a system-identification process is implemented on the motor
control unit. This process builds a mathematical structure of dynamic systems by knowing the input and output
response of the system.
MATLAB supports an add-on system-identification app that helps in such physical hardware-based model tuning.
This system-identification app develops a transfer function based on the input and output response provided. Motor-
controller tuning is done with the help of encoder feedback. The encoder output is in the form of high-low pulses,
these pulses are converted to ticks and then to determine the speed in RPM. A Simulink model is deployed to
determine the output speed response at a particular input. This model is developed with the help of Arduino
Hardware Add-on. The Arduino Hardware add-on features various blocks with different functions like digital input,
digital output, PWM, External interrupt, etc. These blocks along with other Simulink blocks are used to generate the
output speed response in real-time running on external mode.
The input and output from this Simulink block are sent to the Matlab workspace at real-time when simulated in
external mode and the input and output response graphs are plotted accordingly.
fig.12
This transfer function is then put in as a model and the PID constants are developed by the auto-tune PID block of
Simulink model as shown in the fig.12. The PID constants are then obtained as a result of the auto-tuning
process[8]. The resultant constants are then passed to the functions as parameters to perform the motor control
applications.
V. FUNCTIONS
To control and drive the hardware according to the need, the algorithms are built and the codes are executed on
ATMega32u4. UART is used to communicate between the other master microcontroller and the motor-controller
unit that we built. Each instruction to be fed is broken down and packed together in a block before transmission .
Address (8-bits)
Checksum (8-bits)
Length of blocks represents the number bits the block will contain, it is required as the blocks are continuously
transmitted so to differentiate between the blocks the length is required.Each motor controller has its own unique
address by which it is addressed. The addresses can be between 128 to 132 and none of the controllers should have
the same address if it is being used in series as it would lead to a conflict. If all the units are connected in series only
one should be connected to a microcontroller which acts as a master and forms a communication channel. A total of
five units can be connected together in series. Connecting more than five controllers in series would cause a delay
between the communication of microcontroller and the motor-controller. Each function has an instruction code
representing it, and the set of parameters associated with the execution of those functions.If some of the bits are
missed as a transmission error, it is detected and the entire block can be discarded by the checksum block. In such a
case a request for re-transmission is sent to the master microcontroller from the motor controller unit. Few functions
are explained below as per the working with communication with master.
drive_M1 (Address, PWM) and drive_M2 (Address, PWM) are used to rotate the channel 1 motor and channel 2
motor respectively, the address of the particular motor-controller is given, along with the PWM. At PWM 0 the
motor stops and at PWM 1 to 127 the motor moves in a clockwise direction and PWM -1 to -127 the motor moves in
an anti-clockwise direction. Block received by the motor-controller.
readEnco1 (Address) and readEnco2 (Address) are for reading the encoder counts of channel 1 encoder and channel
2 encoder respectively assigned with instruction code 32/33, the address of the particular motor-controller is given.
This function returns the value of the encoder counts. The encoder connected should be an incremental type[6].
Block received by the motor-controller –
As only 8bits can be transmitted at a time the encoder reading is transmitted in base 256 number system.
The communicated message block is broken down to parameters by onboard ATMega32u4. Before running the
functions, the block is checked for any errors using the checksum bit. The instruction code is checked and the
corresponding function is executed using the parameters if there are any. For example, the instruction is 30 and there
would be a single parameter, then the following code will get executed using the parameter as PWM magnitude.
The printed circuit board of the unit as per the discussed design and parameters is shown below(fig.13). The testing
of the unit is done on load (motor) which has peak current of 30Amps and a maximum speed of 4000 RPM resulting
in real-hardware implemented auto tuning response plot.(fig.14)
VII. ACKNOWLEDGEMENT
We are very thankful to PCB Power for providing us with the printed circuit boards as per our specifications, we
thank K.J. Somaiya College of Engineering for providing us with the required essentials and test equipment along
with the resources for this project. We would also like to thank our Prof. Dr Irfan Siddavatam for their guidance and
encouragement throughout the research and development process.
VIII. CONCLUSION
We have implemented a dual-channel motor-controller unit which is successfully auto-tuned for both loads using the
system-Identification process and controlled using the drive control algorithms. It is inferred that the PID tuning is
possible in a simpler yet accurate approach using the system-identification on MATLAB simulink as compared to
the physical and model-based tuning. Also, it is feasible in robotics, industrial automation for high current
applications. It is practically concluded that the motor-controller efficiently satisfies the high-current load
requirements and it can be further developed to be controlled using IoT applications.
REFERENCES