Motor Control Interface

By Jose Alcantar, Electronics and Controls Engineer

Introduction:

To drive the six motors independently as per requirement, 3 dual motor drivers are being utilized. Three VNH5019 motor drivers will be used to control each motor along with a PCA96805 I/O expander and a hex inverter.

VNH5019:

The VNH5019 dual motor driver requires three pins to control each of the two H-Bridges integrated onto the board. The two-motor direction pins (M1INA and M1INB) for the first H-Bridge use a digital output high and low to set the direction of the motor. The following truth table summarizes the different settings for the pins:

picture2

For example, to drive the motor clockwise M1INA is set high, while M1INB is set low. To reverse the direction M1INA is set low and M1INB is set high.

The third pin (M1PWM) is used to control the speed of the motor via a PWM signal.

The pathfinder will utilize three VNH5019 dual motor driver boards, with each board requiring 6 pins to control each motor. This gives us a total of 18 pins needed to control the motors. Due to the limitation of pins on the Arduino Leonardo, a PCA9685 16-channel 12-bit I/O expander along with a hex inverter will be used to control each of these pins.

PCA9685 & 74HC04 Hex Inverter:

The PCA9685 I/O expander allows the user to expand the capabilities of the Arduino by providing an additional 16 channels through I2C interface. Six of these channels will be dedicated for controlling the PWM input of all six H-Bridges. The PCA9685 has a dedicated library available that simplifies the use of the board. The following sample code shows how to set the output of one of these channels.

pwm.setPWM(0, 0, 4095);   //Sets the output to 100% duty cycle

In the above sample code the first input is the channel output pin, followed by the off time for the duty cycle and finally, the last value is the on-time for the duty cycle. Because the board has 12-bit resolution, the values for the duty cycle range between (0 – 4095), giving 4096 steps.

To control the motor direction, the use of a Hex inverter along with the I/O expander will be used to reduce the number of pins being utilized. Using an inverter, the motor direction can be controlled clockwise and counterclockwise with the use of a single pin. The following diagram shows the basic idea of how the direction will be determined.

picture1

In this case, setting the channel output HIGH or 100% duty cycle on the I/O expander, will set the direction pin M1INA high and M1INB low, driving the motor in the clockwise direction. Setting the channel output LOW, or 0% duty cycle, will do the opposite.

Conclusion:

With this configuration, the 18 pins needed to drive the motors is reduced to only 12 pins from the I/O expander. This leaves four more pins on the expander to drive servos or other actuators.