gnea / grbl-Mega

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on an Arduino Mega2560
https://github.com/gnea/grbl/wiki
Other
491 stars 227 forks source link

Feature proposal : 5 axis for grbl-Mega #48

Closed fra589 closed 6 years ago

fra589 commented 6 years ago

Hi all,

The first version of GRBL-Mega-5X is here : https://github.com/fra589/grbl-Mega-5X

5-axis version for GRBL Mega with RAMPS 1.4 Since the RAMPS board has 5 stepper driver slots, I added the management of the 2 unmanaged stepper driver slots in the original version of gnea/grbl-Mega.

The number of axes is parameterized using the variable N_AXIS in the file grbl/nutbolts.h, the accepted values are 3, 4 or 5. Great care has been taken to maintain compatibility with the original version gnea/grbl-Mega: By setting N_AXIS to 3, we get the same executable as the original GRBL with same other options. This 5-axis version is currently limited to the use of the RAMP card. The 2 additional axes are the rotary axes A and B.

TODO: (without order priority, but I will continue to make it better)

If you are interested I can make a push request to merge it in this branch...

Regards, Gauthier.

alfredanil commented 6 years ago

@fra589 Would it be possible to add axis cloning to the TODO list for dual Y or else. If it is already implemented please ignore this request. Wonder if Mega has the horse power to run 6 axis, have you thought about porting this to 32 bit MCU like Due (RADDS or Ramps-FD shield) or M4 or M7. Adding S-shape velocity ramp would be even cooler much like G2Core. Maybe even run a web server/web socket as host. Nice job BTW.

fra589 commented 6 years ago

@alfredanil: Yes I think it will be possible to add axis cloning without too hard job... => Added today to my TODO list :-) I have no planing for another CPU port. I tested 5 axes with full 5 axis simultaneous control without lag... The architecture of Grbl is very close to the hardware, which makes it very difficult to port to other processors but makes it very powerful. The Mega card largely supports the 5 axes and should not shudder with 6. In fact, the work of calculating the positioning of the axes is done upstream of the movement during the buffering of the Gcode commands. This consists in calculating the increments of movement on each axis according to the total displacements, the speed and the acceleration of each axis. The whole is then combined into one byte containing one motion bit per axis, another with one direction bit per axis, and so on. Then, the movements are realized using timed interrupts that are exactly the same regardless of the number of axes driven, since they use only 1 byte per function regardless of the number of axes in motion. That should allow to have the same performances until 8 axes ... But there, I think that there will not be enough ports available at the physical level to do everything :-)

@chamnit: By the way, the first post of the 5 axis feature proposal make just a sentence and not a question, so you are right to not reply to it :-) Now, there is my question : Are you interested by a push request of my 5 axis for grbl-Mega version ? or do you prefer that I stay and continue alone with my branch ?

Regards, Gauthier.

chamnit commented 6 years ago

Just as an FYI, Grbl is undergoing an complete overhaul that coincides with the ARM version of Grbl. This is to make it easier to port to various MCUs and make it more maintainable in the future.

As for the 5-axis stuff, I haven't had the time to really look at it. You're not the first person to post a pull request for this. For now, you can continue with your branch. I'm investing all of my time into the next major version, which will leave the old Grbl code behind in a lot of ways.

jflapao commented 6 years ago

@fra589 @chamnit @alfredanil Hello, I have made a DIY CNC from the mpcnc project, but Idon't like the repetier to send a G-CODE, is good for a 3D printer but for a Mill/Router CNC, don't, so from the first place i decide use another g-code sender and becouse at the time i don't find any GRBL version for the MEGA/RAMPS (that's the original hardware for the mpCNC) I decide use a arduino uno with a CNC shield to run my mpCNC and at the first time the universal g-code sender, then the candle, and the GRBL Controller, and in the end the bCNC and the estlcam, all the programs have good things and bad things.

The UGS is very simple but do the job, the only tihing is that i work with a comercial big CNC the cut Stone, and the look is important for me. The candle is nice and sharp, but becouse in time i use the raspberrypi, the candle have no version for the ARM Linux The GRBL Controller, i don't like periode. My program now is the Estlcam to do the cam that is very simple in, and the bCNC to use like the g-code sender and machine possition, the cam is good but a quite hard to use.

With the time i need to add a lathe axis to my mpCNC and at the first i use the Y axis reducing the step to act like a A axis and rotate the piece, but every time i need to use the full version off the mpCNC i have to change the connection form the lathe to the Y axis and change the stepp again, when i seel the firts GRBL to the mega2560, i think for my self, thats the thing i need, with the mega i have the 3 axis XYZ all the time connected, and i can use the 4 axis to the lathe with no need to change anything in the hardware, but now i have a problem the software... i use a mod version off the bCNC to send the g-code but have a lots of bugs and all must of the time hang the machine and i louse the job, i don't know realy if is the bCNC or if is the GRBL inself.

I don't know nothing about programing, but i can help use my mpCNC for now with only 4 axis XYZ and a rotate one to a lathe, but i have in mind build one that i need 6 axis interpolated at the same time that can move XYZ a axis with rotation in the Z axis i think is the A axis and another in the Z axis that i think is the C axis and the 6 one to do the lathe axis, I don´t know if the MEGA 2560 can handle all the 6 axis interpolated, I know that the RAMPS only have 5 ports but we can use the AUX2 of the RAMPS to add more 3 ports see this page ( http://reprap.org/wiki/Adding_more_extruders ) and if is possible create a program that can hangle all the code, I have comercial cam programs that can do the code for my work machine.

So i think we can do a lots of good work in the hardware and software

creatron commented 6 years ago

I ported the software to run on 'CPU_MAP_2560_INITIAL' by just adding some macro's, it seem to operate fine., however I am new to CNC, and have a four axis available. G1 X10 Y10 Z-10 A10 F120 seem to drive stepper at the same time, indication things seem to operate fine. However I added end stops to my CNC, and do not know how to handle the rotating axis. If I link the mega pin to ground , and send a home command, the rotation axis it just turns and after a while ends with an error. How does one attach a position indicator as it is not a 'real' end stop? . If I move the 'homing' I can home the X, Y and Z successfully.

While I am asking is moving more than +-360 an error or not?, some web pages seem to say just that , but it does not make sense to me.

Thanks for your enormous contribution..

rodrigorrm commented 6 years ago

Hello there,

Which G-code sender program should I use for controlling the 5-axis GRBL?

fra589 commented 6 years ago

Hi @rodrigorrm,
You can try my cn5X++ (https://github.com/fra589/cn5X).
I am writing this new 5/6 axis Grbl control panel to implement all the grbl-Mega-5X capabilities because I don't find any good software to do it.
Then, you will be new beta tester.
@++;
Gauthier.

JorgenCollinson commented 6 years ago

Hey.

When you say 5 axis.... Are you talking about a second Z axis or full 5 axis control.

J

On Thu, 6 Sep. 2018, 12:58 am Gauthier Brière, notifications@github.com wrote:

Hi @rodrigorrm https://github.com/rodrigorrm, You can try my cn5X++ (https://github.com/fra589/cn5X). I am writing this new 5/6 axis Grbl control panel to implement all the grbl-Mega-5X capabilities because I don't find any good software to do it. Then, you will be new beta tester. @++; Gauthier.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gnea/grbl-Mega/issues/48#issuecomment-418762559, or mute the thread https://github.com/notifications/unsubscribe-auth/AMlvg8QlHQbbDdKwQvdN8EC6NJ4jHMqhks5uX-adgaJpZM4RQv_B .

fra589 commented 6 years ago

Hi, I mean full 5 axis control. The last version is also able to make 6 axis full control ! :-)
It depend of my last version of Grbl-Mega-5X wich have an output functionality wich say his axis number and there names. So, it can manage both full axis independantly or cloned axis like dual Z axis.

@++; Gauthier.

geargh commented 5 years ago

Hi, After Compile and installed, EEPROM value wrong($$). Original gnea version was same. Grbl 1.1h ['$' for help] [MSG:Check Limits] [MSG:'$H'|'$X' to unlock]

$X [MSG:Caution: Unlocked] ok $$ $0=255 $1=255 $2=255 $3=255 $4=1 $5=1 $6=1 $10=0 $11=2147483.648 $12=2147483.648 $13=0 $20=1 $21=1 $22=1 $23=255 $24=2147483.648 $25=2147483.648 $26=255 $27=2147483.648 $30=2147483648 $31=2147483648 $32=1 $100=2147483.648 $101=2147483.648 $102=2147483.648 $103=2147483.648 $104=2147483.648 $110=2147483.648 $111=2147483.648 $112=2147483.648 $113=2147483.648 $114=2147483.648 $120=2147483.648 $121=2147483.648 $122=2147483.648 $123=2147483.648 $124=2147483.648 $130=2147483.648 $131=2147483.648 $132=2147483.648 $133=2147483.648 $134=2147483.648 ok

antoniogt01 commented 5 years ago

Hello it sounds amazing to use Arduino Mega 250 + Ramps 1.4 with 5 axis machine cnc. But my question is how do we should design the machining strategy of our stl, which software for Cam (universal gcode sender reach 3 axis maximum) do we have to use to generate a g-code and if there something to control directly the motor using a pc. Sorry by my ignorance but i really want to use this 5 axis GRBL to upgrade a multitool kit Thank you!

fra589 commented 5 years ago

Hello @antoniogt ,
grbl-Mega-5X have a real capability of 6 axis, and the port of capability to up to 8 axis will be arrive soon.
Since I didn't find any Gcode sender able to implement all the 5X capability, I decided to create my own sender : cn5X++. It's still an alpha version, but it begin to be usable for real milling. The GCode generation directly from stl is too complex to be fully auto. You need CFAO softwares like Fusion360, or better, the open source FreeCAD with his great module Path. It still under active developpment, but realy promising. @++; Gauthier

antoniogt01 commented 5 years ago

It sounds great! Im very glad to read that there is some options to run with 5 axis, ill download your cn5x++ but it only aviable with Linux or with windows or Mac OS as well? Im using Mac. I was taking a look about Freecad Path but I only found tutorial for 3 axis, do you know if Freecad Path can manage 5 axis too. And what about if i use Fusion360? How must i wire the arduino mega 250 + Ramps 1.4 with the GRBL 5 mega flashed inside? Just by the USB connector? Thank you very much by your fast response

Earther121 commented 5 years ago

@fra589, you are the best!, realy man u cant imagine how much time it took for me to find such configuration for mega with ramps 1.4, i want to thank you so so much for that great work you did, i tried the 5x file , well it seems working good, as am new in cnc world in general and still learning , i faced some issues in ugs like error 9 and error 20 , but am sure with some learning i could solve it, i really cant wait to try your cn5x, downloaded , not tested yet, again , thank u so much and keep it up.

fra589 commented 5 years ago

Hi @antoniogt,
I think cn5X++ should work on Mac if requisits can be installed on it (Python3, PyQT5 and PyQT5-QtSerialPort (automatly installed on Windows when installing pyqt5 with pip command)). I don't have a Mac, so, I can't be sure. Actually, FreeCAD have capability of 3 axis under his stable version, but under very active developpment, it allready capable of 4 axis : https://www.youtube.com/watch?v=6sEzrnasdgo I think the 5 axis can come not too late... Fusion 360 have 5 axis capability, but I think only in his ultimate version... Not free ! To flash grbl-Mega-5X on Arduino Mega, you only need USB connection and the ad-hoc software, for example, Arduino software work weel for this : https://github.com/grbl/grbl/wiki/Flashing-Grbl-to-an-Arduino @++; Gauthier

antoniogt01 commented 5 years ago

Hello, i just ordered an Arduino 250 + ramps 1.4 board kit in order to put my hands in this project and try to help as well, ill try to load the Arduino sketch and connect the motors of my 3d printed and asses the beheavour. Anyway i just saw that there is an option to use 5 axis through g-code generation from Blender, its named “Blender Cam” but its quite hard difficult to install but it runs with 4 and 5 axis for free but there is not su much support with tutorials in internet

BernardG commented 5 years ago

Fusion 360 have 5 axis capability, but I think only in his ultimate version... Not free !

Nope! You have ALL Manufacture capabilities (new name for the CAM module) in the free licences (and not versions). Just in case you don't realize this, Fusion 360 CAM is the same module as the HSM module in Inventor, and in HSMWorks, module for Solidworks....

The limit is your imagination, and abilities, not the software....

antoniogt01 commented 5 years ago

So i supose that once that you design your milling strategy in Fusion 360 Cam you need a software to send the g-code to the brakeboard like Mastercam or Mach3? The thing is what about the driver for nema 17 control, or if you want to use nema 23 with bigger drivers, how do you wire it? And another question is about all the wiring in the board between components, we dont have it? And Ramps has actually 5 outputs for stepper drivers (3 XYZ axis and 2 extruders) how do you change it for use them as individual axis? in the firmware i mean Thanks again for all your effort

clement666946 commented 5 years ago

boujour a tous. salut @fra589.

je fait une rapide présentation. depuis peut de temps dans les programme de domotique et cnc. en cour de conception d'une imprimant 3d et en attente d'en recevoir une.

technicien outilleur, bts en industrialisation des produit mécanique. je suis tourneur fraiseur de métier. d'ou l'utilisation avancer dans le g code.

je vien juste de voir cette discussion. est je suis extrêmement intéressait par ce que tu est en train de faire. vue que j'ai aussi l'intention de concevoir une cnc 5 axe minimum vue que je dispose de logicielle pour concevoir du g code multiplie axe même si je serais capable de l’écrire sur papier ce qui serait inutile.

bref. je ne savait pas comment vous joindre d'ou le fait du message sur le forum.

comment peut on vous joindre ci l'on ce trouve en difficulté via votre version de grbl ?

vue que je ne suis pas un grand spécialiste en programmation d'arduino et encore moins dans la domotique.

sur ce merci pour votre travaille en espérant pouvoir ce tenir au courant. cordialement.

je vais tester votre fichier d'ici peut de temps ;)

fra589 commented 5 years ago

Bonjour @clement666946,

Ma version grbl-Mega-5X est hébergée ici : https://github.com/fra589/grbl-Mega-5X
Les questions et bugs rencontrés peuvent y être discutés dans l'onglet "Issues".
Ne pas hésiter à chercher dans les questions déjà posées et résolues (https://github.com/fra589/grbl-Mega-5X/issues?q=is%3Aissue+is%3Aclosed) avant d'en poser une nouvelle... C'est sûr, l'usage de l'anglais rend la compréhension plus difficile, mais Google translate marche suffisament bien pour m'éviter de répéter trop souvent les mêmes choses. :smile:

@++;
Gauthier.

interweb-md commented 4 years ago

Hi Gauthier, I've done 4 axis rewrite for grbl few years ago and machine is working fine so far. It was needed for hot wire machine control, there are 2 towers with 2 axis each, so i needed 4 independent axis. The thing is how to limit feed rate. Now i need to upgrade this machine and add nother 5th axis. I've found your 5 axis firmware but here is my issue. Your firmware is basicaly 3 axis machine + 2 independent axis. It means feed rate is calculated based on tool motion in space held by 3 axis. It's wrong in my case. I suggest to rewrite grbl in a universal manner. For example you have 5 axis machine and in configuration file I want to set configuration for example 2 axis + 2 axis + 1 independent axis. In this case feed rate is calculated for first pair, then second so the maximum of these two has to be the actual feedrate. Hope you understand. So my question is if it is possible to refactor grbl in a configurable manner so you can configure groups for different setups. Thank you.

fra589 commented 4 years ago

Hi @interweb-md, My 5/6 axis firmware version is not a 3+2 or 3+3 axis, but a full 6 axis version. The speed is calculated for all axis to have linear movment with all axis ending at the same time with the good speed. The speed calculation is pretty complicated because it also compute acceleration on all axis to ensure than no max speed or max accel are overshooted. Try to see in the file planner.c, where the speed is calculated if you find how to adjust it for your need... @++; Gauthier.

ozkankara3329 commented 4 years ago

I will make cnc using mega2560 and ramps1.4. Y and Z axes will be double motors. E0 output will be Y axis, E1 output will be second output for Z axis. mega grbl 5x program. How can I make the setting

ozkankara3329 commented 4 years ago

DEAR fra589 I would be glad if you can help ..

fra589 commented 4 years ago

Hi @ozkankara3329,
1) Read all the docs on the wikis pages :

ozkankara3329 commented 4 years ago

Ramps 1.4 --- E0 driver will be the DUAL Y. E1 driver will be the DUAL Z.

I named AXIS 4 Y. I named AXIS 5 Z, but; Y is still running from drive A. Z also works from drive B. What am I doing wrong.**_

define N_AXIS 5 // Number of axes

define N_AXIS_LINEAR 5 // Number of linears axis

else

define N_AXIS 3 // Number of axes = 3 if not DEFAULTS_RAMPS_BOARD

endif

define AXIS_1 0 // Axis indexing value. Must start with 0 and be continuous.

define AXIS_1_NAME 'X' // Axis names must be in X, Y, Z, A, B, C, U, V & W.

define AXIS_2 1

define AXIS_2_NAME 'Y'

define AXIS_3 2

define AXIS_3_NAME 'Z'

if N_AXIS <3

error "N_AXIS must be >= 3. N_AXIS < 3 is not implemented."

endif

if N_AXIS > 3

define AXIS_4 3

**#define AXIS_4_NAME 'Y' // Letter of axis number 4

endif

if N_AXIS > 4

define AXIS_5 4

define AXIS_5_NAME 'Z' // Letter of axis number 5

endif

ozkankara3329 commented 4 years ago

Can you send the hex file with the drivers as below. Hex file compiled with N_AXIS = 5 & axis names = X, Y, Z, Y & Z

fra589 commented 4 years ago

No, I can't.

I don't have the capacity to offer hex files for all possibles configuration and for all users who ask me.

1) read the docs: https://github.com/gnea/grbl/wiki, https://github.com/fra589/grbl-Mega-5X/wiki 2) read the docs: https://github.com/gnea/grbl/wiki, https://github.com/fra589/grbl-Mega-5X/wiki 3) read the doc: https://github.com/gnea/grbl/wiki/Compiling-Grbl 4) adapt grbl to your need and compile it and upload it to your Hardware by yourself 5) ask in the right issue page (not this one!!!) if you have a real issue which doesn't have already been replyid, without forget to give all necessary details of your config.

Help yourself and heaven will help you.

@++;
Gauthier.