how to modify GRBL for Z axis to tool ON OFF

LineKernel
Posts: 65
Joined: Sun May 20, 2012 11:42 am
Location: France-Avignon
Contact:

how to modify GRBL for Z axis to tool ON OFF

Post by LineKernel » Thu Oct 04, 2012 8:14 pm

Hi
i would be interested in trying to mount my 1W laser onto my Shapeoko
how should i do this software side ?

is there some examples around ?
can it be done without modifying hardware ?

i am running my Shapeoko with a GRBLshield

i was thinking using the analog in pins because they are free

LineKernel
Posts: 65
Joined: Sun May 20, 2012 11:42 am
Location: France-Avignon
Contact:

Re: how to modify GRBL for Z axis to tool ON OFF

Post by LineKernel » Thu Oct 04, 2012 9:59 pm

if somebody else is interested , i think this is a good starting point
http://www.instructables.com/id/Pocket- ... /?ALLSTEPS

potatotron
Posts: 135
Joined: Sun Apr 29, 2012 12:47 am
Location: Southern California
Contact:

Re: how to modify GRBL for Z axis to tool ON OFF

Post by potatotron » Thu Oct 04, 2012 11:29 pm

I think the easiest thing would be to connect a relay to your laser and control the relay from the spindle pin. Then you could use the normal G codes M3 (enable spindle) and M5 (turn spindle off) to control it.

I did something similar for my ShapeOko pick and place machine; instead of controlling a spindle I've got mine turning a vacuum pump on and off.

Good luck!

LineKernel
Posts: 65
Joined: Sun May 20, 2012 11:42 am
Location: France-Avignon
Contact:

Re: how to modify GRBL for Z axis to tool ON OFF

Post by LineKernel » Fri Oct 05, 2012 3:04 pm

@potatotron , hi

my spindle is not connected to my arduino ,
so there is a pin that automatically turn on and off the spindle ? (if yes where do i get the info about what pin it is ?)

because the driver i have on my laser can be controlled directly with a pmw , so i guess it could handle a HIGH and LOW command from the arduino .

also , how would you go from vector file to Gcode with such a setup ? i only played around with pycam and a pen for now .
is there some option in pycam that ll turn on and off the spindle instead of moving the z axis up and down ?

potatotron
Posts: 135
Joined: Sun Apr 29, 2012 12:47 am
Location: Southern California
Contact:

Re: how to modify GRBL for Z axis to tool ON OFF

Post by potatotron » Sun Oct 07, 2012 7:14 pm

With GRBL the default is Arduino pins are D12 for spindle enable and D13 for spindle direction. See this page:

https://github.com/grbl/grbl/wiki/GRBL-Pinout

You can change this to whatever you want by getting the source code, editing config.h, and recompiling. Instructions on that are here:

https://github.com/grbl/grbl/wiki/Compiling-Grbl

You could move the spindle enable pin to one that supports PWM (for example, just swap the Spindle Enable and Spindle Direction pins, and use PWM on pin 13), but I think GRBL itself only supports "spindle on" and "spindle off" so you would have to modify the source code for that.

I'm sorry but I'm not familiar with pycam, so I can't help you with that.

Good luck!

LineKernel
Posts: 65
Joined: Sun May 20, 2012 11:42 am
Location: France-Avignon
Contact:

Re: how to modify GRBL for Z axis to tool ON OFF

Post by LineKernel » Mon Oct 08, 2012 1:27 am

thanks a lot potatotron ,
i ll make some test with a pen , a pycam export , and some Leds , to see what s happening on pin 12 and 13 in a normal setup

i still think the input in my laser driver is capable to handle "on and off" in its pmw input

LineKernel
Posts: 65
Joined: Sun May 20, 2012 11:42 am
Location: France-Avignon
Contact:

Re: how to modify GRBL for Z axis to tool ON OFF

Post by LineKernel » Mon Oct 08, 2012 4:16 pm

so i did the test , and as common sense tells , the (virtual on off of the) spindle ("understand LED") start at the beginning of the gcode stream , and turns off at the end
so ...
what would someone do to have all z axis command changed to spindle ON OFF commands without doing it manually in the gcode file ?

fito
Posts: 79
Joined: Thu Aug 09, 2012 5:45 am

Re: how to modify GRBL for Z axis to tool ON OFF

Post by fito » Tue Oct 09, 2012 3:28 am

That would be up to the cam software that generates the g-code. I don't know if any of the cam packages used in the community have a laser engraver option but there might be some around.

One of the users on this site (can't remember his username or the post) is just using a high seek speed so that the laser doesn't 'engrave/cut' over areas that are not to be 'engraved/cut'.

Edit. Here's the quote
jhllt67 wrote:So far I haven't been turning it off. I just set the G0 speed high enough that it doesn't have time to cut (still leaves a very fine line).
Last edited by fito on Tue Oct 09, 2012 4:59 am, edited 1 time in total.
Adolfo Cortés
ShapeOko 649

fito
Posts: 79
Joined: Thu Aug 09, 2012 5:45 am

Re: how to modify GRBL for Z axis to tool ON OFF

Post by fito » Tue Oct 09, 2012 4:46 am

The other option is to modify the grbl source code such if a gcode

Code: Select all

 z1
or any positive z value is received then actually do

Code: Select all

 m5
spindle off. If a z axis move is to a negative then actually do

Code: Select all

 m3 
.

Alternative there is github project to use emc2 with laser engravers https://github.com/bjj/2x_laser . I don't know anything about it but it might be useful to you.

I too would like to add a laser as a spindle to my shapeOko but that is not something I am thinking likely to happen in 2012.

Best of luck, keep us updated if you can.
Adolfo Cortés
ShapeOko 649

jhllt67
Posts: 47
Joined: Fri May 04, 2012 1:57 am

Re: how to modify GRBL for Z axis to tool ON OFF

Post by jhllt67 » Tue Oct 09, 2012 10:35 pm

I know I saw an option in Cambam to insert code at the beginning/ end of cuts. I can't remember exactly where it was but it could turn the spindle on or of so it should work for this. I'll see if I can find it this weekend when I get home.

Post Reply