Go to Post The only basis on which a team should be awarded the chairmans award is the content of the submission, not the way in which it is presented. - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-02-2016, 20:10
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,511
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
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?
  #2   Spotlight this post!  
Unread 05-02-2016, 20:26
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,582
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
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.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #3   Spotlight this post!  
Unread 05-02-2016, 22:41
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,511
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
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
  #4   Spotlight this post!  
Unread 05-02-2016, 22:48
engunneer's Avatar
engunneer engunneer is online now
Alumni turned Mentor
AKA: Branden Gunn
FRC #4761
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1996
Location: Reading, MA
Posts: 760
engunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond repute
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.
__________________
Student FRC23 (1996-1999), Mentor FRC246 (2000), Mentor FRC1318 (2007-2009), Mentor FRC93 (2011), Mentor FRC2151 (2012), Mentor FRC23 (2013), Mentor FRC4761 (2014-2017)
1998 - National Chairman's Award and Woodie Flowers Award (FRC23, Mike Bastoni ) | 2007 - PNW SF (488, 1595) | 2008 - Oregon RCA - Seattle #2 Seed, SF (488, 1696) | 2009 - Oregon #1 Seed, Winners (1983, 2635) - Seattle SF (945, 2865) - Galileo #2 Seed, SF (973, 25) | 2012 Midwest F (111, 71) | 2014 RIDE Winners (78, 125), Inspector - NEU #24, QF (3479, 3958) - NECMP #35 | 2015 Reading #11, SF (1058, 190), Inspector - RIDE #17, QF(4055, 5494), Inspector - NECMP #57 | 2016 Reading #4, SF (133, 4474), DCA, Inspector - Ride #22, SF (1735, 2067), Creativity, Inspector - NECMP #48, RCA - Archimedes
  #5   Spotlight this post!  
Unread 05-02-2016, 22:51
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 746
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: PNP versus NPN sensors

Here is a reference of NPN and PNP.
Attached Files
File Type: pdf npn-pnp.pdf (251.5 KB, 87 views)
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #6   Spotlight this post!  
Unread 05-02-2016, 22:55
Donut Donut is offline
The Arizona Mentor
AKA: Andrew
FRC #2662 (RoboKrew)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Goodyear, AZ
Posts: 1,279
Donut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond repute
Re: PNP versus NPN sensors

Quote:
Originally Posted by Kevin Sevcik View Post
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.
Pay particular attention to this as many common PNP sensors output the same voltage they are supplied with, which is typically 12V or more for the sensor to function (5V is not a common supply voltage for industrial environments that are the target market of most sensors).

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).
__________________
FRC Team 498 (Peoria, AZ), Student: 2004 - 2007
FRC Team 498 (Peoria, AZ), Mentor: 2008 - 2011
FRC Team 167 (Iowa City, IA), Mentor: 2012 - 2014
FRC Team 2662 (Tolleson, AZ), Mentor: 2014 - Present
  #7   Spotlight this post!  
Unread 05-02-2016, 23:14
Donut Donut is offline
The Arizona Mentor
AKA: Andrew
FRC #2662 (RoboKrew)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Goodyear, AZ
Posts: 1,279
Donut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond repute
Re: PNP versus NPN sensors

Quote:
Originally Posted by Tom Line View Post
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
Unless I am missing something on that voltage divider, it's going to try to output 5V, which still makes it PNP. That won't work for feeding the RoboRio inputs that expect an NPN style sensor.
__________________
FRC Team 498 (Peoria, AZ), Student: 2004 - 2007
FRC Team 498 (Peoria, AZ), Mentor: 2008 - 2011
FRC Team 167 (Iowa City, IA), Mentor: 2012 - 2014
FRC Team 2662 (Tolleson, AZ), Mentor: 2014 - Present
  #8   Spotlight this post!  
Unread 06-02-2016, 01:10
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 357
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
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.
__________________
Brian K
Team 1225 Robotics Mentor
  #9   Spotlight this post!  
Unread 06-02-2016, 12:08
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,012
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PNP versus NPN sensors

Quote:
Originally Posted by SuperBK View Post
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.
Could a simple (and quite inexpensive) NPN transistor be made to work?
Attached Thumbnails
Click image for larger version

Name:	PNP to DIO.png
Views:	38
Size:	8.0 KB
ID:	19991  
  #10   Spotlight this post!  
Unread 06-02-2016, 21:14
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: PNP versus NPN sensors

Quote:
Originally Posted by Kevin Sevcik View Post
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.
The roborio is not the digital side car. Per specs, the DIO ports can take up to 16v. They were designed with being able to take 12v in mind.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
  #11   Spotlight this post!  
Unread 06-02-2016, 22:21
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,582
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: PNP versus NPN sensors

Quote:
Originally Posted by Ether View Post
Could a simple (and quite inexpensive) NPN transistor be made to work?
I'm hesitant about that without my Art of Electronics to remind me about transistor fundamentals. I think that's alright, but you should have high values for the resistors. Probably dividing down till the base voltage is less than 3.3V. If I remember correctly, an NPN has a diode from base to collector which would be forward biased if you drive the base with more than 3.3V. Which I think would be bad, or atleast wouldn't work properly.

Quote:
Originally Posted by adciv View Post
The roborio is not the digital side car. Per specs, the DIO ports can take up to 16v. They were designed with being able to take 12v in mind.
That's fascinating information, where did you find it? The RoboRIO specs that I looked at when formulating my answers stated 5.25V max for the logic high of the DIOs, with no mention of a max voltage. The analog IO is listed as +-16V protection, but there's no reason to assume that carries over to the DIO.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #12   Spotlight this post!  
Unread 06-02-2016, 22:41
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: PNP versus NPN sensors

Quote:
Originally Posted by Ether View Post
Could a simple (and quite inexpensive) NPN transistor be made to work?
Quote:
Originally Posted by Kevin Sevcik View Post
I'm hesitant about that without my Art of Electronics to remind me about transistor fundamentals. I think that's alright, but you should have high values for the resistors. Probably dividing down till the base voltage is less than 3.3V. If I remember correctly, an NPN has a diode from base to collector which would be forward biased if you drive the base with more than 3.3V. Which I think would be bad, or atleast wouldn't work properly.
You can use an NPN BJT with a single series resistor of high enough resistance to limit the base current. I don't think the voltage divider is necessary.

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.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #13   Spotlight this post!  
Unread 08-02-2016, 07:32
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,766
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: PNP versus NPN sensors

Tom,
It might make this a better discussion if you tell us the sensor you are looking at.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
  #14   Spotlight this post!  
Unread 08-02-2016, 07:56
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: PNP versus NPN sensors

Quote:
Originally Posted by Kevin Sevcik View Post
That's fascinating information, where did you find it? The RoboRIO specs that I looked at when formulating my answers stated 5.25V max for the logic high of the DIOs, with no mention of a max voltage. The analog IO is listed as +-16V protection, but there's no reason to assume that carries over to the DIO.
During Alpha testing, NI covered some design info. They talked about the protections they were incorporating and I remember them talking about the protections incorporated. I've got an Alpha Rio lying around I can attach a battery directly tonight to demonstrate (if I'm wrong and it fries, I won't care).
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
  #15   Spotlight this post!  
Unread 08-02-2016, 15:37
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,070
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: PNP versus NPN sensors

Quote:
Originally Posted by adciv View Post
During Alpha testing, NI covered some design info. They talked about the protections they were incorporating and I remember them talking about the protections incorporated. I've got an Alpha Rio lying around I can attach a battery directly tonight to demonstrate (if I'm wrong and it fries, I won't care).
Remember that survivable voltage is different than functional voltage. The RoboRIO was designed to survive battery voltage on any pin, but those pins may or may not be functional until the battery voltage is removed.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:39.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi