Parse Gcodes without the use of a computer

Hi there,

I have been trying to accomplish the goal of eliminating the use of a laptop and Universal Gcode sender software to send Gcodes to the arduino. I require an application such as, storing multiple Gcode files in an SD card, Connect the SD card to the arduino and then accessing the necessary code for the desired option.

Any comments and suggestions will be helpfull.
Please and Thanks

Search for topics using Arduino + sd card.
Gcode should look like handling text strings.
Fairly easy

Thankyou for getting back to me.

So if this is true, I can just connect an SD card to Arduino. Arduino will print commands serially for the Gcodes(.nc) file and send signals just as it would from a text(.txt) file?

Again, i really appreciate you are helping me. If possible, would you be able to provide me any good resources for such application?


Run some sd-card tutorials to learn how this device works.

The Gcode is actually like text. Study examples handling text.
I read Your question as the Arduino reads the prepaired and ready SD and transfers that data to the receving device.

Can You draw like a block diagram how the flow of Gcode will be? Words are not very engineering....

Thanks. Yes, I can tell you the basic working principle of the G code. Unfortunately, I can't attach any files due to my newly created profile.

2 axis Semi automated head Polisher. Grinding the Distilling tank heads and cones. Fixed rotating base, Grinder follows the contour along the XZ plane. Motion is implemented using Stepper motors and rack and pinion. Arduino controlled Stepper motor drivers. Prefeed G codes in SD card for accessing them as per the input.(Can't use a laptop due to harsh environment conditions).

I get this: A prepared SD card is read by the controller and the controller operates 2 steppers according to the Gcode.
Code for a Gcode interpreter will be needed as well.

Seems you are considering a program to read a line from the SD card and send it to the machine. Right?
How many milliseconds do you expect it will take to send each line to the machine? What will the machine be doing while these lines are being sent? Will the machine just store them?

Hi @lovjeet021101

I have a CNC (by myself) and I use Mach3 to control it.
The CNC is connected to the PC's parallel output.

How the control works in a very simplified way...
Mach3 sends a command, (a GCODE line), to the CNC, waits for the completion of the sent command, then sends a new command.

How do you know the command execution is finished?
Mach3 sends pulses (calculated by it) to the CNC to move the motor specified by the GCODE, and when it has sent all pulses, the operation is finished.

I don't know what control software you are currently using.

When using the GCODE lines read from an SD card and sent to your "CNC", you will have to use a software that "knows" when each command has finished and then sends the next command.

RV mineirin

This message that indicates the Gcode device has done all you have sent to it and is waiting for a new command is simply the two text letters "OK".

In this project:- CNC Conversion
I wrote some software that sends a Gcode file to Gcode device. It is software that is running on a computer using the processing language. The source code is available on that page.
There is no reason why that should not be converted into C and run on an Arduino from an SD card. The processing language is based on Java and java is implemented with a C syntax so it is not so difficult to translate it into Arduino.

However, it does have some graphics controls to help you do things like set offsets and position starting X-Y-Z points which might not be so easy to emulate but it will be possible.

Thankyou, won’t a grbl library installed on the arduino would be an interpreter itself?

Thankyou for helping out,but i don’t understand the question.

I’m working on an arduino based stepper control.

I didn't ask a question.

So then it is even simpler with only one processor providing you have the room for the code. In essence you simply need to replace the bit in the code that waits for an input with the read from the SD's file.

In practice, it is a bit more difficult because you have the problem of all the other stuff that you have to do before you start reading the Gcode file. Like choosing the file name to run, nudging the tool into the correct starting position, emergency stop, and so on.

Thankyou,It’s practically just a grinder hanging off the linear actuator, so there will be only the jogging. Which i can do using the Arduino logic itself. But after reaching the first point, we will use gcodes.