Introduction

This week I had to work with two of my classmates in order to do a machine project. I worked with Luca Giacolini and Luca Rabazzi in order to build a candle decorator. My contribution to the machine is mostly in the programming part. I tried to do some models for the mechanical design, but in the end I spent the most part of the time studying grbl, gcode and python.

Personal contribution

I used 3 Nema 17 stepper motors: one for the X axis, one for the Y axis and the last one for the rotative axis, we will call it Z, also if it's not a proper Z. Since I used 3 stepper motors, I needed 3 drivers for motors, I mounted them on our CnCshield. I used an Arduino Duemilanove,

In this photo you can see the board, it had all the drivers connected. Then I connected the board to a computer and the cables to our stepper motors, I was ready to program it. In order to program the G00 X6000 I had to flash grbl on our board, write or generate a G-Code with the coordinates to decorate our candles and choose and use a G-Code sender to send the G-code to our machine.
First I studied the G-code, how it works and how to use it. The G-Code page of RepRap had the more detailed informations about it.



Not only he described the function of every commands, but it also told me if that particular command was supported or not by grbl. Once we got into it, we started to generate some random G-Code files with the FabMoudles and I tried to read it, it has been a good way to learn how to use it.
Then we started to study Grbl:



Grbl GitHub's page is awesome. There's truly helpful and clear wiki, that explained me, step by step, what to do and how to move through the installation and the use of it.



There were two ways two flash grbl on our board (since I did not use Windows): we could use Arduino IDE, or we could flash the .hex file with bash. I decided to use Arduino, so I uploaded grbl library on it, I loaded the grbl sketch and eventually on our board.



Then I opened the serial port terminal and, as you can see in the image, it wrote the welcome message. In the beginning I had some trouble with this part because I tried to use an Arduino Mega, but it did not work. I used the Arduino IDE's serial monitor and we typed:

$$ In order to see the settings, as you can see in this photo:


The most important settings here are: $100 $101 $102 Here I set step/mm rate for X, Y and Z. $110 $110 $111 Here I set the maximum rate for each axis. $120 $121 $122 Here I set the accelleration for each axis.
I did a lot of test, since I've found the best settings for each axis, I wrote the G-Code for the decoration I wanted to do, and eventually I used a python interface as Gcode-sender.
It's a pretty simple script, it will look for a file named grbl.gcode inside its own folder, and then upload it to the machine. As you can see:

Troubles

The main problem that I had during this part was to calibrate the motors. In the end they worked and the whole machine actually worked, but they were too slow, and this was because of bad settings for sure. The z axis motor reached really high temeprature in no time too. For a long time I thought it was because of the settings, but later we discovered that it was a problem related to CnC shield: it burnt 2 drivers, when we changed it everything was smooth.
I did not find a Gcode generator, basically I wrote it by myself (I had no time and I really wanted to make the machine work for the presentation), I will find a gcode generator soon, probably during this summer.
Even if it was pretty hard to program the machine, it was really nice to me to learn how to use it, and I really want to improve my skills in this field.

Link to project's page





Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.