
RoboPi v1.00
User Manual v0.85
Copyright 2014 William Henning
How to use PWM to control Gear Motors
Standard motor drivers normally are controlled by two or three digital signals per motor.
EN/A/B Three Wire Driver
The popular L293D and L298 motor drivers are often configured for EN/A/B three wire control.
For three wire drivers, use
digitalWrite()
to set the two direction pins, then use
analogWrite()
to
control the motor speed using pulse width modulation. Please note that the minimum speed will be
different for different motors.
Some driver boards permanently tie EN high in order to use only two pins, however I do not
recommend this practice as it is harder on both the motors and batteries (more later).
EN
Function
0
Disable the motor driver, motor coasts
1
Enable the motor, motor turns in direction specified by A or B
Note:
Some motors have an active low input, in which case 0 enables the motor, and 1 coasts.
Check the data sheet for your motor controller (or motor controller chip) for details.
A B
Function
0 0
Break
0 1
Rotate in one direction
1 0
Rotate in opposite direction
1 1
Break
http://Mikronauts.com
21
2014-01-27