Basic Stamp G-Code Interpreter
Abstract
|
| Inspiration |
| Lashup |
| G00 Rapid Motion |
| G01 Straight Interpolated Motion |
| How Much Can Be Done in a Stamp? |
| Next Steps |
| Selected Links |
Inspiration |
Somewhere along the line, the Thomas Dvorak's Printed Circuit Board Drill, an entry in the Circuit Cellar Flash Innovation 2003 Design Contest, was brought up as an example of what was being attempted. On seeing the brevity of the code to read the PC's data stream and manage the three stepper motors, I was made curious about whether an SX could just directly interpret G-Code motion commands and drive three axes of steppers.
Lashup |
![]() ![]() |
The first activity was to just run the basic stepper motor application from the Parallax appnote. This demostrated that I could, in fact, wiggle a stepper axis in a predictable fashion.
G00 Rapid Motion |
|
G04 P3 G00 X48 Y96 G04 G00 X48 Y0 X-48 Y-96 X-48 Y0 M30 |
| G00 Intepreter Source Code |
G01 Straight Interpolated Motion |
The results of the first pass of adapting the STEPSTER straight-line interpolated motion engine to the Basic Stamp 2,
even with the limitations associated with the rapid motion engine, exhausted the available RAM by a handfull of bytes.
So I pared the STEPSTER engine a bit, by removing backlash compensation, and by having only one coordinate system.
Once I got over the hurdle of moving the motion engine from floating point to fixed point integer distances, there was
a few bytes of RAM left, and about one-fourth of the EEPROM available.
| G01 Intepreter Source Code |
How Much Can Be Done in a Stamp? |
Unfortunately, I ran out of 9-volt batteries while starting the testing, but I can assure you that the program does compile without error.
Anyway, here is a listing of the features implemented in this little gizmo:
|
| 3-Axis Stamp Source Code |
Next Steps |
[edit on 22-Jul2005]
But I do not have such a Stamp.
O frabjous day! Callooh! Callay! / He chortled in his joy.
I just remembered that I have a BS2p40 laying around. Let's see,
now...32 I/O points, 8 banks of 2K bytes, 128 bytes scratchpad RAM,
still just 26 bytes general purpose RAM (but I can implement a form of
virtual memory)...why
I'm starting to think I'll need to see if I can't do a G02 / G03 on a Stamp.
Of course, I'll also need to add coolant control,
maybe 16-bit axis commands, perhaps even full blown Gerber/Excellon style
implied decimal and suppressed zeros,
and that will lead to requiring absolute and incremental modes, as well as inch and
metric positon entry. [end of edit]
Poor little Stamp, I might even feel sorry for it 'til I'm done.
[Then] I suppose my next step will be to implement this 3-Axis gizmo on
an SX using SX/B, and then see if I could add circular interpolation to it.
Other wishlist items then would include half-stepping (or maybe microstepping) the motors,
adding a small screen & keypad (or maybe just a touchscreen) as an operator interface,
and whatever else that would be useful that could be squeezed in.
I was a bit surprised how much capability I was able to torment the Basic Stamp 2 with, I'll have to see now what the SX might be able to endure.
Selected Links |
These are links to the various resources mentioned above,
|
Parallax
Basic Stamp 2 SX HomeWork Board Stepper Motor UNL2803A Interactive Thread Printable Thread | Links to Parallax, and to their SX microcontroller and the SX/B compiler. This is the central core of the motion processor of this PCB Mill project. Also links to the thread in the Parallax The Sandbox support forum that documents the development of the idea of the SX Community PCB Mill. |
Introduction to G-Codes
| A tutorial that introduces the the CAD - CAM - CNC toolchain, with an emphasis on the G-Codes, especially as used for PCB fabrication. I wrote this tutorial as a contribution to the Community PCB Mill project mentioned above. If you are unfamiliar with G-Codes as discussed on this page and in the Basic Stamp programs, the tutorial and the section of annotated external reference links may be of some assistance. |
Printed Circuit Board Drill
| Thomas Dvorak won a Distinctive Excellence award with this entry in the Circuit Cellar Flash Innovation 2003 Design Contest. He describes a PCB drill using an X-Y table made from old printers. This device has axis encoders of a sort, uses stepper motors to move the axes, and has a Motorola 68HC908QY4 as its motion engine. |
CNC979_source.zip
CNC979inside.txt Charlie Gallo MetalWorking.com Luberth Mendonet CrankOrgan | The first two links are STEPSTER, or at least the version to which I made reference. Kevin Carroll authored STEPSTER, and Charlie Gallo is STEPSTER's caretaker. The additional links are the references (that I am aware of) that discuss, or link to, STEPSTER. |
Flutterwhumper
Vector Plotting Rees Video | Don Lancaster describes his Flutterwhumper concept, how to implement Bresenham's algorithm, and even points you to a John Rees video that tells you how to rewind car alternators as a powerful three-phase stepper motors for a large-bed wood router. |
ULN2803A Datasheets
| The ULN2803A datasheet is available from a number of locations. |
Jones' Definative Stepper Reference
An Embedded Systems Stepper Article PicList Stepper Reference Stepper Wire Wizard | While there may be much Stepper Motor information out there, these are my favorites. | |