Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: PW8697 on September 22, 2016, 06:03:39 PM

Title: Laser control on and off using Z
Post by: PW8697 on September 22, 2016, 06:03:39 PM
Been searching the internet for anything about controlling a relay (which controls a laser on/off) by using the Z axis.  There is a lot of talk about -Z turning the laser on and +Z turning the laser off.  That is exactly what I want to do.  But there is nothing mentioned for my hardware configuration, which I figured is quite common.

I use Solidworks and HSMxpress to produce my G-code.  I don't want to edit my G-code at all.  And I don't want to have to change to another suite of software. 

I am using a USB BOB http://www.automationtechnologiesinc.com/products-page/breakout-boards/3-axis-cnc-usb-card-mach3-200khz-breakout-board on my laser gantry. 

Anyway, I am not sure how to wire in a relay on the Z Axis outputs of this card.  Pulse+ and Direction+ are always 5V and so I am not exactly sure how to integrate the Pulse- and Direction- into the scheme of controlling a relay.  Even a circuit to latch the relay to itself may work.  Any ideas?

On a side note, will research setting up Mach3 as a plasma cutter, but even on this board there isn't much on that.  And I am not sure of its features and how it will operate the laser.   
Title: Re: Laser control on and off using Z
Post by: Tweakie.CNC on September 23, 2016, 04:27:38 AM
For your Z axis if you measure the voltage between +5v (Dir+) and Dir- it will change between 0v and 5v depending on which direction the axis was last moved.
Connecting a relay directly may not be a good idea (the Dir- can only sink 50mA current and it is already driving the Z axis controller) so use an opto coupler (or similar device) to drive your relay from the +5v and Dir- terminals.

Tweakie.
Title: Re: Laser control on and off using Z
Post by: PW8697 on September 23, 2016, 09:20:53 AM
Thanks Tweakie for the info, I've got a stash of 5V optically coupled solid state relays that may fit the bill. 
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 12:05:06 AM
For your Z axis if you measure the voltage between +5v (Dir+) and Dir- it will change between 0v and 5v depending on which direction the axis was last moved.
Connecting a relay directly may not be a good idea (the Dir- can only sink 50mA current and it is already driving the Z axis controller) so use an opto coupler (or similar device) to drive your relay from the +5v and Dir- terminals.

Tweakie.


Hi Tweakie.
I just asked this a moment ago, but on a very old thread. I think it's more appropriate to do it here, I hope you can help me.
Could you tell me why when I use this method, the laser stays on only a flash? The laser does not stay on for the entire path, only turns on for an instant.
Title: Re: Laser control on and off using Z
Post by: Tweakie.CNC on March 01, 2017, 01:40:54 AM
Quote
Could you tell me why when I use this method, the laser stays on only a flash? The laser does not stay on for the entire path, only turns on for an instant.

Hi Boxin,

I can't explain that. The Direction signals are persistent (they will remain at the set TTL level until changed). I have never used a relay because of the switching delay introduced but I have never had any trouble switching my laser on / off just using TTL level signals.

Could you perhaps explain in a bit more detail how you are controlling your laser ?

Tweakie.
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 02:04:56 AM
I'll try...

But I think that if the signal must be persistent, there must be the problem ...
My BOB is this (due to my laptop, I can not use the parallel port for a traditional one):

https://www.aliexpress.com/item/Factory-outlets-100KHz-CNC-mach3-USB-4-Axis-Stepper-Motor-Driver-Breakout-Board-USBCNC-Smooth-Stepper/32334451366.html?spm=2114.13010608.0.0.cJRtzN

Mi laser:

https://www.aliexpress.com/item/Focusable-450nm-2W-Laser-Engraver-445nm-2000mW-Blue-Laser-Diode-Module-with-TTL-for-CNC-Engrave/32745647304.html?spm=2114.13010608.0.0.bcOG86

The laser takes 12V from an ATX power supply.
To excite the TTL input of the laser, I am connecting a relay between + 5V and DIR- on my BOB (DIR- of Z & A axis, I have tried both).
This relay connects 5V from the same ATX power supply and sends them to the TTL input.

But beyond this connection, now I understand that the DIR signal must be persistent as you say (If I do not want to use some kind of monostable or flip-flop).
I have not measured the DIR-voltage changes, but I assume it will be almost imperceptible in my digital tester.
What I'm wondering is: is it possible that this USB BOB works differently than a traditional BOB via parallel port?
Would it affect Mach3 at all if the DIR signal is not persistent?
From what I could see when setting high values on the Z axis when the laser is turned on, it stays on during the travel of this axis. That's why there is only a flash when I want to activate it quickly.

What do you think?
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 02:15:24 AM
One more thing. The outputs work properly, I mean, their signals are persistent (M3) until I turn them off (M5), I have used them for the laser but there was an unwanted response time, so my interest in using one of the axes (as everyone, I think).
Title: Re: Laser control on and off using Z
Post by: Tweakie.CNC on March 01, 2017, 02:15:54 AM
Hi Boxin,

Firstly, connect a multimeter to the 5 Volt supply from your ATX and confirm that the voltage remains constant

If that is OK then measure the direction signal TTL voltage from your BoB - it could be that it does not have persistent TTL levels for the direction signal output (as you suspect).

Tweakie.
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 02:20:19 AM
I'm at work right now, but I will.
However, as I said above, using the same ATX power supply and the outputs activated with M3 and M5, I had no problems. So I do not think the problem are the 5V.
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 02:24:23 AM
Wait, please completely rule out a power supply fault.
Now I remember that at the recommendation of the seller of the laser, the only thing I'm doing with the relay is to join TTL- with TTL +, there is no need to send any level of voltage if it is working at all-nothing.
Title: Re: Laser control on and off using Z
Post by: Tweakie.CNC on March 01, 2017, 02:28:30 AM
Hi Boxin,

Measure (monitor) the direction signal TTL voltage from your BoB - it could be that it does not have persistent TTL levels for the direction signal output.

Tweakie.
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 02:33:51 AM
Thanks for your help Tweakie.
I'll do it as soon as I get home.
I think we know what's going to happen. Unlike a parallel BOB, the DIR signal will not be persistent and apparently this does not affect Mach3.
What I am going to do?  :(
Title: Re: Laser control on and off using Z
Post by: Tweakie.CNC on March 01, 2017, 04:21:17 AM
Just take it one step at a time, we will think of something  ;)

Tweakie.
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 08:50:48 AM
In fact, the outputs of the axes do not maintain the level  >:(
Title: Re: Laser control on and off using Z
Post by: boxin on March 01, 2017, 01:07:52 PM
Well, I finally used a flip-flop (555) triggered by DIR of the A and Z axes (One to turn on the laser and the other to turn it off). :-\
I do not know if there is an easier way (tell me), but for now these axes are available and I will use them that way.
Title: Re: Laser control on and off using Z
Post by: Tweakie.CNC on March 02, 2017, 01:30:46 AM
I agree, a flip-flop may be the best solution.

Tweakie.
Title: Re: Laser control on and off using Z
Post by: boxin on March 02, 2017, 03:51:33 AM
I asked everyone and you were the only one who confirmed that the output should be persistent.
I could not think of a solution without knowing that before.
Thank you very much Tweakie!