Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: arhctysv1 on May 24, 2013, 08:06:46 AM

Title: M3 Relay output from output 1
Post by: arhctysv1 on May 24, 2013, 08:06:46 AM
Trying to get a relay to turn on for M3 out of output 1
I have turned on in config and spindle.
Metering between pin 1 and pin 18 gnd I get 4.5 volts to gnd
when I input M3 and it goes to 0 volts when I input M5.
 When I hook up a small 5 volt relay it reads 3.2 volts and toggles to
0 volts. The relay does not pull in. Tried a 3 volt relay same thing.
Then tried a 3 volt solid state relay and the relay did not pull in.
Then tried an optoisolater board from Sparkfun. The voltage toggles
between 2.2 volts and 0  with 5 volts hooked to the output side
all I get is .005 volts to .001 volts when I toggle.
Also I have pin 18 tied to machine ground and the 5 volt ground.
It is like I'm not getting enough amps out and loading down the circuit.
What am I doing wrong?   
Title: Re: M3 Relay output from output 1
Post by: Chaoticone on May 24, 2013, 08:25:26 AM
On the spindle set up page you are not mapping to pins, you are mapping to outputs.  The output must be mapped to a pin on the config, ports and pins, outputs page.

Brett
Title: Re: M3 Relay output from output 1
Post by: arhctysv1 on May 24, 2013, 09:36:13 PM
I have my ports and pins set up.
Under ports and pins enabled pin 1 at port 1 enabled high
I get 4.5 volts out at output 1 (pin 1) with M03 and 0 volts with M05
with no load.
So the pin  1 works. I just can't get it to trip a 5 volt relay. I have tried
a 3 volt relay, a sold state relay ans an optoisolator and can't get to trip.
My outputs to the three drives works fine and the control runs programs.
My E-Stop input works fine. I tried different outputs, pins 2 and 3 and
can't get them to work.
Thanks if anyone can give me advice.

Title: Re: M3 Relay output from output 1
Post by: Tweakie.CNC on May 25, 2013, 04:47:12 AM
There is a limit to the current that can be sourced from an LPT port so it is perhaps best to construct a simple driver circuit (for example; http://pcbheaven.com/wikipages/Transistor_Circuits/).

(It is a rule of TTL logic that they can sink considerably more current than they can source so as an alternative you could connect your SSR between +5 Volts and the output pin - when the pin is taken low you should have enough current for it to switch - this is the way my SSR's, requiring less than 10mA, are switched).

Tweakie.
Title: Re: M3 Relay output from output 1
Post by: arhctysv1 on May 25, 2013, 08:00:17 AM
Thanks it will be the end of next week
before I can try this.
I tried to hook up this optoisolator board
https://www.sparkfun.com/datasheets/BreakoutBoards/Optoisolator-v12.pdf
I put pin 1 to input 1 and ground to to pin 18 from the LPT
then put 5 volts to HV and hooked the 5 volt relay to output 1
and hooking up all grounds together. All I got out was .05 volts with M3 and .01 volts with M5
What did I do wrong?
Title: Re: M3 Relay output from output 1
Post by: Tweakie.CNC on May 25, 2013, 08:15:15 AM
Well, in that circuit your outputs do not have enough current to drive the 5 Volt electro-magnetic relays because the HV supply is through 10k resistors. Assuming the transistors Q1 & Q2 can handle the relay current then connect your electro-magnetic relays in place of the 10k resistors R5 & R6 - remembering to connect a reverse biased diode (to suppress the back EMF) across each relay coil.
The relay parts of your circuit would then look similar to the diagram per my link.

Hope this helps.

Tweakie.
Title: Re: M3 Relay output from output 1
Post by: arhctysv1 on May 25, 2013, 09:48:29 AM
Thanks, I'll try that next week
Title: Re: M3 Relay output from output 1
Post by: rwf71 on May 25, 2013, 04:14:37 PM
I'm not sure if you got what Brett said in reply #1, I had a little trouble with this at first myself. First you assign to OUTPUT 1, then you go to the outputs tab and assign output 1 to PIN1. Hope this helps.
      Rick
Title: Re: M3 Relay output from output 1
Post by: arhctysv1 on May 28, 2013, 06:04:07 PM
Under config
Ports and pins
Spindle setup
Relay control
Clockwise (M3) output 1

Then under Ports and pins
Outputs
Output #1   enabled  port 1  pin1  Active Low

With no load on pin 1 I get 4.5 volts  when I type M3
and when I type M5 I get 0 volts
When I hook up a 5 volt relay it won't trip the relay
Title: Re: M3 Relay output from output 1
Post by: Chaoticone on May 28, 2013, 06:06:44 PM
Have you tried setting the port 1 pin 1 output to active high?

Brett
Title: Re: M3 Relay output from output 1
Post by: arhctysv1 on May 28, 2013, 09:23:37 PM
Yes, have tried it both ways.
Will try the advice that Tweakie sent about hooking
up the relay in series with the collector of the transistor.
http://pcbheaven.com/wikipages/Transistor_Circuits/
I may not have enough power to turn on the relay. 
Thanks
Title: Re: M3 Relay output from output 1
Post by: Chaoticone on May 28, 2013, 09:32:42 PM
No problem.  It would be hard going wrong following Tweakies advise.  I imagined you had already tried it both ways but thought it would be worth mentioning.  Let us know how you get on.

Brett