DC Motor Control

March, 2016

Overview

The aim of this project was to build an intelligent motor driver. The system can follow an input reference position/trajectory, velocity, or torque to spin a brushed DC motor’s shaft with an inertial load attached. The system has feedback control implemented with a digital PID controller in the software and an encoder attached to the motor. The system also has current sensed feedback. Inputs are received with a user interface written in MATLAB. This software also allows for output plotting as visual and quantitative feedback for the user.

Video

Hardware

  • Brushed DC Motor with a plastic bar attached to the shaft as an inertial load.
  • Encoder chip.
  • A breakout board for the DRV8835 H-Bridge.
  • A battery pack to supply the motor.
  • A breakout board for the MAX9918 current-sense amplifier (Attached to ADC on the PIC32).
  • PIC32 Microcontroller with an NU32 breakout board.
  • An NScope digital oscilloscope and an LCD screen were used for feedback when testing.

The ciruit was connected up as shown in the diagram bellow:

Software

There are two different sections to the software side of this project:

  • C code for the PIC32 to drive the motor and receive feedback.
  • MATLAB code used for the user interface.

All the software can be found here.

The MATLAB user interface was presented as seen below: