[SOLVED] How to build level shifter 3.3v to 24v

@Runaway Pancake, I think you meant "Should be able to work. Philips recommended...", but I find this comparison a bit confusing.

I think this topic needs some sort of closure. Or else I would have settled with my initial "investigation" :)

We concluded that [u]the sensor can output up to about 3.x mA/u. I think everyone agrees that [u]this leaves the most common optocouplers out of the question[/u], since they would require about 10~20mA to function reliably.

Moving forward. As I gather, an open collector output can either be open (high impedance) or closed (tied to the emitter which would be GND). Is this correct? So it stands to reason that any open collector needs to be provided with an arbitrary V+ through a resistor/load, just like a NPN BJT or N-channel FET does. Right?

Ok, so [u]using a NPN transistor[/u] in this case, it would invert the logic, and thus require a PNP transistor to restore the logic.

Now, [u]in the case of a comparator[/u], if its output is also open collector, then it requires a pullup, and it [u]would[/u] invert the logic; so the trick here (to NOT invert the logic) is connecting the 3.3v signal to the inverting input, and the voltage reference (1.7V) to the non-inverting input. Just to be complete and aware of the implications, [u]the circuit would draw about 10mA continuously while the output is LOW/u.

The amount of searching and reading required to reach this reasoning... Please tell me I'm right. But only if I am :)

If all is well, let's try to provide the forum with some answers: - One solution is using a comparator. A good choice for this purpose would be the LM393-N, plus two or three parts (resistor pair/diode(s) for the voltage reference, and the pullup resistor on the output). Concern: 20 circuits like this would draw about 5W. - If more output current is required (>15mA), and lower "idle current", the N-channel+P-channel FET pair would be best. Along with some resistors as well. In that case, the N-channel FET BS170 looks good for the job, however I can't find the adequate P-channel partner for it.

I'd like to verify these allegations with you guys if possible. Both solutions are desirable to pursue, for verification and energy efficiency comparison.


Can use two N-channel MOSFETs for next to 0mA current flow in the control section.
Add P-channel MOSFET and pulldown resistor for off condition.

@CrossRoads, your schematics are enlightening. But it raises some questions. I don't see how it's possible to have +24V on the gate. Also the "low-current non-inverting buffer" has two N-channel MOSFETs? Couldn't I just do that "resistor to ground" with just one N-channel MOSFET then? And what's wrong with the off condition, since the output is already pulled down?

It's very late here. I should revisit this tomorrow morning, with a fresh set of eyes.


[quote author=Runaway Pancake date=1447466697 link=msg=2477938] Should be able to work the Philips recommended I2C level converter circuit this way. [/quote] The maximum value of pull-up resistor to 24V would be 4.3kΩ. That's to ensure at least 15V in the high state with the input resistance of 7.4kΩ (to ground). In the low state, the current through that resistor would be 5.6mA. With the 'Philips' level shifter circuit, the PIR circuit output is not capable of sinking that current via the MOSFET (according to data I have found on the PIR). I therefore don't think such a level converter will work unless there are more components.

As shown by Koepel, a comparator would work, so too would a two-transistor non-inverting buffer.

For a transistor buffer, I would use NPN followed by PNP so the PNP transistor can give near rail-to-rail swing when connected to the 7.4kΩ input of the automation device.

I don't see much point using an optocoupler unless it is configured to give total isolation between the PIR and the automation device . . . . . which could be well worthwhile.

It's very late here. I should revisit this tomorrow morning, with a fresh set of eyes.

Indeed, then you would see the difference between N-channel and P-channel, and recognize the pullup on the open-drain of the N-channel MOSFET.

Circuit as-is relies on 24V tolerant parts for Vgsf, which may or may not be available. I haven't looked.

I suppose a voltage divider to let the P-channel gate swing between 24V and 12V when the N-channel MOSFET was on would suffice.

Hi again, I'm starting to get it. @CrossRoads, please forgive my confusion. Had to read on the subject, and it took me a while... The secret was the little triangle next to the Gate, I didn't know before that's how you differ one from another... :) How embarassing.

Let me tell you, I ran into some issues: - First of all, the N-channel MOSFET is the BS170 which I think is just fine for this purpose. I have tested and confirmed that two N-channel FETs can do the trick (non-inverting output), but there's the disadvantage of energy (in)efficiency - the second MOSFET is on most of the time, sinking current. - Couldn't find a P-channel MOSFET with TO-92 package or similar. So for now I'm stuck with BC557 PNP transistors. What worries me the most is something in the Datasheet: Emitter-Base Voltage --> Max. -5V. - I wired a couple of test circuits, and things worked as expected, but I did this with every voltage source being 3.3v. I didn't risk connecting 24V just yet. - Didn't know [u]transistors[/u] were current driven, instead of voltage driven like [u]MOSFETs[/u]. Somehow in this process I must have gotten lucky because there was no apparent overheating and no magic smoke :o

CrossRoads: I suppose a voltage divider to let the P-channel gate swing between 24V and 12V when the N-channel MOSFET was on would suffice.

I'm afraid to blow up something because of that [u]Emitter-Base Voltage limit on the PNP transistor[/u], which I still don't quite understand...

What changes for a [u]N-ch FET[/u] + [u]PNP transistor[/u] combination, if I may ask?

Again... thanks.

P-channel MOSFET, TO-92 and other thru hole packages: http://www.digikey.com/product-search/en?pv69=80&FV=fff40015%2Cfff8007d&k=p-channel+mosfet&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25 With PNP, you need to pull current from the base to turn it on, so the N-channel MOSFET is used to pull the base low to turn the PNP on. IF Vbe is -5V Max, and you are driving 24V, then Vbase can't go below 19V to avoid damaging it.

Hi guys,
Just here to thank @CrossRoads and all the other participants, and report on my success :slight_smile:

The PNP transistor didn’t really suit the purpose. Not ideally anyway.
I finally found a local supplier for the BS250 P-channel MOSFET, and its specs are just what I need.

Attached is a photo with the working circuit.


Level Shifter using BS170+BS250

  • Low-Current idle state
  • Non-isolating (features don’t always have to be good)
  • Input voltage: 2-20Vdc (recommended 3-15V) limited by the BS170 MOSFET’s Gate
  • Output voltage: up to 45Vdc (recommended < 36V) limited by the BS250 MOSFET
  • Output current: up to 180mA continuous @ 25 ºC (pulsed: 400mA, limited by temperature)

Again, thanks for your patience :wink:

footswitch: @Runaway Pancake, I think you meant "Should be able to work. Philips recommended...", but I find this comparison a bit confusing.

What I have written I have written. |500x229