PDA

View Full Version : Limit Switches with LED's



manofgresley
27-12-2012, 06:29 PM
Hi

Does anyone have a circuit diagram to wire Limit switches in parallel with LED indication of actuation?

Regards
Ray

Robin Hewitt
27-12-2012, 09:03 PM
As Asimov said, "Insufficient data for meaningfull answer" :whistle:

What are you plugging these here limit switches in to?

What kind of Volts and current do we have to work with and what counts as switch closed or open?

Do you want an LED at each switch or one for each axis on a box?

manofgresley
28-12-2012, 12:07 PM
Hi

Thanks for the reply, my apologies for the lack of substance, but in my defence, i am new to this world of CNC.

I intend, hopefully to install "Maximum Travel" limit switches to the X,Y & Z axis of my Hobbymat Milling machine, which i am currently converting to CNC control.

The Stepper Drivers are PM 542's and a ZP5A-INT Breakout Board, it looks like there are I/O's for 3 limit switches and a "E" stop on the Breakout board.

It would be nice to have a separate box containing the LED's and there corresponding resistors, which obviously would give an immediate visual indication as to which switch is made.

I understand so far that the Switch cables should be shielded, and the switches should be NC, i am not sure of the exact volts and current from the Breakout board, as the paperwork is not very user friendly.

If possible, it would be nice to have Green LED's that turn Red when the Limits are made.

Would i need Hard wired Limit Switches for "HOME " positioning, or leave this for Software SETTING?

Regards.

Ray

Robin Hewitt
28-12-2012, 11:35 PM
a ZP5A-INT Breakout Board, it looks like there are I/O's for 3 limit switches and a "E" stop on the Breakout board.


I'll have a guess then :beer:

wilfy
29-12-2012, 12:01 AM
correct me if i'm wrong as i am also new to this cnc lark still but i thought limit switches were protection to stop the machine from travelling to far.. so if they are tripped the machine would just stop at this point hence making it pretty obvious which one has tripped?

Jonathan
29-12-2012, 12:21 AM
Eye candy.

D.C.
29-12-2012, 12:28 AM
correct me if i'm wrong as i am also new to this cnc lark still but i thought limit switches were protection to stop the machine from travelling to far.. so if they are tripped the machine would just stop at this point hence making it pretty obvious which one has tripped?

Things like e-stops and limit switches are a little bit more involved then 'just stop'. Think about doing 50mph in a car and for some reason you want to stop quickly, do you cut all the power to the engine and roll to a stop or do you hit the brakes hard?

Computers are very, very stupid so not only do you have to hit the brakes hard you need to make sure that nothing else is telling the motors to do anything else and the switches/e-stop can't be overridden by any other tech trying to ensure that the machine keeps position.

JAZZCNC
29-12-2012, 01:10 AM
Problem here is that really you want limit switches wired Normally closed and active low so if a wire breaks the signal drops, machine stops because it's no longer safe.
Also to save inputs you'd have them wired in series. Which surely means each LED will need it's own supply to be of any use has an individual switch indicator.?

In Mach3 Limit Home switch's can be used has home switch's if needed.
Without limit switch's set has Home switches or individual home switches then the software can't be used to home has it doesn't now where to home too.? Instead the software just zeros out the machine coordinates where ever the gantry or moving table is rested.

Home switches are very very useful and I'd drop limits before home switch's any day.

Robin Hewitt
29-12-2012, 02:18 AM
Problem here is that really you want limit switches wired Normally closed and active low


Okay, attempt #2...

manofgresley
29-12-2012, 12:25 PM
Hi Wilfy

I agree, it should be obvious where the machine has stopped. I am a retired Mechanical Engineer. This is the first cabinet i have ever wired up on my own, so my learning curve has been near vertical, i just thought it would be a nice thing to do, as i have plenty of time on my hands, any help would be appreciated.

Regards

Ray

manofgresley
29-12-2012, 12:33 PM
Hi Robin

Thanks, i'll give it a go, can you recommend a particular NPN transistor, and what is the Resistor rating for the one in front of your 5v mark.

Regards

Ray

manofgresley
29-12-2012, 12:39 PM
Hi Jazz

You know i think that i am a newbie to this world of CNC / Electronics. As previously mentioned i have a ZP54 - int Breakout Board, would you have a drawing for the HOME position switches or do they have to be configured in Mach 3 as software limits with the Stepper motor positions. I understand how this would work with Servo's but not Steppers.

Regards

Ray

JAZZCNC
29-12-2012, 02:15 PM
Ray think you may be mixing up soft limits with homing and physical limit switches. Soft limits have nothing to do with Actual physical limit switches they are just a software version of a limit switch and use the machine coordinate system has reference.
In fact with soft limits defined which you usually setup to be just less than the machines physical hard stop range then it's very easy to crash the machine into the hard stops because when you RefAllHome without Physical Home switches Mach just Zeros out Machine coords where ever it's parked.
So if you happen to RefAllHome with the table or Gantry say towards the middle of movement range then Mach use's this Zero coord has the start point for soft limits and if for instance you set-up soft limits with a movement range of 500 positive before soft limits kick-in but you only have 400 physical movement left then Mach won't know and crash into stops.!!

Soft limits have absolutely nothing to do with home switches at all other than they share the same setup menu in Mach.

Personally I use separate Limit switches wired in series using one input on the Bob. Then have separate Home switch's wired in series using another input of the BOB.
You only need 1 home switch per Axis.

To set-up Home switches in Mach first set the input your using in Ports&pins/input-signals. You really have 3 options now.
If sharing LIMIT switches has home switches then set each Axis Home signal to the same input your using for limits from the BOB.
Same has above for separate Home switches if your using them wired in series just using the different input from BOB.
If using individual home switches then you'll need to set each Axis signal with the individual Input used on BOB.

Next in the Home/soft-limits menu set which way you want the machine to set off looking for the home position using the HomeNeg selection.
In this same Menu you can define other things like auto zeroing the DRO's after hitting switch and percentage of Rapid speed to home at.

Thats all there is too it.

manofgresley
29-12-2012, 04:14 PM
Hi Jazz

Many thanks, you are both right and wrong. I may be a bit confused, but in the days when i had to work for a living, i can remember,that on our robots, we had physical limit switches (Usually Proximity Switches) to prevent the machine from crashing when being used in MANUAL MODE. The HOME position was a position set in a separate program just for re homing the machine to it's start position, this is what i would like to do on my machine, not because it needs it, though i do appreciate it needs some degree of safety, it's just that i would like to do it, after all when i have finished the machine i have no production targets just there as a Hobby.

Regards

Ray

Robin Hewitt
29-12-2012, 06:56 PM
can you recommend a particular NPN transistor, and what is the Resistor rating for the one in front of your 5v mark.

I am a dinosaur when it comes to transistors, how about a BC547.

Assuming 20mA to drive the LED and a 1.2 Volt drop across it, about 190 Ohms for the resistor.

I drew it up to minimise the component count, when the transistor switches on the Volts it has to play with fall away, may need a third resistor so don't lay any PCB's until you have tried it.

HankMcSpank
29-12-2012, 09:03 PM
Assuming 20mA to drive the LED and a 1.2 Volt drop across it, about 190 Ohms for the resistor.

Personally I'd have gone with a resistor for each LED (to get their respective brightnesses balanced right)...therefore I'd connect the common anode direct to 5V & then place a current limiting resistor in each of the the LED cathode legs (the fwd voltage of a red led is about 2V, whereas a green led is about 3.2V ...therefore to get the right level balanced you'll likely need different value resistors).

Also 20mA - depending on LED - is gonna be very bright, I'd have aimed for 10mA or less.

Edit: Actually the way Robin has drawn it, for the red led you'll get a drop across the tranny itself, which pretty much balances the fwd voltage difference out for the red & green LEDs, so you may get away with a 180R single resistor for both....a 180R resistor will yield about 10mA through the LEDs

Robin Hewitt
29-12-2012, 09:31 PM
Personally I'd have gone with a resistor for each LED (to get their respective brightnesses balanced right)...

That would get around the Volts falling away when the transistor comes on problem nicely and let you tinker with individual brighteness. Good idea.

manofgresley
30-12-2012, 01:05 PM
Hi Robin
My apologies if my protocol is incorrect.
I have attached a PowerPoint Drawing, which is my interpretation of your drawing, which contains everything i know so far. Would you be kind enough to go over it, and advise me if it would work or not?

Regards

Ray7794

Robin Hewitt
30-12-2012, 04:46 PM
So you don't have a seperate ground.

That means every LED up stream of the one that goes red will go out.

If you accept that limitation, dump the transistor and the 10k resistor, not required.

Connect one LED cathode to NO, one cathode to NC and the common anode to your 190 ohm off 5V.

Shinobiwan
30-12-2012, 06:31 PM
Okay, attempt #2...

Sick sick drawing skills there Robin!

Jonathan
31-12-2012, 02:02 AM
If you're happy with just one colour LED - i.e. red when the switch is pressed, off otherwise, which basically tells you the same thing as having red/green, then it's a lot simpler. Just put an LED with series resistor in parallel with each switch.
Since you will use normally closed switches, when the switch is open (pressed) the supply voltage to the switches is now present across the switch, so will light the LED. If multiple switches are pressed, the same is true except the voltage is now divided by the number of switches that are pressed so the LEDs would be dim, hence you need to choose the resistor values carefully. If you're happy with that limitation then this is a simple solution to implement, but for the sake of one extra component Robin's solution is better.

You could instead do it in software - make a box on the gui turn red/green for each switch.

Robin Hewitt
31-12-2012, 02:52 AM
If you're happy with that limitation then this is a simple solution to implement

Good try, but what happens if two switches open?

Will 2 diodes and two resistors all in series sink enough curent to switch the Bob?

How about three?

Edit: I'm not explaining that very well am I? You aren't actually breaking the circuit, you are still requiring current to flow and light the LED's.

Jonathan
31-12-2012, 12:29 PM
Edit: I'm not explaining that very well am I?

No, perfectly well.

I put this diagram in the previous post, but immediately deleted it as I realised the problem you mentioned:
7800
If V=5V, then when one switch is pressed the voltage at the node the breakout board is connected to will be the forward voltage of the LED, so about 2.1V, plus the voltage of the resistor. As you say that's probably acceptable with just one switch pressed, but still more susceptible to interference and probably not going to work with more.
We can fix this by increasing V, to say 24V, and connecting the breakout board via an op-amp used as a comparator. Set the threshold of the comparator to be just under the voltage present when one switch is pressed, then any number of switches are pressed the comparator output will switch. I guess that does loose the simplicity...I'd do it your way, except I don't really see the point of adding LEDs!

manofgresley
31-12-2012, 02:08 PM
Hi Jonathan
Thanks for all your help, seems like i was asking for quiet a lot when i said simple. Forgive me but you lost me at OP AMP / Comparator, and can you explain what a gui is from a previous post?
7801This is my latest interpration, do you think it will work, i realise that the only LED to illuminate will be the one on the activated switch.

Regards and Thank You

Ray

Robin Hewitt
01-01-2013, 01:51 AM
OP AMP / Comparator gui

An Operational Amplifier is wonderful thing. It has 2 inputs labled + and -. If the Voltage on plus is higher than the Voltage on minus the output pin goes high, vice versa and it goes low. With a bit of resistor jiggery pokery you can multiply or divide a voltage by anything you like.

If they make an Op amp and it turns out to be too clunky they mod the circuit to lose the drive high on the output and call it a comparator. You connect your input to one pin, a reference Voltage to the other and the output tells you which is the higher.

GUI usually stands for Graphical User Interface.

I can't comment on your circuit because I still don't know what is coming out of the Bob.

m_c
01-01-2013, 04:32 PM
The plan above won't work as having just checked the datasheet for the BOB, the limit switch input is gets pulled to ground, so it won't provde enough power to light up anything, and adding LEDs in that way will probably be enough to pull it to ground.

Using some kind of high impedence sensing is the only way to make this work without affecting the BOB input.
For design/build simplicity and to avoid dealing with individual chips, I'd suggest an Arduino UNO. A quick sketch (arduino talk for code/programme) will do what you want easily, the inputs are high impedence by default, and it'll power LEDs easily.

JAZZCNC
01-01-2013, 04:43 PM
Can't he just use a separate 5V supply and use the NO contact to make the circuit when the switch trips.? Simplizz enough to me.!!

Edit: Like this.? 7817

Ray the same 5V supply that powers the Bob would work just take another feed from it.

Robin Hewitt
01-01-2013, 05:19 PM
Or, use a double throw microswitch and have red green on every switch, fully independant and all on one 3 wire loop, easy peasy.

manofgresley
02-01-2013, 12:28 PM
Hi Robin

Many thanks, still confused, would that be a SPDT? I thought I was trying to illustrate that in my drawing, or did I get that wrong?

Regards

Ray

manofgresley
02-01-2013, 12:29 PM
Hi Jazz

Many thanks again, will this stop the machine from moving if activated.?

Regards

Ray

JAZZCNC
02-01-2013, 03:08 PM
Hi Jazz

Many thanks again, will this stop the machine from moving if activated.?

Regards

Ray

Yes Ray machine will stop and the relevant tripped switch LED turn on.

Easy to test off machine just run 5V+ wire from PSU to LED/resistor then thru NO contact of switch that Neg (-) is connected to BOB (-). the BOB will return to Ground of the PSU.
If it works Mach will go into reset and the LED light up while switch held in.