DNC Via Arduino Serial

Hi folks!
Is there any Software I can use to automatically send CNC program line by line through Arduino USB?
I'm building CNC punching machine which uses two stepper motors for XY positioning and a hydraulic cylinder for pressing. The controller is Arduino Mega with Atmega2560 microcontroller.
I'm trying to develop my own firmware using arduino functions

Now I want a Software that can send commands (CNC code) automatically by line through arduino USB.

I've tried to use arduino serial monitor but I have to send it manually line by line.

Could anyone recommend a Software to use or any other method?

I've tried GRBL but I've to highly modify it to fit this use and it need time which I don't have-I'm not much experienced in programming anyway.

I've also tried Metalix V16 DNC, it connects but throws an error on receive or send-it simply doesn't work or I didn't make correct settings.

Anyone help I will appreciate very much. Thanks.

Sending a text line via serial is a trivial operation. WHEN to send each line is where you run into problems. Does your machine respond when it has finished executing each line of G-code?

So far I've succeeded to move the axes to any location I want with different speeds and different axes distances.
(I'm using accelstepper stepper library to drive axes in a desired fashion).

The potential problem is to send a series of lines, single line that doesn't exceed buffer size the machine moves.

What format have you got the movements in now and how are they stored ?

How will you know that a movement is complete before sending the next one ?

The characters received through serial monitor are stored in the serial buffer then sparsed for the meaning.
To be honest I didn't think about "when the motion is complete". But I've realized I've to have queuing mechanism.

You need more than a queuing system, you need feedback

Where are the commands coming from ?

Commands have to come from the serial monitor.

Will you be entering each of them to be executed immediately or will you be entering a series of commands to be executed in sequence once all of them have been entered ?

Will the commands ever come from anywhere else such as a file on the PC or Arduino ?

If I use arduino Serial monitor then I guess I will have to generate a gcode file, open it, copy and paste it on the Arduino serial type bar and then send.

But as I asked before, if I get a software which can navigate to the file location anywhere in the PC and send it to arduino it would be much easier.

Many terminal emulator programs, such as Coolterm, can do this but what about feedback so that one command finishes before the next one starts ?

Hi @mbise1997 .
Will you send data in gcode format?
Does your skecht understand interpolated commands?
How about using an SD card with the gcode file instead of the serial one?

RV mineirin

That's something I need to figure out. Do you think I have to install feedback device on axes, an encoder for example? Or it can just be implemented in the firmware?

CNC is not something that I have any practical experience of but don't CNC controllers typically send back something ("OK" ?) when a command is complete ?

I haven't think about interpolation because my machine is just a positioning system. That if a workpiece is at the required position a punching stroke has to occur- I mean things like punch arc or shapes that requires interpolation of basic shapes wont be implemented; only simple patterns like hole arrays. G code format is to be used.

Well, if anything's sent back to the controller it has to have something to do with each other.
A feedback phrase feedback like "ok" might be just for human but I guess a feedback for the controller has to be a signal like a limit switch state change, an encoder pulse etc...an electrical signal that notifies the controller to do something.

Maybe such a feedback can be made to notify the controller to execute the next command which may or may not be correct because it based on assumption that the command have been executed but actually due to some reason the motion(if motion) was not completed although the comand was executed.

So when you asked about feedback I thought about feedback from physical position of the machine.

"OK" would work for an Arduino too because it could be detected. What I do not know is whether there is such a mechanism

For a simple machine, that will work up to a point. Real CNC machines will have several commands queued and be editing them to see if any will cause the machine to destroy itself. Sending a code to move the cutter beyond where the limits will cause the CNC machine to stop and reject all commands until the error is corrected.
CNC machines do not generally allow themselves to be destroyed and the OP should also not just rely on limit switches.
I guess you can say the CnC code edits the commands before they have a chance to cause damage.
So more than just an OK is necessary. A stop everything command can also be expected.

What I am not clear about is how the timing of a CNC machine works. Suppose a command is sent that moves the tool to say 100, 100 and a hole is then drilled. How does whatever is controlling the movement know that the tool has reached 100, 100 before starting the drilling ?

The CNC controls the stepper/servo and counts the steps or servo moves, just like an Arduino counting steps, sometimes by library. If the drill or whatever is not able to make the required steps, the machine drills in the wrong place and the part is destroyed.
I have often wondered how the machines said to work in the dark, overnight, unattended, discover faults.
Not familiar with newest CNC machines.

@Paul_KD7HB so, basically no feedback.

If you need to move 100 units then send 100 commands to move 1 unit and hope that it works. That is sort of OK unless some steps are missed, but how about the time it takes to make the moves ?

There must be some kind of delay built in before the drilling starts and possibly between each of the 100 moves, albeit a short one in the latter case