background image

start byte = 0x80 device type = 0x00 motor # and direction motor speed

Using the Motor Controller

To set the speed and direction of a motor, send a four-byte command with the following 
structure to the motor controller’s asynchronous serial input, labeled ‘2’ on the PCB.

You must send the four-byte command eight bits at a time (with no parity bit) at a 
constant baud rate ranging from 1200 to 19200 baud.   The serial bits must be 

non-

inverted

, meaning that a zero is sent as a low 

voltage, and a one is sent as a high voltage, as shown 
in the diagram to the right.  (The PC-connection 
circuit on the previous page corrects the inverted 
signal coming out of PC serial ports.)    

Commands 

sent to the serial input 

must

 conform to the above 

format (described in detail below) or else the motor 
controller and other devices connected to the serial 
line may behave unexpectedly.  

This motor controller 

interface protocol

 is compatible 

with other Pololu serial devices such as our servo controller, so you can control 
multiple Pololu serial devices on a single line.

The Four-byte Motor Controller Command
Byte 1: Start Byte.

  This byte should 

always

 be 0x80 (128 in decimal) to signify the 

beginning of a command.  The start byte is the only byte with the highest bit (bit 7) set, 
and it alerts all devices on the serial line that a new command is being issued.   All 
succeeding bytes sent down the serial line must have their highest bit cleared to zero.

Byte 2: Device Type.

  This byte identifies the device type for which the command is 

intended, and it should be 0x00 for commands sent to motor controllers.  All devices 
that are not 

SMC01A

 dual motor controllers ignore all subsequent bytes until another 

start byte is sent.

Byte 3: Motor Number and Direction.

  This byte 

has three parts, as shown in the diagram to the right:

"

Bit 0 specifies the direction of the motor.  Set 
this bit to 1 to make the motor go forward; clear 
the bit to make it go backward.

"

Bits 1-6 specify the motor number.  If you are 
using only two motors per serial line, you can 
use the default values of 0 for motor M1 and 1 for 
motor M2.  If you want to control more than two 
motors, use numbers in the range of 2 to 63, as 
described in the section, “Controlling Multiple Motor Controllers with One Serial 
Line”.

bit 0: direction
         1 = forward
         0 = reverse

bit 7

bit 0

0 x x x x x x x

bits 1-6: motor

number

bit 7: always 0

8

Pololu

10011010

start bit

stop bit

5V

0V

LSB

MSB

© 2001
http://www.pololu.com/

Содержание SMC01A

Страница 1: ...tents Safety Warning Parts List Contacting Pololu How to Solder Assembly Instructions Connecting the Motor Controller Using the Motor Controller How the Motor Controller Works Description and Specific...

Страница 2: ...se or to the performance of this product This product is not designed for and should not be used in applications where the malfunction of the product could cause injury or damage Parts List The follow...

Страница 3: ...er soldering trim excessleadswithdiagonalcutters To solder heat a component lead and the PCB pad and then apply solder until the solder flows onto both the lead and the pad If the solder beads up on t...

Страница 4: ...ptions concern the size of the assembled motor controller You can insert the various components into the PCB without soldering to helpdeterminewhichoptionsarebestforyou Should I use IC sockets for U1...

Страница 5: ...5 Pololu SMC01A C2 C1 U3 U2 U1 M2 1 2 M1 Next add the tantalum capacitor C2 You may need to bend the leads to make them straight so that they will fit The capacitor is polarized which means it must on...

Страница 6: ...o use it to ensure that spurious signals sent when your robot controller turns on do not cause the motor controller to detect the baud rate incorrectly onnect this pin to a 0 5V digital output on your...

Страница 7: ...port connector R2 10k R1 4 7k Q1 2N2222 Bold circles indicate pads that are connected to 5V which you can use with the circuit shown on the left SMC01A C2 C1 U3 The above diagram shows a simple circui...

Страница 8: ...s byte should always be 0x80 128 in decimal to signify the beginning of a command The start byte is the only byte with the highest bit bit 7 set and it alerts all devices on the serial line that a new...

Страница 9: ...or controller to use it successfully However you may need to reset the motor controller to ensure that spurious signals sent when your robot controller turns on do notcausethemotorcontrollertodetectth...

Страница 10: ...of 19200 The four numbers in square brackets are the data to be sent and they correspond to the four control bytes for the motor controller The first two bytes should always be 80 and 0 The second 0 m...

Страница 11: ...on and off very rapidly 600 times per second and varies the percentage of the time that the switches are on to achieve the speed set by the serial interface For a higher speed the switches are on a l...

Страница 12: ...bot controller you can independently set each of two small DC motors the kind typically found in remote control cars and motorized toys to go forward or backward at any of 127 different speeds To cont...

Отзывы: