PDA

View Full Version : Wiring 24v NPN Proximity Switch to 5v BOB - Why does'nt it work



MikeyC38
12-10-2016, 10:50 PM
Hi Guys

I am using NPN Proximity switches from here (http://www.ebay.co.uk/itm/LJ12A3-4-Z-BX-Inductive-Proximity-Sensor-Switch-NPN-DC-6V-36V-NEW-/191736625652?hash=item2ca464b9f4:g:UFkAAOSwvt1WQ~S R&clk_rvr_id=1108618221092&afsrc=1&rmvSB=true) and a 5v BOB from Zapp Automation (http://www.zappautomation.co.uk/electrical-products/breakout-boards/zp5a-int.html) . I fitted a 2.4k ohm resistor between the black signal wire and the blue (-ve line) and connected up to a 24v dc power supply. When the switch is open, the voltage between the signal wire and the blue line is 4.5v ok I think for the input to the BOB. When the switch is closed, it drops to 0.7v - measured using a DMM and the LED on the back lights up. I connect the black wire to pin 10 of the BOB and the blue wire to the GND. When I activate the switch, the LED does'nt light and nothing is detected via the diagnostic screen of MACH3. And yes the port & pins is set for the Home to pin 10.
The 24v power supply buzzes and the indicator LED on it goes out. What have I done wrong?

Thanks
Mike194361943419435

Neale
12-10-2016, 11:45 PM
Connect one end of the resistor to +24V, not to PSU -ve. What you then have is the BOB input driven from the 24V with the resistor lowering the voltage to the BOB to a nominal 5V. When the proximity switch operates, it shorts out the BOB input to ground. Should be OK although it's not quite a conventional way to wire things, and it might not work reliably as it depends on the proximity switch bringing the BOB input voltage close enough to ground to trip the BOB input. You will have to figure out whether you then want active high or active low configured in Mach3 to do want you want - probably active low.

Unfortunately the ZP5A manual is very vague on the details of the input connections. I don't remember now if the limit switch inputs have a common ground or if they are separate. I used to use one of these BOBs myself but that machine didn't use any limit switches so I never had to sort this one out. Can you check with a meter if the limit switch input ground connections are all connected together? It's possible that they are not, and in that case there is a better way to wire the switches. Take +24 via the resistor to the BOB input. Then connect the BOB input ground to the black wire on the prox switch. Brown and blue wires stay as they are on your diagram. This would probably need active high in Mach3 and from an electrical point of view is the "right" way to do it. However, it does depend on the limit switch grounds being electrically isolated from each other.

Clive S
13-10-2016, 12:02 AM
Some of these switches have a 10K inside and limit the current to a few mA I have used these on 5V inputs without any other R's without problems

MikeyC38
13-10-2016, 12:25 AM
Connect one end of the resistor to +24V, not to PSU -ve. What you then have is the BOB input driven from the 24V with the resistor lowering the voltage to the BOB to a nominal 5V. When the proximity switch operates, it shorts out the BOB input to ground. Should be OK although it's not quite a conventional way to wire things, and it might not work reliably as it depends on the proximity switch bringing the BOB input voltage close enough to ground to trip the BOB input. You will have to figure out whether you then want active high or active low configured in Mach3 to do want you want - probably active low.

Unfortunately the ZP5A manual is very vague on the details of the input connections. I don't remember now if the limit switch inputs have a common ground or if they are separate. I used to use one of these BOBs myself but that machine didn't use any limit switches so I never had to sort this one out. Can you check with a meter if the limit switch input ground connections are all connected together? It's possible that they are not, and in that case there is a better way to wire the switches. Take +24 via the resistor to the BOB input. Then connect the BOB input ground to the black wire on the prox switch. Brown and blue wires stay as they are on your diagram. This would probably need active high in Mach3 and from an electrical point of view is the "right" way to do it. However, it does depend on the limit switch grounds being electrically isolated from each other.

Hi Neale
Thanks for your response. It seems to tie up with what is on the switch label anyway. The ZPA5-INT has a seperate ground for each pin input. I'll give it a go.

Regards
Mike

Boyan Silyavski
13-10-2016, 01:35 AM
Some of these switches have a 10K inside and limit the current to a few mA I have used these on 5V inputs without any other R's without problems

Absolutely right. Here below is how to check if that is the case / credit goes to C23 BOB manual/

19439

Neale
13-10-2016, 09:00 AM
These proximity switches come in so many flavours. The switch the OP is using switches to ground and an internal resistor makes no sense; the switch in the previous post switches to the supply rail and maybe an internal resistor is more useful.

If you use the NC version of the OP's switches, wired as suggested in series with the BOB input, you can connect a number of them to a single input. I have tested four in series, using 24V and a CSMIO, and that seems to work fine. Using the OP's NO switches, you would have to wire them in parallel but you lose the "fail safe" feature of NC switches.

m_c
13-10-2016, 11:01 AM
People seem to be over complicating this.
.
Given the BOB in question requires switched to 0V to activate the input, all you need to do is wire 24V to BN, 0V to BU, then connect the BK to the BOB input. You may need to also connect the BOB 0V to the sensor, however I'd assume this BOB doesn't have fully isolated inputs, and the 24V and 5V supplies already have their 0V connected at some point.
.
An NPN sensor simply switches the output wire to 0V, and should go essentially open circuit when unactivated. You should not need any kind of pull up resistor on the sensor output.
However as has been mentioned already, the sensor may not switch perfectly to 0V, and may struggle to reliably switch the BOB input. In that case, adding a small relay into the circuit would be needed.
Alternatively, there's these simple sensors called switches... ;-)

MikeyC38
13-10-2016, 02:20 PM
Absolutely right. Here below is how to check if that is the case / credit goes to C23 BOB manual/

19439

Useful post Boyan. Applied the formula to the NPN I had with the external 2.4K ohm resistor I used and got answer of 10.4K ohm for the switch internal resistance. This seems consistent Clive S post. The switch does have 300ma printed on it. But I think this is too much current for the BOB input. So back to the Neale's suggestion. Will let you guys know how it works out.

Clive S
13-10-2016, 02:31 PM
The switch does have 300ma printed on it. But I think this is too much current for the BOB input. What that means is that the switch can source 300mA try putting a mA meter in circuit and see what you get.

Robin Hewitt
13-10-2016, 03:41 PM
NPN and PNP are transistor types. Transistors are like switches, strangely picky switches.

An NPN switches power to ground. A PNP switches power off the power rail.

So if you have an NPN output sensor it is going to switch something to ground.

If you wanted a Voltage, connect a resistor between and NPN output and the Voltage rail.

More likely you want a current. To avoid interference CNC folk tend to use opto-isolation, the output turns on an LED which shines on a detector, which probably has an NPN output, but someone else can worry about that one.

The only sensible way to drive an LED is with a resistor off the Voltage rail, through your LED, through the NPN output to ground.

If it is a silicon transistor you will have a 0.7V drop across it, probably another 1.2V drop across the LED, use whatever is left to calculate the resistor value.

m_c
14-10-2016, 01:53 AM
What that means is that the switch can supply 300mA try putting a mA meter in circuit and see what you get.
Not quite, it means the sensors can switch 300mA. It's not supplying anything.
.
Most of these sensors have overload protection built in, so if you were to try and switch a load that exceeds 300mA, it would appear to do nothing. However, a BOB opto will not need anywhere near that much current.

cropwell
14-10-2016, 03:12 AM
What that means is that the switch can supply 300mA try putting a mA meter in circuit and see what you get.

The 300mA is the current the switch can sink. Inside the sensor is a 10K resistor between the supply and output. AT 24v supply it means that it will source 2.4mA at that voltage. For all practical purposes you can regard the output of these sensors as though it is the NO contact of a relay, with the common of the relay being connected to GND.


If you see this page IGNORE IT ! it is wrong, misleading,confusing and confused. http://www.marchantdice.com/worldofcnc/pdf/homeswitch_wiring.pdf

It sounds as though you have a faulty sensor if the power supply buzzes, possibly due to miswiring in the past.




This has all been discussed before.

Robin Hewitt
14-10-2016, 09:48 AM
Inside the sensor is a 10K resistor between the supply and output. AT 24v supply it means that it will source 2.4mA at that voltage.

Sort of, if you short out a 24 Volt PSU with a 10k resistor it will flow 2.4mA

If you stick anything between the resistor and ground you are unlikely to get 2.4mA

Ohms' Law gives you the Voltage drop across the resistance.

cropwell
14-10-2016, 01:30 PM
Ohms' Law gives you the Voltage drop across the resistance. Potentially, I am divided on this. There's no place like Ohm.

Clive S
14-10-2016, 11:28 PM
Potentially, I am divided on this. There's no place like Ohm.
Excellent:beer:

Neale
15-10-2016, 12:13 AM
People seem to be over complicating this.
.
Given the BOB in question requires switched to 0V to activate the input, all you need to do is wire 24V to BN, 0V to BU, then connect the BK to the BOB input. You may need to also connect the BOB 0V to the sensor, however I'd assume this BOB doesn't have fully isolated inputs, and the 24V and 5V supplies already have their 0V connected at some point.
.
An NPN sensor simply switches the output wire to 0V, and should go essentially open circuit when unactivated. You should not need any kind of pull up resistor on the sensor output.
However as has been mentioned already, the sensor may not switch perfectly to 0V, and may struggle to reliably switch the BOB input. In that case, adding a small relay into the circuit would be needed.
Alternatively, there's these simple sensors called switches... ;-)

Reason why I over-complicated things was that I had assumed that this BOB had opto-isolated inputs (I've been working with a CSMIO card recently which does things that way and I made a false assumption). I have been trying to test my own ZPA5 with Mach3 but after a couple of hours, remembered that the parallel port version of Mach3 doesn't work on 64-bit Windows. However, I did take a look at the card itself and it looks like the inputs go into a set of buffers, no opto-isolation, but with a pull-up resistor. So as m_c accurately says, just take the black wire to the BOB input. Make sure that the 0V of the 24V power supply (blue wire to prox switch) goes to the ground connection on the BOB. In fact, just as in your first diagram but the resistor is redundant. What is probably worth doing is checking that with the prox switch disconnected, just shorting the BOB input pin to ground does register with Mach3 (stick a small screwdriver blade in the two-pin socket next to the screw terminals). If that works and you see the Mach3 diagnostic "LED" go on and off, then you can connect the proper switch and see if that works.

For those who mentioned the possible 10K resistor in the switch - the BOB appears to have a current-limiting resistor in series with the input to the buffer inverter which also includes clamp diodes to restrict input voltage at the input pin. So the 10K resistor, if it does exist, is just going to act as another pull-up when the switch is open and can be ignored when the switch is closed. If it doesn't exist, it doesn't matter as the BOB has an onboard pull-up anyway.

See - some of us have been working this evening instead of drinking :beer:

cropwell
15-10-2016, 01:15 AM
For those who mentioned the possible 10K resistor in the switch - the BOB appears to have a current-limiting resistor in series with the input to the buffer inverter which also includes clamp diodes to restrict input voltage at the input pin. So the 10K resistor, if it does exist, is just going to act as another pull-up when the switch is open and can be ignored when the switch is closed. If it doesn't exist, it doesn't matter as the BOB has an onboard pull-up anyway.

Don't know the zener voltage (zen, zener, zenest), but here's the essentials of the internal circuit.

Now I am going to get ANOTHER Brandy !!!!
http://i.stack.imgur.com/kFCfj.png

Neale
15-10-2016, 09:50 AM
Thanks for that, Rob - first time I've seen a representation of the switch internal circuit. I find those little extracts of both input and output circuits very useful in getting an understanding of how things go together, and especially when it comes to working out why something doesn't work! Too much detail for some, perhaps...

Now I'll have to draw out the combined circuit of four of those (NC versions) strung in series, so that I can use a single input for combined limit switches, just to reassure myself that it should work - even though I've wired it up on the bench and it does seem to.

Maybe some of us take a more theoretical approach where others just want to know where to stick the black wire :smile:

Just in case the OP is still with us and hasn't given up the will to live - this just confirms that your original wiring should be fine if you take out the resistor.

Clive S
15-10-2016, 10:14 AM
Now I'll have to draw out the combined circuit of four of those (NC versions) strung in series, so that I can use a single input for combined limit switches, just to reassure myself that it should work - even though I've wired it up on the bench and it does seem to. Not sure but I recon they will be ok for limits but if used as home combined.
I think there will be an increasing delay put in to the circuit the more you connect.

Neale
15-10-2016, 12:02 PM
Couple of points there. Personally (and without looking up switch data sheets to see if they quote switching times) I suspect that compared with typical machine speeds, any delay will be insignificant (*). That's based on gut feel rather than hard data, though. Second point is that I would be more concerned about repeatability than actual switching time. I don't really care if the response time is, say, 100uS as long as it is always 100uS, so that the machine always stops in the same place. Doing a bit of my usual back-of-the-envelope sums, I reckon that at full tilt my ballscrews will be turning at 1000rpm. Say, 17rps. 800u steps per rev, so 13600 steps/sec. That's about 75uS per step. In practice, final homing is done at, say, 10% of that, so as long as the switch responds repeatedly to the nearest 3-400uS, you should be able to stop at the same ustep. Dean's demo of homing repeatability using proximity switches a while back supports this.

(*) what probably matters more is that you always home at the same speed as I suspect that exact switching points will depend on speed of approach to target but that is something that's under our control. It only matters for homing anyway; don't really care exactly where the machine stops if it hits a limit as long as it stops before something gets broken!

cropwell
15-10-2016, 12:17 PM
I think there will be an increasing delay put in to the circuit the more you connect.

Apart from the inductive sensing circuit, I see no capacitative or inductive components that will introduce any time elements into the switching circuit. Sorry for the delay in replying :barbershop_quartet_

Clive S
15-10-2016, 12:42 PM
Apart from the inductive sensing circuit, I see no capacitative or inductive components that will introduce any time elements into the switching circuit. Sorry for the delay in replying :barbershop_quartet_

I was looking through this- http://www.ab.com/en/epub/catalogs/12772/6543185/12041221/12041723/Wiring.html

It states "response time is equal to the response time of the first sensor plus the sum of the turn on times of the others. ":nightmare:

But all this has been killed to death many times. :sorrow: Can't beat having each sensor on its own pin.

cropwell
15-10-2016, 02:24 PM
I was looking through this- http://www.ab.com/en/epub/catalogs/12772/6543185/12041221/12041723/Wiring.html

It states "response time is equal to the response time of the first sensor plus the sum of the turn on times of the others. ":nightmare:

But all this has been killed to death many times. :sorrow: Can't beat having each sensor on its own pin.

This only seems to apply for two wire sensors in series. Three wire sensors in parallel won't be affected. Phew: our 'homes' are secure, we can all sleep safely in our machine beds this afternoon.

:thumsup:

Rob

Boyan Silyavski
15-10-2016, 02:53 PM
Ok. Now that io have you here :-) , i have another quick question . If BOB has transformer that powers limit switches and at the same time spindle speed output, and you connect a couple of limit switches in series and find that spindle speed output does not work right. Then could you add additional transformer positive and negative to the BOB outputs, same 12V vdc, but from another supply , so you kind of "help " it?????????

cropwell
15-10-2016, 03:48 PM
Ok. Now that io have you here :-) , i have another quick question . If BOB has transformer that powers limit switches and at the same time spindle speed output, and you connect a couple of limit switches in series and find that spindle speed output does not work right. Then could you add additional transformer positive and negative to the BOB outputs, same 12V vdc, but from another supply , so you kind of "help " it?????????


In theory you could, but it is not good practice and I wouldn't recommend going anywhere near that solution.

How about a diagram of what you are doing with some component info ?

There is probably another issue here. I would guess that your 12v power supply might be under-rated for the job, but having said that I don't know what load you are pulling. You could try adding a reservoir capacitor across the power line and also some decoupling capacitors near the prox switches, just in case you have switching transients going back on the power line.

If you are talking about another 12v supply, why not use it for the sensors only and leave your working spindle speed controller alone ?

Cheers,

Rob

Neale
15-10-2016, 04:48 PM
You say that you put two limit switches in series and it "does not work right". Does it work with just one limit switch connected? Does it work with no limit switches connected? I've been looking at a couple of examples recently where the BOB or motion controller has an analogue output for spindle speed, and it looks as if these often have a separate ground connection that should not be connected to the same ground that the limit switch inputs use on the BOB. I agree with Rob, though - it would be a lot easier to understand if you could provide a diagram and some details of the devices you are using. It's too easy to guess and make the wrong assumptions otherwise. If you are talking about spindle speed control here (not power to the spindle motor) it would be surprising if the problem was a lack of power because the limit switches and speed control inputs take quite low amounts of power. Interference is possible but shortage of power - probably not the problem.

Boyan Silyavski
15-10-2016, 08:15 PM
Guys, i will not post more here, as it seems its for another thread. But i think you are right. There is something wrong maybe i have wired things especially the grounding and shielding. As a ground wire from here to there changes the spindle speed. I am not mixing VDC and AC and Earth. When i say ground i mean the shield that goes to common earth , where all PSU earth wires are connected together. I think the VFD and the servo drives mess things up. It could be as the VFD to spindle shield is wired both sides, one side to line ground, other side to spindle and machine body.

MikeyC38
16-10-2016, 12:02 AM
Thanks for that, Rob - first time I've seen a representation of the switch internal circuit. I find those little extracts of both input and output circuits very useful in getting an understanding of how things go together, and especially when it comes to working out why something doesn't work! Too much detail for some, perhaps...

Now I'll have to draw out the combined circuit of four of those (NC versions) strung in series, so that I can use a single input for combined limit switches, just to reassure myself that it should work - even though I've wired it up on the bench and it does seem to.

Maybe some of us take a more theoretical approach where others just want to know where to stick the black wire :smile:

Just in case the OP is still with us and hasn't given up the will to live - this just confirms that your original wiring should be fine if you take out the resistor.

Hi Neale - I'm still here! Just about. But I must be having a brain fade because when I connect the black wire to pin 10, the blue wire to the pin 10 GND, then run a wire back to the -ve 24v supply it buzzes and does'nt work. I checked the GNDS on the ZP5A-INT board (it has a 5v supply from my Leadshine PS408/5 ), all the gnds are connected by doing a continuity check with the BOB unpowered from the -5v pin. I guess I just need to sleep on this and start again tomorrow. I must be missing something in what you guys have said and suffering from a case of "Goldfish brain" :dejection::dejection:

m_c
16-10-2016, 01:24 AM
I hope you mean +ve and not -ve.
.
Best to go back to basics, wire up just the power and gnd to the sensor, and use a multimeter to check that the output is switching. Provided that works, connect it to the BOB.