During last week we build and assembled a passive CoreXY drawing machine. For this weekly assignment we have to automate it.
For doing this, following the suggestion of our instructor Matteo, we decided to use an Arduino Uno board with a CNC Shield and some drivers. The software to interpret GCODE we used is GRBL.
Grbl is a no-compromise, high performance, low cost alternative to parallel-port-based motion control for CNC milling. This version of Grbl runs on an Arduino with a 328p processor (Uno, Duemilanove, Nano, Micro, etc). Via
Modifying and flashing GRBL
During this week I was in charge of preparing the software to move the motors and automate our machine. Basically I had to solve two problems:
1 - tell grbl to have to deal with a CoreXY machine
2 - tell grbl to have to deal with a servo motor for Z axis
Googling I luckly found This useful tutorial: basically it explains how to control a servo using GRBL and how to set a CoreXY machine.
So I could solve the first problem modifying config.h file. I basically uncommented the line 189, defining #define COREXY;. Easy peasy.
For the second problem I modified the file named spindle_control.c with the instruction found Here.
--> Modified files are available at our Group Page
.
Than I moved the downloaded GRBL folder inside Arduino app/Contents/Java/libraries, I opened Arduino IDE and I flashed on our board the grblUpload sketch.
After that I connected all motors to the CNC Shield. For helping me, I created a simple image that explains how to connect a stepper and a servo motors.
For testing X and Y axis, we used Universal GCODE Sender, a Java software made for controlling CNC machines with a GUI via serial commands. Basically, to test our machine, I tried with these simple commands:
G0 X10 - moving only on X axis
G0 Y10 - moving only on Y axis
G0 X10 Y10 - moving on X and Y axis at the same time
The first issue I found was about moving the Z axis. Basically, using a command like G0 Z-5 didn't produce any output. Basically because anything is connected to the Z in the CNC Shield. Infact, to command the servo, I had to use Spindle State commands as:
M5 S200 - moving servo up
M3 S200 - moving servo down
With these settings, everythings worked fine and I was able to move the machine as I wanted.
After that, I modified again the spindle_control.c file in order to change as well the servo motor's angle movement. At line 48 and 49, infact, I found:
#define PEN_SERVO_DOWN
and
#define PEN_SERVO_UP
These two parameters regulate what I want. Basically I reduced the delta between the first and the second one (bringing at 16 and 18). In this way I could have a minimum rotation angle that allowed me to lift the pencil from the sheet without straining the servo motor.
To make the changes effective, I opened Arduino IDE and I flashed again grblUpload.
Creating a simple GCODE
To the final test of our machine, I created a simple GCODE file for drawing three 10 mm square in three different positions. As I said before, I used M3 and M5 commands to simulate Z axis. Here's the code.
(3 10 mm SQUARES GCODE - DARIO BERNABINI, TOMMASO LOMBARDI, GIADA ALLOCCA - FAB ACADEMY 2018)
(M3 S200=Z DOWN)
(M5 S200=Z UP)
(Angle width in spindle_control.c, line 48 and 49)
M5 S200
M3 S200
G91 G0 X10
G91 G0 Y-10
G91 G0 X -10
G91 G0 Y 10
M5 S200
G91 G0 X30
M3 S200
G91 G0 X10
G91 G0 Y-10
G91 G0 X -10
G91 G0 Y 10
M5 S200
G91 G0 Y30
M3 S200
G91 G0 X10
G91 G0 Y-10
G91 G0 X -10
G91 G0 Y 10
M5 S200
Final Result and future improvements
In this page I only embedded the final video I made for our project. You can find all contribution, future improvements and in general the entire work in our Group Page. The assignment of the last two weeks has been among the most difficult but fun and satisfying of those done so far and I was very happy to have contributed to the creation of as simple but fully working machine.
For the future, we think the needed improvements could be the following ones:
re-design a new central part that should be able to host more drawing objects (pens, pencils, markers...) with guides at the bottom and top to let the object stable during movements
as we said during the previuos week, we have to replace the fishing string with a 2mm gt2 pulley compatible belt to have more precise movements
it can be interesting inserting some end runs. In this way the machine will be able to know where is the 0 related to the X and Y axes.