Difference between revisions of "PIC PWM Motor Driver"

From Mech
Jump to navigationJump to search
m
Line 31: Line 31:
===High Power===
===High Power===



===Signal Conditioner (Optional)===


==Using with PC/104==
==Using with PC/104==

Revision as of 17:15, 11 July 2006

Overview

This motor controller was designed for use as cheap, simple motor controller for brushed DC motors. It uses a PIC Microcontroller to convert a low-power analog control signal to a PWM duty cycle which is amplified using a full-bridge to drive a motor. A block diagram of this is shown below. This document gives the circuitry and programming needed to make such a controller.

PIC PWM block.png

PIC PWM

The first thing you need is a PIC microcontroller set up to convert an analog input to a PWM signal. The PIC used here is the PIC16F684. It only has one input, the analog control signal. It has two outputs: two opposite pulse width modulated pulse trains. The two PWM signals activate the two halves of the H-bridge to control the direction of the motor.

PIC Code

Code can be downloaded here.

The zip file contains the following files:

  • main.asm - the program
  • macros.inc - contains macros (quick code)
  • PIC16F684.INC - assigns names to register addresses
  • PICPWM.mcw and PICPWM.mcp - MPLAB workspaces

Circuit

The circuit consists of the PWM-enabled PIC chip, an amplifier and some protection circuitry. There are two versions of the circuit, one for low-power motors (1A continuous) and one for high-power motors (4A continuous).

Low Power

The low-power circuit uses the L293B push-pull driver (datasheet).


High Power

Signal Conditioner (Optional)

Using with PC/104

TO DO

  1. Add "brake" functionality to the PIC. This will require at least one additional input. For example, a single digital input pin could cause the motor to "brake" when it's set high. To "brake", the PIC will have to disable the PWM mode and set the two output pins equal to eachother.
  1. Add "sensing" capability for better control.