DC: 5V PNP Sensor requiring conversion 12v Source & 12V NPN output

Thread Starter

James Hockney

Joined Oct 23, 2018
19
I have a 5v Laser Emitter & Sensor PNP (Signal High) module which all works fine on my Arduino, and with LED indicators.
I now need to adapt this to work with a device which requires NPN (Signal Ground) and operates at 12v.
I need the parts to remain as small as possible (while using through hole components) as the whole module needs to fit in a small space.
A relay is not an option as the switch rate is approx 85hz max and I need the thing to be reliable for long term use.
Please can someone explain to me what I have to do in order to get the 12v down to 5v for the emitter and sensor, and then acheive the switching of the final output to ground when the sensor triggers (+5v).

Many thanks.
 

BobTPH

Joined Jun 5, 2013
9,003
How much current does it have to switch at 12V? This will determine what transistor and resistor you need. Depending on the current, a logic level MOSFET might be a better choice.

Bob
 

ebeowulf17

Joined Aug 12, 2014
3,307
Thanks, Will try this out once my new sensor arrives. How do I size the resistors and capacitors?
The capacitors for the power supply will be discussed in the regulator's datasheet. If you're not already in the habit of reading datasheets, now is a good time to start. Datasheets are your best friend. Typically 1uF - 10uF is what's needed, and some regulators are more particular about exact values than others.

The resistor values will depend on how much current needs to be switched to pull the 12V signal line down to ground. There are tons of articles and guides on using an NPN transistor as a saturated switch. That's what you'll be doing here (unless you need to switch a lot more current than expected and you end up needing a MOSFET.) Try reading up on NPN saturated switch configuration and see if you find what you need.
 

panic mode

Joined Oct 10, 2011
2,761
i guess this is going to input of some sort of PLC or equivalent. in that case inputs will rarely draw more than 20mA or so. industrial sensors often have output rated at 0.1..0.3A
 

ebeowulf17

Joined Aug 12, 2014
3,307
Working at 60mA gives me this I think. Not sure how to size the Null resistor though as I can't see anything about that.
View attachment 162230
A few things jump out at me. Your laser diode doesn't have a current limiting resistor. Are you using an assembly of some sort which includes its own driver? If so, you're probably fine, but you shouldn't use the LED symbol for it. If not, you need a resistor or current limiting driver circuit.

The way you've drawn the laser detector seems wrong to me. Again, are you using discrete components, or some sort of module/assembly? If it's a discrete photo transistor, that can't be the right layout. When it conducts, it'll try to short your power supply. If it's not discrete components, it would be better to draw it as a module (this may not always be true - if you know the exact internal parts of a module, it may be informative to include them in the schematic sometimes.)

Regardless of discrete vs. modules, the 10k on the "out" of the detector seems wrong. As drawn, it potentially tries to hold the output high at all times, which in turn would keep your NPN output active at all times.

Anyway, assuming all the laser bits are modules and are just misrepresented on the schematic, that just leaves the NPN as switch question. A common rule of thumb says drive the base with 10% of expected collector current to ensure saturation. If you need to sink 60mA, that means 6mA base current. Starting with a 5V signal and subtracting 0.7V for base-emitter junction leaves 4.3V. To get 6mA (0.006A) from 4.3V would mean a 716ohm resistor, so I think your 6k is on the high side.

As for the "null" resistor (never heard that name before - I know them as pull downs,) there are probably better ways to think it through, but a fair starting point is 10x the base resistor. So, if we round my 716 above down to a standard value of 680ohms on the base resistor, that would mean 6.8k for the pull down resistor.

All of this hinges on the module specifics though. Can your detector source any real current, or is it a high impedance source? If you can share datasheets for the laser and the detector, that would clear up a lot of confusion.
 

Thread Starter

James Hockney

Joined Oct 23, 2018
19
I can't find a datasheet for the detector module which is a single 3 pin piece resembling a photo transistor fitted on a pouch with all of the other components on that side of the laser emitter in the circuit. It confuses me as to how it worked and it now seems not to on the original item I received. The laser emitter has a built in resistor of unknown value as the smd had no text on it.
Suffice to say those parts worked but as the detector is now broken I may replace it with a new detector from components with datasheet available.
 

ebeowulf17

Joined Aug 12, 2014
3,307
Ok, cool. So you're in good shape on the laser emitter end. Ideally, you should revise your schematic and either use some distinct symbol to indicate a self-contained laser module, or add the built-in resistor to the schematic. Either way, I understand what you've got there now.

On the receiving end, sorry about your dead parts. Once you get a replacement, if you could share the datasheet here, we can be sure of what you need to modify its output.

Cheers!
 

ScottWang

Joined Aug 23, 2012
7,409
The phototransistor in the circuit of the post #9, there is no current limiting resistor in series with c of phototransistor, are you trying to blow it up?
 

Thread Starter

James Hockney

Joined Oct 23, 2018
19
Scott Wang, you'll see from my posts that the part isn't a generic photo transistor and that I've labelled the legs of that component as they are on the PCB which came with it. In any case it has ceased to function and now the circuit gives a permanent voltage at the output which doesn't vary with light detection.
I'll find some new parts and report a new schematic.
 

MisterBill2

Joined Jan 23, 2018
18,600
One more possible problem is that with many of the laser modules that I have used the case is the +5 volts connection, and so it can't be just connected to ground, and on my laser modules the case had to be heat-sinked. So I used a small DC to DC module to get the negative 5 volts to run the laser module, and that did work out well.
 

Thread Starter

James Hockney

Joined Oct 23, 2018
19
OK, Thanks for the help guys.
One final question.
The 0.1uF Cap is delayed until Back end of December, would everything still work with a second 0.33uf Cap in it's place or will the increased capacitance cause issues?
 

ebeowulf17

Joined Aug 12, 2014
3,307
OK, Thanks for the help guys.
One final question.
The 0.1uF Cap is delayed until Back end of December, would everything still work with a second 0.33uf Cap in it's place or will the increased capacitance cause issues?
I'll be interested to hear what other, more experienced members say, but my general impression of linear regulators is that you'll be fine.

I would be wary of ever providing less capacitance than they recommend without giving it lots of thought, but more seems to be ok, within reason.

As capacitance values go up, other capacitor specs tend to change too (ESR, leakage, frequency response, etc.) so there are limits to how far you can go, but I'd guess (emphasis on guess) you could go 5-10 times higher than their application example without worry.
 
Top