Maker Pro
Maker Pro

GRBL Arduino and SD Card Reader for Headless CNC

TehMaxwell

Mar 21, 2015
14
Joined
Mar 21, 2015
Messages
14
Hey all,

This is a quick question about the serial ports on the Arduino. But first some background information to put the idea into context.

I am looking ahead to next years A Level Project - this years was a Robotic Arm, see my introduction post for info on that! - and thinking about the option I have. Now one option I am extremely interested in is the idea of using GRBL to make a CNC Router capable of cutting Foam, Plywood and other materials. During research I almost dismissed the idea down to the fact that it would be too simple, to get good marks a project needs to incorporate electronics, programming and structural design. And as GRBL uses the Arduino and Stepper Drivers (Which are too much work for me to make) there would be no circuitry or programming needed to make a functional CNC Machine. I was about to dismiss the idea (much to my own disappointment) when my teacher asked me if there was anything I could add to it to make it more challenging. I hadn't really thought of it, but what I had researched was as simple as you like in terms of a CNC Router. No end stops. No LCD display. Just the raw driver and mechanical structure.

It occurred to me that our school laser cutters use some Memory to store the files that are sent to them, this is so that you can run the job multiple times without having to resend the file. This was a perfect extension for the project! Memory is something that is rarely delved into at A Level, as it involves a higher level of understanding about coding and SPI protocol in some cases. But I like a bit of research, so I started to obsessively research the idea in my spare time. It turns out due to the fact that GRBL takes up all of the Arduino's Memory you need to use two Arduinos to complete this idea. One to read from the memory and one to run GRBL. The data is sent over the Serial Ports.

Now this is where my question comes in! (Took me a while didn't it, I'm a sucker for a good story though.) I understand that you can use a Master Writer/Slave Reader Setup to send data across the Serial Ports. And that certain pins can be used to "bypass" the USB B serial connection on the Arduino. The problem I have is, if this is done, would GRBL still be able to interpret the data you were sending across or even read it? And if it can, how do you have to send it across for GRBL to accept the format? Can you just send the lines of G Code as separate data strings?

Hope you guys can help!

Sam
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Hey all,

This is a quick question about the serial ports on the Arduino. But first some background information to put the idea into context.

I am looking ahead to next years A Level Project - this years was a Robotic Arm, see my introduction post for info on that! - and thinking about the option I have. Now one option I am extremely interested in is the idea of using GRBL to make a CNC Router capable of cutting Foam, Plywood and other materials. During research I almost dismissed the idea down to the fact that it would be too simple, to get good marks a project needs to incorporate electronics, programming and structural design. And as GRBL uses the Arduino and Stepper Drivers (Which are too much work for me to make) there would be no circuitry or programming needed to make a functional CNC Machine. I was about to dismiss the idea (much to my own disappointment) when my teacher asked me if there was anything I could add to it to make it more challenging. I hadn't really thought of it, but what I had researched was as simple as you like in terms of a CNC Router. No end stops. No LCD display. Just the raw driver and mechanical structure.

It occurred to me that our school laser cutters use some Memory to store the files that are sent to them, this is so that you can run the job multiple times without having to resend the file. This was a perfect extension for the project! Memory is something that is rarely delved into at A Level, as it involves a higher level of understanding about coding and SPI protocol in some cases. But I like a bit of research, so I started to obsessively research the idea in my spare time. It turns out due to the fact that GRBL takes up all of the Arduino's Memory you need to use two Arduinos to complete this idea. One to read from the memory and one to run GRBL. The data is sent over the Serial Ports.

Now this is where my question comes in! (Took me a while didn't it, I'm a sucker for a good story though.) I understand that you can use a Master Writer/Slave Reader Setup to send data across the Serial Ports. And that certain pins can be used to "bypass" the USB B serial connection on the Arduino. The problem I have is, if this is done, would GRBL still be able to interpret the data you were sending across or even read it? And if it can, how do you have to send it across for GRBL to accept the format? Can you just send the lines of G Code as separate data strings?

Hope you guys can help!

Sam
You will need to determine how information is sent to the GRBL program written on the Arduino.. If all you're wanting to do is save and read a program, perhaps you should look into changing your approach to using an SD card.
Of course, if GRBL is simply expecting values to be sent to it via, serial then you can have any other device feed it information. Please note that some of the saved files can be very very large depending on the movements programmed for a particular job...
 

TehMaxwell

Mar 21, 2015
14
Joined
Mar 21, 2015
Messages
14
Thanks for the information!!

So by changing your approach what do you mean exactly? And what sort of devices could also send the information? The problem is GRBL takes up all the available memory on one Arduino, so you need to run two in parallel of you want to read an SD card or anything like that.

Thanks for the help!
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Well, I took a quick look at it, and it appears as though the serial commands can be sent extremely easily.
How do I stream a complete G-code program to Grbl?
Streaming g-code programs to Grbl may be done by a simple call-and-response method through the serial port. Every command followed by a return is responded to when Grbl is ready to receive another command. See the Using Grbl wiki page for more details, as there are multiple streaming scripts and GUIs available to do this for you.
[\quote]
So if you can manage to get ANY other device setup to communicate via serial then you simply send the next line of text each time you get a positive response from GRBL. It's unfortunate that GRBL does not appear to have ANY room left over to read an SD card...
 

TehMaxwell

Mar 21, 2015
14
Joined
Mar 21, 2015
Messages
14
Thats good to know! Thank you so much. That correlates with what my research said, but I wasn't sure. This makes life a whole lot easier, as whatever device your reading from you should be able to just send a string that contains the next line of G Code. I love it when something is this optimized, credit to the programmers of GRBL.

Seriously considering this CNC Machine now, if I do I will post a thread!

Thanks for all the help, I'm really really grateful! :D
 

mausi_mick

Jul 21, 2015
1
Joined
Jul 21, 2015
Messages
1
I have build a view years agoa small cnc machine with headless connection via sd-card under grbl 6.... But it was not flexible enough . Therefore I build a small board with
2 x 16x Keyboards over I2C, a small Graphic SPI-Display (240x320) with a SD-Card on board. The CPU is a modified Arduino NANO with 16 MHz. I changed the supply from 5V to 3.6v , therefore I have no trouble with 3,3V Moduls like SPI-RAM 23K256 (for messages from grbl) and ext. EEPROM 24C128 (self gener. (error)messages. I tested the controller over Rx Tx.
on the display I get information from grbl (UART,rx-tx) . The grbl run now with 9.i (115200 Baud).
I hope that i will be more flexible with the keyboards to change the grbl Parameters or to start G-Code commands.
 
Top