Archive | July 2012

Calibration and Sending G-code

Today I calibrated each axis of the laser cutter. A good place to go to figure out how to do that is the RepRap Calculator, but instructions are also included in the Teacup config.h file:

/** \def STEPS_PER_M
steps per meter ( = steps per mm * 1000 )

calculate these values appropriate for your machine

for threaded rods, this is
(steps motor per turn) / (pitch of the thread) * 1000

for belts, this is
(steps per motor turn) / (number of gear teeth) / (belt module) * 1000

half-stepping doubles the number, quarter stepping requires * 4, etc.

valid range = 20 to 4’0960’000 (0.02 to 40960 steps/mm)
*/

#define    STEPS_PER_M_X                    1440000
#define    STEPS_PER_M_Y                    1007874
#define    STEPS_PER_M_Z                    320000

Here’s the process I went through:

X-axis: My motor is pretty standard. 1.8 degrees per step, 200 steps per revolution. However, the motor has a compound gear train, so there’s an extra step. 10 teeth on the first gear, 30 teeth on the second, 10 on the third (which is locked to the second), and 30 on the fourth. So there are two gear pairs with a ratio of 3/1, making a ratio of 9/1. So it takes 9 revolutions or 1800 steps to turn the outside gear one time. The pulley attached to the outside gear, which drives the belt with a pitch of 2mm, has 40 teeth. The pitch is multiplied by the number of teeth to get 80.

360°/1800=0.2°/step    0.2°X80=16mm/rotation. That would make 112500 steps/meter.

The part that got me was that the Easydrivers use 1/8th microstepping by default, which multiplies the number of steps per rotation by 8. That gives us 1600 steps per rotationon on the motor itself. Multiply that by the gear ratio (9) and we get 14400 steps per rotation or 0.025° per step.

So 14400 steps X 1/(1/8 microstepping) / 80(belt pitch x tooth count) gives us 1440 steps/mm or 144000 steps per meter…I think.

 

Y-axis: The x-axis was considerably easier. However, I bought my leadscrew from a hardware store in the US, and the RepRap calculator only uses metric. So I counted the number of threads per inch, which is 16, meaning one turn of the screw moves the axis 1/16″. Still having 200 steps per revolution 1600 steps per revolution, There are 25600 steps per inch. That means there are 25600 steps for every 25.4 mm.

25,600/25.4=?/1,000.

25,600*1,000=25,600,000.

25,600,000/25.4=1,007,874.015748031 steps per meter.

I just rounded it off to 1,007,874 steps per meter.

G-code Intepreter

I’ve spent the whole weekend trying to get a g-code interpreter loaded onto my Arduino. I’ve learned quite a bit.

Mainly, I’ve learned that there really is no g-code interpreter that works with an Arduino Diecimila (ATmega168). It seems to be due to a lack of memory.

I’m going to have to switch to an Arduino Uno (ATmega328p) or something better.

I plan on illustrating exactly how to install a g-code interpreter on an Arduino so that other n00bs with similar projects don’t have to do quite as much guess work as I did.

For the time being, I want to say with certainty that Grbl and Teacup DO NOT work on an ATmega168! People on the RepRap IRC channel have said it might be possible if one were to decrease the buffer size. I’m not sure how to do that and it hardly seems worth it if it’s going to slow down this low-power laser cutter even more. So why not get a new microcontroller?

EDIT: Open mouth, Insert foot. Apparently it is possible to fit the Teacup firmware onto an ATmega168. A friend of mine who knows a hell of a lot more about microcontrollers and programming than I do, edited out parameters in the config.h file that, in my case, are superfluous. such parameters as temperature sensors, extruder heaters, bed heaters, and PID controls. You can find my edited config.h file here.