Tuesday, August 23, 2011

Stepper motor forwards and reverse



A quick video showing the stepper motor going in both forwards and reverse directions.

Schematic shows PORTD connected to two ULN2803A darlington array ICs. For simplicity we've used one IC per motor, but each IC can in theory support two motors at a time - the 16-pin ULN2003A has only 7 available darlingtons, these 18-pin ULN2803A chips have eight). Pin selection is a bit messy - we'll probably move these around for the final version when it comes to putting everything down on a PCB, for easier routing.

The jog buttons (RB7 + RB6) allow the user to manually move the stepper motor in either direction. Alternatively, you can send a move "request" to the microcontroller, which consists of number of steps to move (a two-byte value) and direction (forwards/reverse)


The noise in the video is not rowing neighbours, as suggested by some viewers, but a Radio4 play and my partner on a sewing machine in the other room!


In the video we're using a 1.8 degree stepper motor.
That means 360/1.8 = 200 steps for one complete rotation. We're driving the motor in "half-step" mode (for increased precision when connected to a belt-drive) so 400 steps are required for a full rotation. The video shows a value of 1 (high byte) and 144 (low byte) being entered - this is the same as (1*256)+144 = 400

The motor responds by completing one full complete rotation.

No comments:

Post a Comment