From BitWizard Wiki
Jump to navigation Jump to search
The USB_stepper board
The USB_stepper board


The USB stepper allows you to step a small stepper a certain number of steps at regular intervals.

The intended use is for example home-built clocks.


The usb-step has basically two connectors. The USB connector (micro USB), and a 5-pin JST for the stepper motor.

The board has a few other connectors for debugging (for us), for power (GND/3V3/5V between the motor and USB connector), for SPI (in the future we might make it possible to add an SPI display for example), and for selecting the voltage of the powerpin of the SPI connector. These connectors are unpopulated.

The board is 50x25.


The JST power connector is something like

1 - 5V
2 - A+
3 - B+
4 - A-
5 - B-


By default the board will step every second, and make a full revolution in 15 minutes.


When you insert the board into your PC, you will get a virtual com port (VCP). Under Windows you should get a device for which "no driver could be found". install this driver, and you will get a virtual com port.

Use your favorite serial-communciation program to connect to the VCP. (I suggest Minicom/Kermit for Linux users, putty for windows-users).

you'll be presented with a commandline interface. The "help" command lists the available commands. Some debugging commands beyond the ones listed here may be present.

clock lists or sets the "steps-per-second" setting.

cal lists or sets the crystal calbration.

write writes the current settings to flash.

pat allows setting the activation pattern. For forward use: 4 1 2 4 8, for reverse use "4 8 4 2 1" as the arguments.

step allows setting the time that the motor is activated/stepping speed. Times are in ms.

def reads the default settings into the current settings variables.

For adjusting the clock setting you must know that the board uses microsteps. It won't drive the motor with better than "full step" resolution, but it uses very small steps internally. The motor will make a full revolution every 34190060316 of these internal steps. The motor is actually stepped when the accumulated number of steps internally exceeds 2^24 = 16777216. So at the slowest setting, 1 internal microstep per second, the motor wil be issued a step every 2^24 seconds (about twice a year), resulting in a full revolution every milennium.

More useful settings for the steps-per-second setting (adjusted through the clock command) is 34190060316/60 = 569834339 to make a full revolution every 60 seconds like the seconds-hand of a clock. Another example is to set it to 37988956 = 34190060316/60/15 to make a full revolution every 15 minutes. This is used by Oskar van Deventer's tower-gear-clock to drive the minute-hand of the clock through a 1:4 reduction gear in the clock.

The time required for each step limits the fastest possible stepping rate. You can experiment with reducing the "step" times with the step command to see what is the fastest possible step rate with your load.

current usage

the board uses about 120mA per motor-phase that is activated. Normally only one is activated at a time. The motor is powered off between the movements. We measured about 12mA "in rest", Add to that (by default) about 1% times 120mA, the total average power is around 13-14 mA.


In the future the interval between each group-of-steps will be configurable, currently fixed at "1s".