![]() |
PNP versus NPN sensors
Disclaimer - I am not an electrical engineer.
It's my understanding that NPN style sensors sink to ground. I.e. - if you plug the signal cable of a NPN into the roborio DIO, it will pull the signal pin to ground and roboRIO will "see" it. How would you go about hooking up a PNP sensor to the roboRIO? |
Re: PNP versus NPN sensors
RoboRio DIOs have a pullup resistor, which is why connecting an NPN directly to them can work. To make a PNP output to it, you basically need to reverse this situation. Connect a pull-down resistor from the signal pin to ground, then you can connect your PNP output to the signal pin as well. Your pull-down resistor will have to be low enough resistance to overcome the pullup resistor, but high enough resistance that your PNP output will still drive the volts high enough to register as a high level on the DIO.
For DIO 0-9 and DIO 0-13 on the MXP with the 40kohm resistors, a pull down of 10k would barely be enough, 5k pulldown would be safer. An important caveat is that this only works with 5V PNP sensors. A 12V PNP output is going to blow up your DIO port unless you use a more complicated circuit. |
Re: PNP versus NPN sensors
Wouldn't running the signal wire through a cheap voltage divider like this allow me to feed into the DIO?
http://www.robotshop.com/en/dfrobot-...FQovaQodmWwKOw |
Re: PNP versus NPN sensors
yes, you can voltage divide down your 12V PNP to get a 5V output. you can buy this board if you want, but its also easy to do with soldering a few resistors.
|
Re: PNP versus NPN sensors
1 Attachment(s)
Here is a reference of NPN and PNP.
|
Re: PNP versus NPN sensors
Quote:
Another option is to use an interposing relay to convert from PNP to NPN. Get a relay with a coil rated for the output voltage of the sensor, connect the signal wire of the sensor to the positive coil lead and a common wire to the negative coil lead. Then connect the RoboRio input to the NO lead of the relay output and a common wire to the common lead of the relay output (these will be the only leads on a SPST relay, make sure to use NO and common if using a SPDT relay). You can use this same method to convert between different voltage levels also (using a 12V PNP sensor to trigger a 5V sinking input, just have to feed 5V to the common side of the relay output). |
Re: PNP versus NPN sensors
Quote:
|
Re: PNP versus NPN sensors
A more reliable way than relying on a voltage divider and two resistors pulling against each other is to use an opto-isolator with a NPN output to invert the signal. That is basically the same thing that Donut is saying, but just doing with a solid state device instead of a relay.
Also be away that a sensor with an NPN output may not pull the voltage down low enough for a logic low into the DIO port of a roboRIO. Last year we used some QM series reflective sensors from Automation Direct that only went down to around 1.7 volts. We had to run them through opto isolators to get a good logic low, which is generally 0.7 volts or below. |
Re: PNP versus NPN sensors
1 Attachment(s)
Quote:
|
Re: PNP versus NPN sensors
Quote:
|
Re: PNP versus NPN sensors
Quote:
Quote:
|
Re: PNP versus NPN sensors
Quote:
Quote:
You can also use a FET with a pull-down resistor on the gate. This is what I would pick. The resistor value doesn't matter, as long as the current through it isn't higher than the limit for the PNP in the sensor. |
Re: PNP versus NPN sensors
Tom,
It might make this a better discussion if you tell us the sensor you are looking at. |
Re: PNP versus NPN sensors
Quote:
|
Re: PNP versus NPN sensors
Quote:
|
| All times are GMT -5. The time now is 08:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi