Datenblatt für Serial Motor Driver Guide von SparkFun Electronics

I—unsml spawn" cm 5‘75 LONGEUW mm, su smug», comma us lie [303- |
Serial Motor Driver User Guide
2009.12.17
© 2009 SparkFun Electronics, Inc. All Rights Reserved. Product features, specifications, system requirements and availability are subject to change without notice. Serial
Motor Driver (ROB-09571) is a trademark of SparkFun Electronics, Inc. All other trademarks contained herein are the property of their respective owners.
ButtonpadControllerUSB_UG_090126
1
Overview
The serial controlled dual motor driver allows the user to control up to two motors using a serial command interface.
The serial command interface lets the user select an individual motor, the direction, and the desired speed constant
(up to 10 different speed from stop to full speed). The board is based on the L298 Dual Full-Bridge Motor Driver from
ST Micro. The motor driver can provide up to 4 Amps of current to the motors (2 Amps per motor).
Powering the Device
Power may be applied to the Serial Controlled Dual Motor Driver in one of two different locations: the two-pin JST
header that's on-board, or by using the GND and VCC header pins along the side of the board.
The board can be supplied with a DC voltage in the range of 5-16 volts. To determine the voltage needed for your
application check the specifications of your motors.
Hardware Notes
1) Power Headers
2) UART Interface Header
3) Motor Connection Headers
4) Extra Interface Pins
5) Power Switch
6) Status LEDs
To connect motors to the device attach the terminals of the motors to the M1+/- and M2+/- pins. During operation the
firmware will automatically shut down both motors if an over-current event is detected. An over-current even is
defined as a current spike greater than 2 Amps. Also if an over-current event is detected one of the two LEDs will turn
on until the condition is resolved. Stat 1 LED will turn on if M1 is in over-current, Stat 2 will turn on if M2 is in the over-
ms. mmuw mm film t 2m 50mm cuLURAUu usu Bis
Serial Motor Driver User Guide
2009.12.17
© 2009 SparkFun Electronics, Inc. All Rights Reserved. Product features, specifications, system requirements and availability are subject to change without notice. Serial
Motor Driver (ROB-09571) is a trademark of SparkFun Electronics, Inc. All other trademarks contained herein are the property of their respective owners.
ButtonpadControllerUSB_UG_090126
2
current state.
The UART hardware interface is also available via 4 header pins along the side of the device. The signals on this
UART interface are TTL level and need to be shifted to RS232 levels to use this with a computers COM port. Also,
the header pin labeled 5V is only to be used as an output as it is from the output of a regulator on the board; do not
apply power to this pin.
There is a 6 pin header along the top of the board that breaks out several pins from the AtMega328 microcontroller,
along with a power bus. These pins have been made available in case the user intends to modify the firmware or
create their own.
Command Interface
The serial command interface used to control the motors is very straightforward. A command consists of four
characters: the motor number, the direction indicator, the speed constant, and a carriage return. Here is a table
describing the command:
Only one motor can be addressed per command; the indicator character determines which motor is being addressed.
The direction character commands the motor to turn either forward ('f' or 'F') or reverse ('r' or 'R'). The speed is
entered with an ascii number anywhere in the range of 0 and 9. If '0' is ued for the speed, the motor will be stopped
(and the direction indicator doesn't matter). If '9' is entered for the speed value, the motor will run at full speed. If any
other speed value is used, the motor will receive a pulse width modulation signal to control the speed.
If an invalid character or an invalid message is entered, the device will echo an error response back on the serial
interface and no changes will be made to the motors speed or direction.
Motor Ind. Direction Speed End of Command
'1' or '2' 'f' or 'r' (case insensitive) '0'-'9' '/r'
Speed Value PWM Duty Cycle
'0' Off
'1' 11%
'2' 22%
'3' 33%
'4' 44%
'5' 55%
'6' 66%
'7' 77%
'8' 88%
'9' 100% (Full Speed)