would it make sense to spend the time and effort to write your own g-code interpreter/stepper motion controller that would run as a normal sketch file instead of using flashed firmware (with direct serial communication)?
The thing is, that i have not yet really delved into the whole cnc thing but it seems as a decent learning experience. Would this involve way too much work and complexity and would be better off sticking with GRBL?
My guess...obviously grbl is way more advanced than what some random guy could write in a week's time. To be honest i don't really see what are the gains, except the learning experience.
What's your take on it?
far_1:
would it make sense to spend the time and effort to write your own g-code interpreter/stepper motion controller that would run as a normal sketch file instead of using flashed firmware (with direct serial communication)?
The short answer is very very simple. If existing software will do what you want it is a complete waste of time to duplicate the develoment effort.
However ... it can be fun ...
There are a few different and not necessarily connected concepts in the sentence I have quoted
g-code interpreter
stepper motion controller
normal sketch file instead of using flashed firmware
with direct serial communication
I don't know what you have in mind with the 3rd item "normal sketch file instead of using flashed firmware". The only difference between the GRBL software and an Arduino sketch is the code.
And I don't know whether you want to use, or to avoid using a serial connection.
I have become interested in this subject because I don't understand why the complicated calculations - the G-Code interpreter - isn't done on a PC which just sends motor instructions to the Arduino. That, in turn, would simplify the motion control software. I am slowly writing a PC program (using JRuby) and an Arduino stepper control program for a simple 3-axis system using a very small metal working lathe as the platform.
Robin2:
I have become interested in this subject because I don't understand why the complicated calculations - the G-Code interpreter - isn't done on a PC which just sends motor instructions to the Arduino. That, in turn, would simplify the motion control software. I am slowly writing a PC program (using JRuby) and an Arduino stepper control program for a simple 3-axis system using a very small metal working lathe as the platform.
That is exactly the reason why i started thinking about this. I'm in no position to judge the method, but my gut feeling tells me that it's more complicated than it should be.
This is in no way a criticism, since like i've said, i'm not knowledgeable enough on the subject to be passing judgement. But the weird feeling persists.
I don't want to invent warm water again, so i guess i'll just stick to the old proven way. But if you do come up with an alternative i'm eager to see it. I wish you the best of luck.
I often find myself re-implementing things because of the overcomplicated way other people code things. Inefficient in regards to time spent, sure, but I like to think that my code ends up tighter. There's always a tradeoff, though. When optimizing a solution to a problem, you usually end up neglecting corner cases. But, if you don't care about the corner cases, then you can usually come up with a faster, more compact / simpler solution.
Robin2:
I have become interested in this subject because I don't understand why the complicated calculations - the G-Code interpreter - isn't done on a PC which just sends motor instructions to the Arduino.
At that point you might as well use Mach or something similar. There's actually a good reason to have the Arduino (or some external controller) drive the machine, and that's to untether the machine from the PC.
For instance, you might want to share the printer among multiple PC platforms (Windows, Mac, Linux, etc) - which might not be easily doable depending on the platform and how you have things set up. There's also the issue that you might want to keep the accuracy of the print as high as possible - if you were running other software on the PC controlling the printer, you might miss steps or other issues might crop up (such as the PC crashing or something?) that would result in a ruined print. By decoupling the printer from the design machine, you can alleviate this concern.
Or you might have a situation where you want to queue up jobs to the printer - by decoupling it, you could put it in a central location, and the code could be loaded from the SD card and put into the queue on the printer; the person could then take the card and continue working.
Finally - there's the instance of having many, many machines (a printer cluster farm, for instance) where it wouldn't be practical or possible to have a PC per each machine.
Now - granted - nothing says you have to use an SD card to load the g-code into the printer. Ideally, the printers would sit on a network and you would just shoot the file over to the printer like you would any other job. Even so, the decoupling would be better to have in this case (rather than the PC streaming the g-code to the printer over the network). Such a networked printer could be made rather easily (as a proof of concept) by tying a Raspberry Pi to the Arduino controlling the printer (plus a bit of custom software to push the g-code sent over the network to the Arduino firmware via the USB serial port, instead of using an SD card).
far_1:
My guess...obviously grbl is way more advanced than what some random guy could write in a week's time. To be honest i don't really see what are the gains, except the learning experience.
What's your take on it?
I guess doing anything can be a good learning experience.
What would be useful is a standalone library to do coordinated motion with multiple steppers, something which doesn't exist already. It wouldn't need to handle g-code. This would be a lot easier project to tackle from scratch, although you could nick the parts of GRBL, Marlin etc to get a quick start, or at least give a guide.
I recently ported Marlin to Due, so I am quite familiar with it. I haven't done much with GRBL, but the planner/stepper modules have been widely borrowed for printer software.
Personally I think trying to reinvent the wheel with some hybrid of Mach/GRBL which is supposedly simpler/better is a waste of time, and not a useful suggestion for newbies. It might be different if someone actually demonstrated some code that worked, but that seems unlikely to happen.
I develop a G-Code intepreter using a APP for Android Tablet using one "Arduino Mega 2560 R3" via USB and 3 standard "Arduino Motor Shield R3" to control 3 bipolar stepper motors.
App have a "Help and documentation" window that explain all. How connect all boards "Arduino Motor Shield R3" and 2 sources of example into this help window for "Arduino Mega 2560 R3" to control bipolar stepper motors and unipolar stepper motors (but with other shield standard Arduino Motor Shield only is valid for bipolar stepper motors).
I understand that you want develop your own intepreter, but you can use this software of example and get ideas is GNU GPL free copyright.
Window of "Help and documentation" on APP have a lot of links to more software CAM programs, explain system CAD/CAE/CAM/CNC ... you can use like a little guide.