Control a Stepper Motor with Serial over USB

From lechacal
Jump to navigation Jump to search

Required hardware

  • Stepper Control board either for generic or A4988 drivers.
  • FTDI to USB adaptor
  • A computer
  • A Stepper Motor

Required Software

  • A serial port terminal. To name a few: Cutecom Screen Hyperterminal Putty Minicom
  • Arduino IDE (if re-programming needed)

Proposed Sketch

The control board host an ATtiny84 chip. This chip can be programmed with Arduino IDE. The following sketch can be used as a base for controlling the motor. Serial sketch v1.0

Default communication settings

Baud rate: 9600 Data bits: 8 Handshake: None Stop bits: 1

Operation commands

All commands are described in the table below:

Command Description Example
s Start the motor. s
x Stop the motor. x
f Set Direction to forward. f
r Set Direction to reverse. r
c Toggle continuous mode. When continuous off the motor will run for a number of steps only. c
m<x> Set the number of step to move when continuous off. m200
<speed> Set the delay in microseconds between each steps (speed control). 1500
d <steps>\|<continuous>\|<version> d