GRBL setting and wiring from my arduino cnc shiled to my CO2 laser power supply

Hi everyone.

I hope someone can help?

I am having problems wiring my CO2 laser to my Arduino cnc shield.

My Laser power supply have TH, TL, WP, G, IN, 5V pins where I have to wire my laser into.
I understand the IN pin if for my PWM and I think it should go to my Spindle + pin for variable strength for the laser.

I am not sure which pin on the shield is for turning the laser on and off on my cnc shield.

I already loaded and run the GRBL code to my cnc and it work ok on my cnc axis.

I am also not sure what part of the code i need to change for laser and PWM settings?

Can someone please help.

Regards

Johannes

You would need to use the coolant pin for ON/OFF and include a G-CODE command to initiate it.

For PWM you need to ensure your laser PWM is compatible with the the shield PWM.
Different versions of GRBL use different pins so also be careful in choosing the correct pin.

Hi Thank you very much for your reply.

Can you please tell me where to change the code to use the coolant pin and what code i have to put in?

Regards

You would change the g-code in the pre-processor (beginning) by adding a coolant command

Depending on the program you are using to generate the g-code you may be able to insert it as a pre-command.
Otherwise you would have to add it manually to each program.

May I suggest the following links to be useful. Then you will know what sort of information to add in future.

Bob.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Hi Bob

I amusing laserGRBL and laser on os only M3 or M4 this is the spindle.

Do you know if there is a wiring diagram somewhere for the wiring>

Regards

Johannes

I use laser grbl here too and that has the PRE settings where you can change things.

Click GRBL, SETTINGS, then select the GCODE tab.
It should be set by default anyway and named as FAN.
My preference for the actual connection to the board is to use a relay module or a suitable MOSFET arrangement rather than directly connect to the shield.
Doing so allows you to control higher voltages and isolate the signal to protect the shield.

There are some other posts in this section that detail using relays and mosfets for external outputs.
In you case where more than one control might be required you could trigger a dual relay module to cover multiple outputs. EG one for the lasers fan and another for the voltage to the laser so that one cannot operate without the other even if they use different voltages.

On my semi homebrew laser that is the approach I use and the fans must be running before the laser can fire. which is my own safety measure as it resides in my basement not far from me :grin:

Hi Bob

Thank you very much for your advice.

I am new at this so i am not sure how to do everything.

Do you perhaps have a wiring diagram for your system so I can see how everything is connected as it is not so simple if you haven't done it before?

Also the code I know how to get to it but not sure which line to alter>

Sorry that i am such a pane.
Regards
Johannes

This is for a relay

It may be safer than assuming you know how to find a logic level mosfet module with opto coupling.

Clearly you can get these relay modules with more than one relay.
Mine take a buck device and lower the voltage from the 24 volt PSU to 5 volts to feed the low power side of the relay and then the input signal is just jumpered to each additional relay trigger pin.
A common ground back to the shield is also required.

If any of these terms are out of your depth then you may want to read up on them and learn some basic electronics theory.
CNC machines are generally a little above beginner level and more so modifications.

Hi Bob

Thanks for the advise.

I did build a few cnc machines but it was for Mach 3 on a parallel port so the USB is a bit different.

I can get the laser to switch on and off with the Z+ axis when when it cuts but I am not sure about the

coolant port and the PWM connection. But i understand if you do not want to help anymore.

Many thanks

Johannes

Didn't notice but the pic didn't post correctly.

It is not that I dont want to help.
It is however expected that the recipient either has the skills or is willing to learn.
Given you have built other CNC machines even mach3 then that is a good indicator of enough basic (or more) skills to handle g-code in pre and post routines.

I dont have any schematics of my own as they are all in my head and often built on the fly.
Let me see if I can snag a pic that will stick.

EDIT...This gives a clearer idea

Another here
spindle relay.jpg

That guy is using a relay to switch a larger PSU but in reality that PSU could be any other device.

Is your laser doing what it should in regards to power levels following a pwm signal ?
Or just full on full off ?
Ideally you need it to follow PWM to set the power levels.
In GRBL these tend to follow spindle speeds.
Often it it better to set a max spindle speed in GRBL to something divisible by 100 with 100 being MAX.
An output of 255 from the Arduino should follow that roughly with 255 being 100%.

A scope or logic analyser can be useful here as most multimeters cannot follow PWM signals too well.

Mine has the max normal spindle speed of 24,000 rpm as I can swap the spindle for the laser so here 24,000 is max power and 12,000 is 50% etc. Suppose I could just swap the configs in and out as laser grbl has that facility but I am too lazy and know most of my settings for laser power in my head again LOL.

Additionally if you want to leave yourself a safety margin you could change the figure so that max power is just short of the actual max power. My other CNC is set that wayas I get some extra vibration at max spindle speed so I dropped the max by a little over 5% so I never reach vibration.

Additionally if you buy relay modules try get the ones with OPTO ISOLATION as the will help prevent back emf upsetting the Arduino.

Also with Arduino CNC usage be wary of noisy signals especially from limit switches or other close by inductive loads.

spindle relay.jpg

Hi Bob

I done a quick drawing of my setup to my laser power supply from the Arduino CNC Shield.

Like I said it works on on the Z axis at the moment turning Full on and full off.

I Can set thje power with the potentiometer but not with PWM.

If i take the potentiometer off then the Laser power supply does not work that is my problem where do i

connect the cable that come of the potentiometer to get it work with PWM.

I would like to get it to work from Spindle pin and PWM.

My trigger for my laser power supply and the PWM is only 5V so I don't think i need a relay but can add one if needed.

Regards

Johannes

Laser CNC.pdf (443 KB)

You first need to be sure that the voltage on the potentiometer does not exceed 5 volts at any point !

There are 10 volts PWM variants out there in the wild and even larger.
The last thing you want to do is push excess voltage back to the shield.
If it checks out at 5 volts and less across the range you can move ahead.

Next disconnect the red wire to the potentiometer as it will be redundant.
The yellow wire will go the the spindle pin. (need to know which version of GRBL you have to know which pin to use)

The ground wire will remain in place but make sure there is no voltage on that jumper and if there is you will probably have to remove the jumper to the water function and find another method to trigger that as I am not sure why it is connected to the pot anyway ?

You may have to use the coolant enable from the shield to trigger the red wire you currently have to the CNC shield (possibly via a relay) A Mosfet would be an easy fix for that too.

You also need ENABLE laser mode in GRBL ($32) for aesthetic reasons unless you like burnt corners in direction changes :grinning:

Laser grbl allows you to also set up some simple macro buttons.
On mine I have a 5% setting which doesn't burn but allows me to use the laser as a guide for positioning. Macro for that is "G0 M3 S05"
Then I have the obligatory full power "G0 M3 S255"
And of course the Whoops not yet turn it off my eyes cant see "M5"

You can make and assign your own icons for those functions.
Laser grbl used to have an export function but it was dropped :cry: otherwise I would have attached by settings for you just to import.

Hi Bob

Thank you very much for that.

Please see attached my GRBL Configuration and Config File.

Regards

Johannes

config.h (49.2 KB)

GRBL Configuration.pdf (302 KB)

Hi There

The jumper if to enable the power supply otherwise it does not work it is for protection, I suppose the jumper can stay.

The code you send me for the button does all of it go into one button?

Regards
Johannes

The jumper sounds like it is meant as a safety feature to ensure you have water running / present so you may want to treat that the way it is supposed to work to ensure you dont overheat the laser. Those things are not cheap to keep swapping out.

Lasergrbl...No they are seperate buttons.
I just snagged some icons off the web and added my own numbers but there are probably plenty of icons you can choose from.
These are the ones I use. Because I have a Z axis I also have z plus or minus 2.5 mm for quick focus.
It seems to work ok for me here but I only have 5,10,15 watt blue lasers.

2020-03-01 at 08-44-55.jpg

2020-03-01 at 08-44-55.jpg

Your grbl config is not too much use to me as different drive systems, pulleys, lead screws, stepper motors all combine to different numbers that probably wont match what I use.

Its the numbers from the parameters/settings in lasergrbl that may make more sense.
A quick looks says they are probably fine.
With your prior experience you would I guess have already tuned in the settings for steps per mm etc to make sure your travel corresponds to what it should. I simply used a digital vernier for all mine.

Most of the prams can be left at stock settings to start with anyway apart from items from $24 upwards.

Not knowing enough about your drive systems Nema 14,17,23,36, belt or direct drive and so on means I cannot tell you much.
Beware though of setting travel rates too fast as you will know from experience that it can cause all sorts of odd issues.

I see you have stops enabled and homing.
Here I had a few issues with noise on those signals.

This is by far the best source I have found for dealing with those problems.
BTW please read my initial links then you can post pictures etc.

Danger and myself also have a thread with some useful tidbits of info

Hi there

I am using the spindle pin 13 for my cnc laser but have a bit of a problem.

The laser turns on as soon as the axis start moving not at the work piece any idea how i can get it fixed?GRBL 1.1 with universal g code sender.

Regards
Johannes

Check the documentation for 1.1

If you need to do "pre-laser" moves you should move the first spindle commands further down your g-code.

Is it now responding to variable spindle speed commands for different laser levels ?

Hi Thank you very much for your help.

everything is working ok now i only got one small problem.

when using pin 13 ( I use the Spindle pin 13 on Arduino to trigger my laser) the only problem is when I

do the connect command in Universal G-Code Sender the laser is firing a couple time quickly before it is connected.

Can you please help me I think I seen somewhere that I have to put a resistor or something on pin 13 to

stop it from firing when I do the connect command.

Regards

Johanes

I dont have that issue so am unsure.
However it could be noise in the signals.

That is covered in the post Danger and myself have going.
A link I provided earlier.

It is also partly why I suggest a MOSFET or RELAY to engage that signal.

Bob.