This tutorial will discuss Timer Peripheral Modules, DC Motors, motor controllers, and configuration of your chip to output a PWM or Pulse Width Modulated Signal.
The first section of this this tutorial provides the basics of DC (Direct Current) motors. The electronic circuits created to control these motors and schematics for PCBs, tips to reduce noise over important signals are also contained within this tutorial.
A dc-motor is an electrical device that converts energy into rotational movement. The motor moves a gear in one direction if current flows through the terminals (clockwise or counterclockwise), and in the opposite direction if current flows backwards through the same terminals. If there is a force opposing the motor, then the terminals are short circuited and the current through the terminals can go as high as 14 A or more. The voltage or current that must be delivered to the motor to work is too much for a microcontroller output port so an intermediary device must be used, such as the mc33932evb motor control board.
Pulse Width Modulation (PWM)
For a refresher in Pulse Width Modulation.
Once you feel comfortable that you understand the concepts behind a duty cycle signal, you may move to the next step of understanding H bridge circuits.
A microcontroller is typically not designed to directly drive DC motors. Keep in mind MCU's are low-power devices and motors usually draw a lot of power. So what is one to do? Amplification!
There are lots of ways to do this and each has it's trade-offs. Below are the most popular...
A few MOSFETSs should do the trick. This is a great learning exercise, you can probably get more oomph out of your circuit but it takes time to build and troubleshoot. If you search the web for motor driver board, you should find plenty of resources, designs, etc.
Half-Bridge (aka H-bridge)
These are integrated circuits with the aforementioned discrete components already configured for you. Because these are integrated (into a very small footprint) these tend to be power limited due to thermal issues. Generally speaking, the better a device is at dissipating heat the more power it can handle.
Get a basic view of H bridge circuit. Click here which describes H bridge circuits.
Describes how a DC motor works: here
Microcontroller Reference Manual: Timer Information
You will find high level information about Timer usage in several different areas of a reference manual. See the reference-manual article for more specific information on how best to navigate through to the areas which are relevant.
- Relevant Timer Chapters:
- Introduction: Human-machine interfaces - lists the memory map and register definitions for the GPIO
- System Modules: System Integration Modules (SIM) - provides system control and chip configuration registers
- Chip Configuration: Human-Machine interfaces (HMI).
- Signal Multiplexing: Port control and interrupts
- Human-Machine Interfaces: General purpose input/output
In testing the motor, we found that it drew between 0.35A and 0.5A with no load on the wheels and peaked at a little over 14A at stall. With this Data and 150% value for the H-Bridge or Motor Controller we need one with a current rating of 20A at least. The Motor has a Resistance between 0.9 and 1.0 ohm.
For motor control you can use the Freescale H-Bridge such as MC33931or MC33932, however these controllers peak at ~5 amps, so you will not be able to maximize speed
Power & Current Requirements
Additional Theory Training Resources