Welcome! Log In Create A New Profile

Advanced

Quick question about wiring a NPN proximity sensor

Posted by icefire 
Quick question about wiring a NPN proximity sensor
October 25, 2016 01:46PM
So I actually don't need a proximity sensor at the moment. My bed adjustment works well and I don't really need to readjust it very often. However I am thinking of getting an inductive sensor just out of (scientific) interest smiling smiley

I read quite a lot on the subject but there is still something I don't understand. If I get a NPN sensor it is going to pull the Signal wire to ground when triggered. So far so good. I am planning on running my RAMPS on 24V (the Arduino has external power supply). So if I power the sensor with 24V can I connect the signal wire to the signal pin on the ramps board without any voltage dividers? What happens to the signal wire when not triggered? If the signal wire has the input voltage when not triggered (i.e. 24V) then it doesn't seem a good idea to connect it directly as the signal pin on the RAMPS cannot handle more than 5V. In this case I'd rather use a voltage regulator.

So the basic question is: Can I connect the NPN proximity sensor to the 24V powered RAMPS without additional modification or should I use a 5V voltage regulator or voltage divider?

Sorry for the stupid question but I have read a lot of contradicting statements


Self-sourced Mendelmax 2.0-based Reprap Machine -- Ramps 1.4 & Mega 2560 -- DRV8825 (Z@1A, [email protected], [email protected], E@1A) -- genuine E3D v6 direct setup -- 350W custom silicone heated bed -- ABS 1,75mm -- Marlin 1.1.0-RC7 -- Cura 15.04.6
Re: Quick question about wiring a NPN proximity sensor
October 25, 2016 02:08PM
Depends on the sensor. Some are happy with extra volts. Some aren't. Get sensor, google datasheet for it, that should tell you what voltage limits are, on the power pin of the sensor. Ground is ground, you don't have to worry about the signal being voltage compatible (idea is, when it doesn't have any voltage and is at 0V, zero volts, that shows the sensor has been activated and is sensing something).

I wouldn't go 24V on RAMPS. It just was not designed for it. You can get 24V equipment working on (some) RAMPS, but never to full capacity.

Edited 3 time(s). Last edit at 10/25/2016 02:30PM by DragonFire.
Re: Quick question about wiring a NPN proximity sensor
October 25, 2016 02:55PM
Must admit, many years ago, I was confused by the same issue. It is better to talk about pins being "active high" or "active low" than NPN or PNP types of sensor... NPN is a manufacturing method, what worries electronics designers is how it behaves, not how it was made.
Re: Quick question about wiring a NPN proximity sensor
October 25, 2016 04:08PM
I am talking about such a sensor: [www.ebay.com]
NO contacts, 6-36V input voltage.

If the RAMPS board is operating at 12 or 24 Volts isn't really relevant because the question remains if the RAMPS were working at 12V.

So, could someone shed some light on the following things:
1. What ist he behavior of the signal pin when the switch is not triggered (0V or input voltage or something in between)?
2. (depending on what the answer to 1. ist): Do I need to reduce the output on the signal pin to 5V when not triggered?

Thanks smiling smiley


Self-sourced Mendelmax 2.0-based Reprap Machine -- Ramps 1.4 & Mega 2560 -- DRV8825 (Z@1A, [email protected], [email protected], E@1A) -- genuine E3D v6 direct setup -- 350W custom silicone heated bed -- ABS 1,75mm -- Marlin 1.1.0-RC7 -- Cura 15.04.6
Re: Quick question about wiring a NPN proximity sensor
October 25, 2016 04:50PM
Uhuh. Datasheet says black is "common" (ground, 0v), brown wire is power feed is 6-36V (it doesn't care so long as more than 6 and less than 36.1V) and the blue signal line wire goes low (active low to 0V) when triggered.

There are "Pullup" resistors on RAMPS for most if not all inputs, so that they aren't 0V unless triggered, to answer your first question.

Your second question, probably not, the probe sensor input should already have a pull up resistor on it, and there is no mention of needing a pull up resistor using that sensor on this "how to" tutorial.

[www.instructables.com]

The convention on schematic diagrams is that an an active low connection has a line drawn above it. Active high connections do not.

Edited 3 time(s). Last edit at 10/25/2016 04:54PM by DragonFire.
Re: Quick question about wiring a NPN proximity sensor
October 25, 2016 10:51PM
Quote
icefire

So, could someone shed some light on the following things:
1. What ist he behavior of the signal pin when the switch is not triggered (0V or input voltage or something in between)?
2. (depending on what the answer to 1. ist): Do I need to reduce the output on the signal pin to 5V when not triggered?

1. It's floating. Which means that it's at whatever voltage you feed into it (5V if using a RAMPS board). It's essentially not connected.
2. No.

If you're really concerned about it, the easiest way to sort this out is to put a diode in series with the signal pin so that when the sensor output goes low, it pulls down the RAMPS signal pin. That way if it does for some crazy reason start outputting 12V on that pin then the diode will stop it burning out your board.

I've used the diode solution before on a similar NPN sensor, it worked just fine (until I got sick of general inductive sensor lack of accuracy and replaced it with this: [www.thingiverse.com])
Re: Quick question about wiring a NPN proximity sensor
October 26, 2016 12:02AM
(scratches head) How is a diode going to make a difference?

Diodes transmit electricity only one way.

Put a diode in the wrong way, the signal can't get through.

Put it in the other way, it's going to allow the signal to connect, but isn't going to stop a power surge.

Huh?

EDIT:

OK, Zener diodes do that - they blow when they reach their limit. I guess the D1 diode on a RAMPs does something similar... And that isn't a Zener type.

Edited 1 time(s). Last edit at 10/26/2016 12:05AM by DragonFire.
Re: Quick question about wiring a NPN proximity sensor
October 26, 2016 06:44AM
Dragonfire,

The diode allows the low (pulldown) signal through, but doesn't allow a high voltage through. So the RAMPS board is protected.

It's oriented with the arrow pointing towards the sensor.
Re: Quick question about wiring a NPN proximity sensor
October 26, 2016 12:13PM
So this is how I will do it. I have a bunch of 1N7007 diodes lying around. I just got a 2,50$ inductive sensor off aliexpress, if it isn't accurate I am going to be happy that I learned new stuff about 3d printing ang go back to my manual bed levelling or go for a more sophisticated sensor.


Self-sourced Mendelmax 2.0-based Reprap Machine -- Ramps 1.4 & Mega 2560 -- DRV8825 (Z@1A, [email protected], [email protected], E@1A) -- genuine E3D v6 direct setup -- 350W custom silicone heated bed -- ABS 1,75mm -- Marlin 1.1.0-RC7 -- Cura 15.04.6
Re: Quick question about wiring a NPN proximity sensor
October 26, 2016 10:15PM
It's easier to use a 12vdc relay board than trying to get the resisters correct.

Don't forget that the voltage drop across a diode varies with temperature and current.

Edited 1 time(s). Last edit at 10/26/2016 10:16PM by stephenrc.
Re: Quick question about wiring a NPN proximity sensor
October 27, 2016 12:57AM
Stephenrc:

1: There are no resistors in my solution, only one diode
2: The voltage drop does not matter, as it is a digital signal that only has to be below 2 volts or so.
3: I've tried this solution and it triggered just fine (well, within the limitations of an inductive sensor anyway).

Edited 1 time(s). Last edit at 10/27/2016 12:58AM by nebbian.
Re: Quick question about wiring a NPN proximity sensor
October 27, 2016 04:45AM
A diode is what we recommend for connecting an NPN-output sensor to the Duet too, see [duet3d.com]. The purpose of the diode is to protect the electronics in the event that the sensor ground wire becomes disconnected.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Sorry, only registered users may post in this forum.

Click here to login