A B Function
0 0 Brake
0 1 Rotate in one direction
1 0 Rotate in opposite direction
1 1 Brake
Note: Some motors have an active low input, in which
case 0 enables the motor and 1 coasts. Check the
datasheet for your motor controller (or motor controller
chip) for details.
A/B Two-Wire Interface
For two-wire drivers, use digital Write() (or equivalent)
to set the direction you are NOT going in to 0, then use
analog Write() to control the motor speed using PWM for
the direction you want the motor to turn. Please note that
the minimum speed will likely be higher for two-wire motors
and different for other motors.
The inexpensive low current L9110S H-bridge is one
example of a two wire A/B interface, however many L293D
and L298 boards tie EN high to effectively become two-pin
drivers.
A B Function
0 0 Brake
0 1 Rotate in one direction
1 0 Rotate in opposite direction
1 1 Brake
DIR/PWM Two-Wire Driver
Other motor drivers utilize extra logic to use one pin as
motor direction, and another as a PWM input to control the
motor speed. For these drivers, use digital Write() (or
equivalent) to set the direction pin, then use analog Write()
to control the motor speed using PWM. Please note again
that the minimum speed will be different for other motors.
Okay. Which Do I Prefer?
I prefer three-wire EN/DIRA/DIRB control as I have
explicit supervision of motion, coasting, or active braking,
and batteries last longer. Less noise is a nice bonus too.
SV
Q/A
If you have any Raspberry Pi robotics related questions,
you can email me at bill@mikronauts.com. I will respond to
selected questions in a future article.
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-;;;-;;;;
COMPONENT LEDs • LED BULBS • LED ACCENT LIGHTS
For the finest in robots, parts,
and services, go to
www.servomagazine.com and
click on Robo-Links.
SERVO 03.2016 59