Two Axis Stepper Controller

From OpenCircuits
Jump to navigation Jump to search

What

For some time I have wanted to aim a laser with good precision across a room. Long time ago I did this with servo motors, Worked fine excpt for the good precision. I thought that steppers might do better. The problem is that steppers move ( typically ) over a degree per step. Gearing the motor down decreases the speed, but improves the precision. These can be cheap ( Amazon.com : Longruner 5x Geared Stepper Motor 28byj 48 Uln2003 5v Stepper Motor Uln2003 Driver Board for arduino LK67 : Camera & Photo ) With these in hand and a 3D printed mount ( *Bare Bones 28BYJ-48 Gimbal. by mmontee - Thingiverse ) for them I went forward with the software.

How

Laser/Motor Mount

These can be cheap ( Amazon.com : Longruner 5x Geared Stepper Motor 28byj 48 Uln2003 5v Stepper Motor Uln2003 Driver Board for arduino LK67 : Camera & Photo ) With these in hand and a 3D printed mount ( *Bare Bones 28BYJ-48 Gimbal. by mmontee - Thingiverse ) for them I went forward with the software.

Arduino and Driver

These can be cheap ( Amazon.com : Longruner 5x Geared Stepper Motor 28byj 48 Uln2003 5v Stepper Motor Uln2003 Driver Board for arduino LK67 : Camera & Photo ) With these in hand and a 3D printed mount ( *Bare Bones 28BYJ-48 Gimbal. by mmontee - Thingiverse ) for them I went forward with the software.

Arduino Software

In the old days I would have writen the code from the ground up. With the arduino you can often get a well tested library for this. I found the following and decided to use it.

For a long time I have had a belief that almost all arduino programs should have some sort of serial interface. And this is what I did for this project. The arduino is sent commands, typically a single character optionally followed by a number. From the help command built into the program here is a summary of the commands:

# <<< Arduino:  TwoAxis Ver1 2017 11 13.25
# <<< mnn    chooseMotor  
# <<< tn     move to Target n  
# <<< t-n    save Target n  
# <<< pn     cmotor nudge n  !!
# <<< snn   cmotor setSpeed
# <<< ann   cmotor setAcceleration
# <<< dnn   doDance
# <<< z     both motors zeroPosition
# <<< w     statusReport WhatWhere
# <<< v     Version of software
# <<< ?     Help
# <<< ok