ChibiOS stepper runs
Posted at 2015-12-29.
I decided to clean up the project code to make it look like a separate thing and not a fork of ChibiOS. After all, I won't change any of the OS code if I can get away with that.
New repo
github removed
Test with a stepper motor
I also made some actual progress with the project. I traced the board a bit to make sure I know where the pins and powers go. It might not be entirely correct, but it seems right.
I added an external 5V line from an adjustable supply to the stepper board. Inputs A-D are connected to the Maple and a 5V geared stepper (28BYJ-48) is connected to its connector.
I added command to change stepper delay. The command simply calls a function in the other task file to change a variable. It should be atomic and have no ill effects on operation.
$ picocom /dev/ttyACM0
picocom v1.7
port is : /dev/ttyACM0
flowcontrol : none
baudrate is : 9600
parity is : none
databits are : 8
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv
imap is :
omap is :
emap is : crcrlf,delbs,
Terminal ready
ch> sd
Usage: sd <stepdelay in ms>
ch> sd 50
new sd: 50 from 50
ch> sd 20
new sd: 20 from 20
ch> sd 10
new sd: 10 from 10
ch> sd 6
new sd: 6 from 6
ch> sd 3
new sd: 3 from 3
ch> sd 2
new sd: 2 from 2
ch> sd 1
new sd: 1 from 1
ch> sd 0
new sd: 0 from 0
ch> sd 2
new sd: 2 from 2
ch> sd 1
new sd: 1 from 1
ch>
Motor distinctly changes the step rate in line with the commands. Even a delay of zero works. Zero and one seem smoothest and probably a real application would require driving with timers to get faster step rates.
Results
The motor runs fairly well, although slowly and with audible resonance. This motor has a relatively high gear ratio, so the step rate is easily enough for what it's usually intended for.
The real point with stepper motors is running set distances (or angles), though. With suitable load, they should quite accurately seek to a given position and back on demand by running a set number of steps in a given direction. Acceleration and deceleration ramps and even torque control are possible.
My original intent was also to run a bipolar stepper. For that I will need to chain or otherwise connect a full H-bridge board. The ULN2003 style chip wants an source signal with a good 1 to use as base drive. The L9110S style on the other hand has pullups and should be driven with open collector/drain outputs. Since the ULN2003 provides just that and the pullups may be higher voltage, chaining them makes some sense.