Serial Controlled Motor Driver Hookup Guide

Pages
Contributors: MTaylor
Favorited Favorite 3

Example 1: Interactive UART Control with Peripherals

This example demonstrates the basic commands, plus some direct register access possible with only a UART available. This type of program could be easily run from a script from a more classic PC where I2C or SPI isn't available.

User port as UART

Requirements

  • Computer serial terminal set to 9600 baud.
  • Terminal set to send CR and LF (Carriage return and line feed).
  • Config jumpers set to '0000', or all open.
  • Exp. PU jumper fully closed
  • A 5V wall supply

Connect the FTDI to the SCMD using the diagram in "Hardware Connections", and power the SCMD from the wall supply. Attach two motors to the driver, one between A1 and A2, and the other between B1 and B2.

alt text

A SCMD ready to drive motors from UART command.

alt text

The controller is configured as UART ("0000"), and has pull up resistors enabled for the expansion bus.

Connections

Connect the FTDI basic to the motor driver as follows. Notice that the both sides have RX that indicates data in, so the RX-TX serial lines must be crossed.

alt text

Typing should now echo back to your terminal, pressing return should generate a new line (or error message), and commands can be entered. Skip forward to the UART Commands, or, enter the following commands as a guided tour. You may notice some responses like "inv" and "ovf" if the data entered was no good.

Example Commands

When you're ready, send the following commands:

"R01"

This will read the ID register and return 0xA9

"M01F50"

This will tell motor 0 to drive at half speed, forward -- But nothing will happen yet!

"E"

This will enable all drivers. Motor 0 should begin spinning at half speed.

"M01R100"

This will tell motor 1 to drive at full speed backwards. Now both should be spinning opposite directions.

"M01S"

This will cause motor 1 to reverse "forward" direction. Both should be spinning in the same direction now.

"E"

E again will disable both motors, which will stop spinning.

See the section "UART Commands" for a full command listing.