Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Converting NPN sensor output to PNP type output

Status
Not open for further replies.

arunb

Member
Hi,

I am using this Omron sensor (EE-SX674A) to connect to a PLC (Kinco PLC- wiring diagram), see page 4 for internal connection of sensor.

The PLC however is wired to receive only PNP type input as some of the Input ports are wired as PNP.

Can this sensor output be converted to PNP type by connecting a pullup resistor (tied to +24 VDC) ? If I use a 2.2K resistor will this work ??

The voltage of the PLC is +24 VDC. The sensor also operates on +24 VDC.

I could use a PNP type sensor instead, however I have lot of stock with me, I don't want to buy a new part. And since there is extensive re-wiring involved for converting the input port to PNP, I think it would be easier to just connect some pull-ups instead.

thanks
a
 
Funnily enough, I've recently been involved in making equipment to connect to PLC's (and I've never even seen one!), but I was talking to a guy who contacted us and he explained that pretty well all modern PLC's use SINK (NPN) inputs - and that was what I was making (except it was FET not bipolar). We sent him a sample, and he got back in touch, and all is working fine now :D

As you've surmised, if you need a SOURCE (PNP) input, you just need a pull-up resistor to 24V - but you need to bear in mind that the polarity is then reversed, which you can easily change in the PLC programming. If you can't do that, then you could add two resistors and a PNP transistor to convert the output to SOURCE.

This diagram from my tutorials shows how, the sixth diagram on the page:



In that diagram, the NPN transistor would be the one inside your sensor, just the PNP and the two resistors are required, and 24V from the PLC rather than the 12V in the diagram of course.
 
Here are the input specs from the PLC manual :
IO-PLC.PNG

Does the PLC provide its own input current limiting, or are external resistors required for current limiting?
 
I'm not familiar with PLCs and their specs. Do the above specs mean you could safely connect the input directly to 24V and directly to 0V? What is the 'common channel'?
 
I'm not familiar with PLCs and their specs. Do the above specs mean you could safely connect the input directly to 24V and directly to 0V? What is the 'common channel'?

I'm not familiar with them either, but they are designed to be used by non-electronics engineers, so need to be pretty bomb proof.

As far as I'm aware it's common practice to use relay contacts to directly connect the 24V supply to the inputs for SOURCE inputs - basically similar to any logic type of system.
 
The simplest solution if it's a relatively low speed input is to use an external 24V relay.
Switch the coil with the sensor, then use a relay contact to provide the PLC input.

Alternatively, you can use a resistor to hold the input "on" and use the sensor to in effect short the input to force it off.

That's fine for high speed signals as well, but you need a fairly low value resistor with a decent power rating, to give an adequate input voltage with some margin above the actual switching threshold, and stand the power dissipation when it's got the full 24V supply across it.

You probably need 1K or 470 Ohms - or less, for reliable operation. Use a 2W resistor, at least, if it's 470R & higher power for lower values.


Edit, re. some bits on other posts:

PLC inputs are designed for direct connection to their rated voltage, by either switches, relay contacts or electronic sensors etc.

The industry standard is that everything uses switched positive, so PNP output sensors.
It's a basic safety principle, as then any wiring damage most likely shorts power and blows fuses. Using NPN outputs and switch contacts between ground and an input or coil means shorts to ground can turn things on instead, which is obviously rather dangerous with industrial machinery.

Likewise with 110V control, it's always the live side that is switched by control equipment or pilot relays etc.
 
Last edited:
My understanding of the specs is that if you were to use a sensor of the type having an open-collector output (as per the linked one) plus a pull-up resistor to 24V, then the PLC input could be sinking as much as 3.5mA. To establish the logic high condition the input must be above 11V, so that implies the absolute maximum pull-up resistance is (24-11)V/3.5mA = 3k7. A 1k pull-up should therefore be fine, although it would have to dissipate over 1/2W at logic low. A 2k, with only 1/4W dissipation, should also work.
However, given the safety issues raised, it would probably be better to go with a different sensor and a pull-down resistor, unless you wanted to add a transistor stage to invert the existing sensor output.
 
Last edited:
To establish the logic high condition the input must be above 11V

In practice you need a good margin to give a fast response and noise immunity.
I'd split the difference between the minimum logic 1 level and nominal 24V input, so around 18V, and still consider that a minimum target voltage for the pullup resistor to achieve.

From experience, a too high value pull up resistor that appears to give perfect values on DC testing can give long term erratic results., so it's not worth taking chances.
 
the standard has long been SINKING rather than SOURCING
... Long ago, yes - back when PLCs first existed, as NPN devices were cheaper and better rated.

However source switching is is just plain safer and more reliable (in relation to possible fault conditions) so most systems use that standard.
You also have the negative of the 24V DC supply connected to the machine chassis / ground so any wiring damage is most likely to kill the supply.

Many DC-only / solid state PLC I/O devices are only available in positive switching versions.

This is a typical CNC power & ground requirements schematic, showing the connections as above:

Or a bit of Siemens control gear - again, everything built for positive side switching. (M = "masse", 0V, in Siemens terminology).
**broken link removed**
 
THIS,


OR

I could sell one that works either way (PNP or NPN) from both input or output for half the price in less than month.
 
THIS,


OR

I could sell one that works either way (PNP or NPN) from both input or output for half the price in less than month.

Well it seems incredibly vague about what it does, and how you connect it? - or what power it might need?.

Obviously it's obviously pretty trivial to convert source to sink or the other way (I posted one above), but all methods require some kind of power - and that's the problem, unless you can take it from the PLC or an external source.
 
As you've surmised, if you need a SOURCE (PNP) input, you just need a pull-up resistor to 24V - but you need to bear in mind that the polarity is then reversed, which you can easily change in the PLC programming. If you can't do that, then you could add two resistors and a PNP transistor to convert the output to SOURCE.

Thanks Nigel, that was very useful indeed.
The polarity can be reversed in software easily.

I think the transistor design also looks good. I will try this out. As for the relay option, I do not have sufficient space in my enclosure.

thanks everyone for the helpful tips...
 
Fleshing out Nigel's PNP suggestion, I think these R1/R2 values would do the job:
IO-PLC-adapter.PNG
 
If you use an opto-isolator and the right current limiting resistor you can solve a lot of issues. The design I had in mind would be a constant current regulator driving the Opto-LED that would allow for a wide 5V to 40V operating input voltage range, and the output depending on how you configure it could operate as a NPN or PNP since the NPN- within the Opto_Output would be floating... the external circuit wouldn't care if it is NPN or PNP
 
If you use an opto-isolator and the right current limiting resistor you can solve a lot of issues. The design I had in mind would be a constant current regulator driving the Opto-LED that would allow for a wide 5V to 40V operating input voltage range, and the output depending on how you configure it could operate as a NPN or PNP since the NPN- within the Opto_Output would be floating... the external circuit wouldn't care if it is NPN or PNP

You can get opto-isolated inputs on PLC's as a standard option, but (according to the guy I spoke to) it's pretty uncommon.

As I've mentioned all along, the problem in all these cases is POWER - an open drain FET as sink in the sensor (or other feed device) takes essentially zero power, and any source requires considerable power in order to work.

This is particularly important in my application at work, as it's battery powered and potted (so non-replaceable), and is designed to give in excess of five years battery life (theoretical battery life of my new design is 50 years - and shelf life of the battery is listed as 25 years) and should considerably exceed that 5 years.

Feeding an opto-coupler from the design would absolutely cripple the battery life, as would anything that draws more current from the battery.

I've come up with an 'optional' relay board, this is simply fed from the drain of the FET, and powered externally (from a PLC?), with the N/O relay contacts floating so as to used in any way needed. But according to the 'guy' I keep mentioning, anything remotely modern simply needs a sink to earth, and the FET (which has a 100 ohm series resistor) works fine.

The sink option also means just two wires!.
 
Why R2? (for the simulator?), and you REALLY ought to put a resistor between base and emitter.
I assumed R2 was needed to provide a pull-down (which I understood was being suggested in post #7); but if by default the PLC input goes low then R2 is clearly redundant.
I considered having a base-emitter resistor (and I would normally use one in my circuits to ensure transistor switch-off), but with R2 having a relatively low value the Q1 leakage current needed to pull the PLC input up to logic high would be > 5mA, which seemed highly unlikely.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top