# voltage comparison switch

#### James Hockney

Joined Oct 23, 2018
19
I have a sensor which is excited by a nominal 12V supply and outputs either supply voltage when closed or supply - 2 volts when open.
The input voltage can vary by +/- 3V.
I need to convert this to supply voltage when closed and 0 V when open to activate another circuit. What is the simplest method to achieve this.

#### Dodgydave

Joined Jun 22, 2012
10,041
Show us your sensor and ideally it's datasheet..

#### Wolframore

Joined Jan 21, 2019
2,321
sounds like a job for a comparator but it’s just a guess based on a vague description of your sensor and circuit requirements.

#### James Hockney

Joined Oct 23, 2018
19
This is the sensor, I was expecting it to switch on and off at pin 4 but it seems that instead it just drops about 2v when not activated.

#### Attachments

• 106.9 KB Views: 21

#### kubeek

Joined Sep 20, 2005
5,757

#### AlbertHall

Joined Jun 4, 2014
11,402
Connect a load resistor, say 1k, value not critical, between the output and 0V and measure the voltage across this resistor.
You might well get strange values if there is no load.

#### Dodgydave

Joined Jun 22, 2012
10,041
It's an open collector load, and it's pulled low when sensing, works upto 200mA.

#### Tonyr1084

Joined Sep 24, 2015
6,086

#### Wolframore

Joined Jan 21, 2019
2,321
that's the voltage drop of a closed state, he's experiencing 2V at open is how I read it.

#### Tonyr1084

Joined Sep 24, 2015
6,086
nominal 12V supply and outputs either supply voltage when closed or supply - 2 volts when open.
that's the voltage drop of a closed state, he's experiencing 2V at open is how I read it.
How I'm reading it is Vs (Supply voltage) -2V when open. If Vs = 12V then at the output he's seeing (12V - 2V =) 10V when the switch is supposed to be in the open position. There IS some confusion in the description, at least for me there is.

Assuming this is similar to the hundreds of proximity switches I've installed in commercial aircraft, it senses the presence of a ferrous metal (steel for instance). On aircraft, when the door is closed the switch closes, meaning Vs is applied to the output line. When the door is open the switch does not send Vs. Less any voltage drops.

This is the sensor, I was expecting it to switch on and off at pin 4 but it seems that instead it just drops about 2v when not activated.
So - door open you're seeing Vs - 2V. When closed you're seeing Vs.

The goal is to reverse the functioning of the switch (I presume). Door open - Vs. Door closed, 0V (or maybe 2V). Is this correct?

#### Tonyr1084

Joined Sep 24, 2015
6,086
Followup to my previous post - what are you switching? A light? A control? Whatever you're switching, there are different methods of achieving the reversal of the function. Can be done with a relay or can be done with an inverter (depending on power draw), can be done with a couple of transistors. It all depends on what's being switched. And I'm assuming you're switching something that is DC voltage controlled, not AC.

#### sghioto

Joined Dec 31, 2017
2,373
The 2 volt drop is the maximum expected voltage loss at the rated output of 200ma.
The output should be zero when open and appx Vs when closed depending on the load.

COMPLEMENTARY
Output circuit typeDC
Discrete output typePNP
Electrical connectionMale connector M12, 4 pins
[Us] rated supply voltage12...48 V DC with reverse polarity protection
Switching capacity in mA<= 200 mA DC with overload and short-circuit protection
IP degree of protectionIP67 conforming to IEC 60529
IP69K conforming to DIN 40050
Detection faceFrontal
Front materialPPS
Enclosure materialNickel plated brass
Sensing range> 4...8 mm
Operating zone0…6.4 mm
Differential travel1...15% of Sr
Status LEDOutput state: 1 LED (yellow)
Supply voltage limits10…58 V DC
Switching frequency<= 1000 Hz
Maximum voltage drop<2 V (closed)

#### James Hockney

Joined Oct 23, 2018
19
OK So with a 10k Resistor in the output line the voltage across it is 1V, with a 1k Resistor the Voltage is 0.25V.

#### James Hockney

Joined Oct 23, 2018
19
To clarify the situation:
As Tonyr1084 stated; this is a standard proximity sensor which I expected to output a signal when a ferrous material is close to the end of the sensor (closed state) and output no signal when the ferrous material is removed (open state)
What I am seeing with the sensor is:
VS = input voltage
VO = output voltage
When the sensor is in the Closed State VO= VS.
When the sensor is in the Open State VO= VS-2. I was expecting this to be VO=0

#### Tonyr1084

Joined Sep 24, 2015
6,086
Without more understanding of the exact functioning of the switch, it could be that Vs and Vn (Vn = "negative") provide the switch the ability to function. It's overall output function, Vo, can either provide Vs-2v or Vn+2v. In other words, the switch may function either as a source follower (or as I prefer to think of it as a "load" follower, or ground (Vn) or as, and this probably isn't the correct terminology, source leader. I'll bang out a diagram shortly and post it.

Back when I first started tinkering with cars, the dome light was controlled by the door switch. That switch provided a path to ground (negative). So the battery was wired to the light, the light to the switch, the switch to ground. Open the door and the light came on. The other way, which would have required more wiring, would be to have the door switch provide power to the dome light. In other words, the battery is wired to the switch, the switch is wired to the light, the light is wired to ground. It'll make more sense when I've drawn a diagram.

#### Tonyr1084

Joined Sep 24, 2015
6,086
OK, these four diagrams show the possible configurations of your switch. To me it's not clear what exactly Vo provides. If Vo ~ Vs then it provides a power source to the light. If Vo ~ Vn then it provides a path to ground (negative). IF the switch is NO (normally open) then when steel comes near, the light should come on. IF the switch is NC then when steel comes near the light should switch off.

#### James Hockney

Joined Oct 23, 2018
19
Hi Tony, it is a PNP sensor, So it (supposedly) switches per top right.

#### sghioto

Joined Dec 31, 2017
2,373
From the data sheet the output is PNP, normally open. The load shares a common ground with the sensor.

#### Tonyr1084

Joined Sep 24, 2015
6,086
When the sensor is in the Closed State VO= VS.
When the sensor is in the Open State VO= VS-2. I was expecting this to be VO=0
With that and a now clearer understanding of the function of the switch, perhaps measuring voltage is not the way to go. Measuring current should reveal more information. In other words, when the switch is open - no current flows. When closed - current flows at the rate dictated by ohms law.

#### sghioto

Joined Dec 31, 2017
2,373
The TS previously confirmed that the output is .25 volt with a 1K load when open. That's a 250 micro amp residual current. Probably normal for this sensor.