May 20, 2024, 08:33:39 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Triggering the prop-1 or prop-2 with a PNP or NPN sensor

Started by gadget-evilusions, August 30, 2007, 01:11:28 PM

Previous topic - Next topic

gadget-evilusions

I am looking for cheaper alternatives in retroreflective sensors to trigger my programs. How would interface a sensor with either a pnp or npn output. I tried to ask some of the more knowledgable industrial automation electricians at my work but I couldn't answer as to what each of the 3 pins were ( i dont know the difference between signal, vdd and vss).

Would the code be different than when I hook up a relay to the white and the red to trigger my program?
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Ideally, you'd like an NPN, "open collector" output -- like this:



The "output" terminal goes to P6.W with the SETUP jumper in the UP position; the GND terminal goes to P6.B.  When the sensor is not active, PIN6 will read as "1" (because of the pull-up); when the sensor goes active and the transistor conducts, P6.W will be pulled to near ground and read as "0".
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

gadget-evilusions

I just want to confirm that the above information, that NPN is easier and better, is correct. It's been 8 years and I am finally hooking up some laser sensors to a prop-1.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Open-collector / NPN circuits are favored because the receiving side handles the non-active input level; the sensor pulls that to ground (which is common between the devices) to create the active state. This arrangement prevents power supply mismatch problems.

Shorter: Go with Open-collector / NPN sensors.  Use P6 or P7 with the SETUP jumper in the UP position and the ULN influence removed.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Is it possible to wire several NPN devices in series to one pin? I am not 100% on the workings of transistors and always have relay logic in my head.

For example, if I wanted 10 sensors, and only needed to see if one activated, and did not care which one was.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Yes! -- that is part of the beauty of that interface. The open-collector/NPN output acts like a broken (open) wire when not active. When it is active, it connects to ground. If two or more devices activate at the same time, they're all pulling the signal to ground, which is common between them. No harm, no foul, easy connections.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Quote from: JonnyMac on August 30, 2007, 06:44:19 PM
Ideally, you'd like an NPN, "open collector" output -- like this:



The "output" terminal goes to P6.W with the SETUP jumper in the UP position; the GND terminal goes to P6.B.  When the sensor is not active, PIN6 will read as "1" (because of the pull-up); when the sensor goes active and the transistor conducts, P6.W will be pulled to near ground and read as "0".

What happens if I wanted to connect 5 sensors to a prop-1 that are NPN. Obviously only two of the I/O pins have a up jumper. What do I need to do in place of the up jumper?
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JackMan

You would have remove the ULN influence from each of those pins and then connect a 4.7K resistor from each W pin to 5V positive on the board. Connect your NPN's as usual.

gadget-evilusions

Quote from: JackMan on September 25, 2015, 06:29:07 AM
You would have remove the ULN influence from each of those pins and then connect a 4.7K resistor from each W pin to 5V positive on the board. Connect your NPN's as usual.

That will be easy. Thanks.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

gadget-evilusions



Here is the diagram for my sensor.

I am having trouble determining which wire goes to white and black pins on the Prop-2 headers.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

November 02, 2015, 07:12:57 AM #11 Last Edit: November 02, 2015, 07:18:43 AM by JonnyMac
Pin 4 from the device switches ground (NPN mode -- the same way the ULN chips on the Prop-2 switch ground to the output terminals). Connect sensro pin 4 to W pin on the Prop-2 with the SETUP jumper in the UP position (and make sure you've removed ULN influence from that pin as well). If you don't have a SETUP jumper on the pin you're using put a 4.7K or 10K resistor where "LOAD" is shown in your diagram. This will pull up the input to 1 when the sensor is not active.

Now you can see why the my standard trigger code uses constants for trigger levels.

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check time


In you case, we want the active trigger "off" value to be 1 since the P6 SETUP pull-up will pull the pin high with any external influence. Adjust your trigger constants like this:

SYMBOL  TrOn            = 0                     ' active-low trigger
SYMBOL  TrOff           = 1


If your Prop-2 is not sharing a power supply with the sensor then the Px.B connects to sensor Pin 3.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

I have used all the above information to successfully use several different NPN sensors with great results.

On my most recent project, I ordered these very nice rectangular sensors http://www.automationdirect.com/adc/Shopping/Catalog/Sensors_-z-_Encoders/Capacitive_Proximity_Sensors/Rectangular_(CR1_Series)/CR1-00-2A

They are supposed to be auto sensing and adjust to NPN/PNP based upon how they are hooked up. This function does not appear to work, and I am hoping someone can help (since I have 20 of them now). i tested one with a meter and it functioned correctly, but as soon as I hooked it up to a prop-1, it no longer functions. My assumtion is that they way it's hooked up, it's seeing the 5 volts on the W pin from the pull up resistor, that it's throwing the sensor into PNP mode in stead of NPN.

Any ideas?
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

If they're "auto-sensing" that suggests they don't have an internal pull-up. Also, the documentation shows the load connected between the + (12v?) and the black (output) wire.

What I think you need to do is connect a 25K resistor between + (sensor.1) and out (sensor.4) to simulate a load that will cause the sensor to think it's in NPN mode. The 25K becomes the pull-up for the input, and this size will protect the Prop-1 from the 12v. You need to remove any other pull-up on your input pin.

If you can, avoid these dual-output sensors. You want an open-collector device that just switches ground, and allows you to use the onboard pull-up.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Thanks. Similar to what I thought. I will never buy these again. I'll see if I can find a RadioShack.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components