4. Arduino and Grbl Controller Code

When a stepper motors move a rotary tool in an X-Y motion there is inertia to consider. Simply pulsing the motor driver will cause the driver to attempt instantaneous and rapid motion from the stepper motor – there may not be enough torque to accomplish this and the stepper will skip, resulting in accuracy loss. The solution is to ramp up and down the motion of the stepper motors to avoid problems associated with inertia.

This is where the controller code for the Arduino comes into play. This code is not normal Arduino code, but rather AVR C code – this allows for the highest possible performance from the 328 chip and greatest support for gcode. Gcode is the instruction language for CNC machines. The controller software is known as Grbl. Shields made for the Arduino must be compatible with Grbl if the Arduino has been modified to run Grbl.

I followed the instructions for installation of this code on the Arduino Uno and had no problems. It is interesting to note that you can send gcode to the Arduino without any stepper drivers connected and it will obey the commands, but do nothing – this later proved to be a useful technique of debugging the Linux controller I revamped.

There are a few forks of the Grbl code in existence. Most notably is a fork that maintains power to the steppers when motion has ceased. This has the advantage of locking all three stepper motor shafts in place when you perform a manual tool change. The disadvantage is that you may eventually overheat the motors if you have not set current limiting properly. I have not tried this version of the code – so far I have only needed to use one bit per work-piece.


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>