Editing Two Axis Stepper Controller

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
 
= What =
 
= 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.  And these motors, with built in gears are available, and they can be cheap ( '''[https://www.amazon.com/gp/product/B015RQ97W8 Amazon.com : Longruner 5x Geared Stepper Motor 28byj 48 Uln2003 5v Stepper Motor Uln2003 Driver Board for arduino LK67 : Camera & Photo ]''' )  For the mount I found a 3D printer file (  *'''[https://www.thingiverse.com/thing:794786 Bare Bones 28BYJ-48 Gimbal. by mmontee - Thingiverse ]''' ) .
+
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.  And these motors, with built in gears are available, and they can be cheap ( '''[https://www.amazon.com/gp/product/B015RQ97W8 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 (  *'''[https://www.thingiverse.com/thing:794786 Bare Bones 28BYJ-48 Gimbal. by mmontee - Thingiverse ]''' ) for them I went forward with the software.
  
 
You can aim the laser in both altitude and azimuth.  Once you get it to a place you want the program can memorize the location as a target and then go back there on demand.
 
You can aim the laser in both altitude and azimuth.  Once you get it to a place you want the program can memorize the location as a target and then go back there on demand.
Line 14: Line 14:
 
== Laser/Motor Mount ==
 
== Laser/Motor Mount ==
  
* Get the motors: ( '''[https://www.amazon.com/Longruner-Stepper-Uln2003-arduino-LK67/dp/B015RQ97W8 Amazon.com : Longruner 5x Geared Stepper Motor 28byj 48 Uln2003 5v Stepper Motor Uln2003 Driver Board for arduino LK67 : Camera & Photo ]''' ).
+
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.
 
 
*Print the mount: ( *'''[https://www.thingiverse.com/thing:794786 Bare Bones 28BYJ-48 Gimbal. by mmontee - Thingiverse ]''' ).
 
  
 
== Arduino and Driver ==
 
== 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.
Pretty much any arduino should work, I used a really bare bones board I had on hand.  The driver chip comes with the motor ( although I used a chip I had on hand ).
 
Any terminal program should work, I used my own [[Python Smart Terminal]].
 
  
 
== Arduino Software ==
 
== Arduino Software ==
Line 48: Line 44:
 
</pre>
 
</pre>
  
Here is a bit more detail on the commands.
+
Here is a bit more detail on the commands.
 
 
Commands and responses always end with a newline.
 
  
 
After a command is sent the software usually replies with some confirming message.  The whole command may take awhile if the position is changed by a lot.  In any case the arduino should finally respond with "ok".  Each motor has its own position, speed and acceleration settings.  You can choose which motor to manipulate with the m1 and m2 commands.  Other commands like t ( target ) act on both motors.
 
After a command is sent the software usually replies with some confirming message.  The whole command may take awhile if the position is changed by a lot.  In any case the arduino should finally respond with "ok".  Each motor has its own position, speed and acceleration settings.  You can choose which motor to manipulate with the m1 and m2 commands.  Other commands like t ( target ) act on both motors.
Line 69: Line 63:
  
 
=== Status Report Example ===
 
=== Status Report Example ===
This report gives a lot of information on the internal state of the program.
+
 
 
Note that the position of each target is given, it is also give in the form of a c++ array that can be plugged back into the code to make the target setting "permanent".
 
Note that the position of each target is given, it is also give in the form of a c++ array that can be plugged back into the code to make the target setting "permanent".
  
Line 99: Line 93:
  
 
</pre>
 
</pre>
 +
 +
  
 
=== Code Explanation ===
 
=== Code Explanation ===
  
The code is quite straight forward, reading it should tell you most of what you might want to know.
+
The code is quite straight forward.  Email me if you have questions, or post to the github location.
+
 
I used my own serial object it is in SerialCmd.cpp and .h.  The actual application is in TwoAxis.ino and .h. Most of the easily changed values are in TwoAxis.h Finally some comments are in readme.h ( which despite the .h file is not part of the software but just an extra text file, with comment and notes.
 
  
Email me if you have questions, or post to the github location.
 
  
  
 
[[Category:Arduino/RaspberryPi]] [[Category:Arduino]]
 
[[Category:Arduino/RaspberryPi]] [[Category:Arduino]]

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)