fabacademy


If CoViD was not a thing, wildcard week would have been a free and creative moment in which everybody is allowed to explore more in depth a process he/she likes.
But this all could not happen, and the FabGuys found a fun solution to the issue: the CNC by the Sea.

blablabla

PROJECT REPOSITORY

CNCbytheSea is a CNC machine with a screwdriver tied on (weird yes), that you can use to make 2d drawings on a sand bed.
Our week’s task was to remotely connect to the machine via a website workspace, upload our drawing’s G-code and see our art pieces coming to life, after solving any issue we could encounter.

The machine is made available thanks to the creation of a static IP, which allows you to reach the machine at any moment, without worrying about the address suddenly changing.

What is G-code?

G-code is what regulates the movements of any CNC machine, it’s simply an instruction language that the machine follows step by step.
Potentially, you could control a CNC cutter or a 3d printer only by typing in the right G-code, if only you had time and the brain for this.

Anyway, knowing some basic commands to be sent manually is very important for setting things up and for the technical safety of the machine.

G-code index At this page you can find a list of the enormous amount of commands and their respective G-code.

In our case, we had some fundamental ones.

G28 is automatically homing the machine’s position. It’s important to send it before any job.
G21 tells the machine that we are working in millimetres, and not in inches.
G90 is important because it allows the machine to interpret the coordinates as absolute positions inside of the given space. In this way, X35 and Y400 will always be in the same exact point, unless we change the absolute zeros.

Another command that we were given is a tool command, that allows us to change the tool from the screwdriver (drawing) to the spatula (cleaning/flattening) thanks to a servo motor. It was sent with the sequence M280 (calling the servo), P1 (servo on), S0/S90 (the angle at which the spatula is positioned). With S0 the spatula is in cleaning position, with S90 the spatula will be lifted and therefore not in use.

So, to make our sand drawing we had to choose an image, or design one. As I only wanted to use the machine and see how it worked I downloaded a png from the web.

blablabla

To generate the G-code there are many ways: Inkscape, Grasshopper and other applications. I decided to use MIT’s MODS, since I consider it easy and effective.

So I opened up MODS in my browser.
Right click -> programs -> open server program -> g-code, mill 2d png.

blablabla

In the “readpng” module I uploaded my image, then I changed the values in the “path to g-code” module to have a speed of 3000mm/s and a jog height of at least 30mm, also I chose the mm format option.
Then I calculated the path, that did not come out as I hoped, so I inverted the image and repeated. The result was nice and clean.

blablabla

I calculated the path and the g-code was automatically downloaded on my computer, I opened it in atom and check some things. I changed all the Z values to 0, since the fabguys had told us that especially with negative values (which I had), the machine sometimes has problems.
I also added a G28 and G21 at the beginning of the code. G90 was there already.

blablabla

I opened the workspace at https://thecncbythesea.hopto.org/#/workspace where I logged in with the credentials

Then I downloaded the .json script they had given us in order to connect the webcam to the workspace, and uploaded it through settings -> workspace -> import.
you can find the script here
I connected to the port, making sure the baud rate was 25000 and uploaded my g-code.

At this addresswe could follow the streaming of the machine through a webcam.

blablabla

The drawing was good but too big for the space, so I went back to the image, resized it, did the process in mods again, changed parameters on the code and uploaded it again.

blablabla

The size was now fine, but from a previous test I had noticed the machine was not recognising some commands and an instruction that was telling her to choose a certain tool.
I checked what command it was, went back to the code and remove all the instructions that did not have to do with my drawing’s trace, since the machine did not need to use any tool.

blablabla

blablabla

For some reason, the machine was not even recosgnising the G21 command. This left me with some doubts, but I decided to go for it anyway.
I re-uploaded and pressed play, finally everything went fine and the screwdriver started tracing lines in the sand.



At a certain point, almost at the end of the drawing, the machine was missing only three instructions but suddenly stopped for an error I did not understand.

blablabla

Also I realised that Mods had given me a code with a lot of 0 digits inside of some values, so the machine was obviousl not recognising them. Luckily it did not become an issue and the machine completed the drawing, which is not perfectly visible but still exciting for being done from 800km away. If the sand was a bit wet, the lines would surely be more defined and would have a lot more contrast.

blablabla

In the end I highered the machine send a G1 Z30 command, then sent the G28 command and sent the tool at home.

I was lucky to have a very flat sand bed before my use, but I wanted to try to flatten the sand and erase my drawing, so I sent M280 P1 S0, but the spatula would not go down completely because my Z was too low.
I highered the Z and managed to send the spatula down, but when I uploaded the cleaning code, the machine was forcing down without moving, and from the webcam I noticed one of the fabguys intervened to manually unlock it and then connected to the workspace, since I lost my connection.

In that moment I decided I was satisfied with my job, especially because I did not want to ruin the machine doin the wrong things.

I was happy about dealing with the CNC by the Sea. It was a bit more tricky and challenging than the previous weeks since I was doing it alone at home, and decided not to ask support to my classmates since I wanted to unlock issues by myself, obviously being careful about the machine and not doing things randomly.

Here you can download the png and the code I used for my drawing:

FELIX PNG

FELIX G-code