PMOS in parallel with NMOS

Let's say I have a microcontroller pin that will have one of three states: 5 V, 0 V or high impedence.

Let's say I have a PMOS and an NMOS, and I connect their gates together. I connect the microcontoller pin to the gates.

Now, when my pin is high, the NMOS will turn on. When the pin is low, the PMOS will turn on.

What will happen though when I set the pin to high impedence? I'm hoping that neither transistor will be on, but I'm concerned that maybe there might be some sort of voltage on the microcontroller pin (it might be behind a large resistance, but it's still a voltage) that will switch one of them on.

In my current design, I'm using bi-polar transistors, and it works great. I'm thinking of switching to MOSFET's though because they let current flow in both directions.

The MOSFET's will be used to turn on LED's.

Reply to
Tomás Ó hÉilidhe
Loading thread data ...

That won't work. There will be some voltage leaking from the high impedance device, and exactly what that is, and how much current there is, will dictate exactly what the two drive transistors are going to do.

What are you trying to do? Build a high output tristate device? Are you trying to drive a multi-color LED or something?

Reply to
robertwessel2

With the PIC microcontroller, if you put a volt meter across a high impedence pin, I think you measure about 3 V. Of course, it's behind a massive resistance, but I think that 3 V might be enough to turn on an NMOS transistor.

I have a bi-colour LED that has 3 pins. Within the LED package there are two LED's, and they have a common cathode. Their anodes are separate.

When my microcontroller pin is high, I want it to be green. When low, red. When high impedence, off.

To do this, I want to use a p-type and a n-type transistor that have a common gate/base. When the microcontroller pin is high, the n-type transistor will be turned on and it will put five volts onto the red anode. When the microcontroller pin is low, the p-type transistor will be turned on and it will put five volts onto the green anode.

I might end up doing it with bi-polars instead of mosfets...

Reply to
Tomás Ó hÉilidhe

e

Add a pulldown to the input of the nFET and a pullup to the input of the pFET, and a couple of diodes to prevent wrong way current flow. You will get leakage current around that. so if you have a tight power budget that may be a problem.

OTOH, since you're basically using current as a control signal, there's more than a bit to be said for using current mode devices to drive the LEDs.

Or just use two pins.

Reply to
robertwessel2

Oh, and that's a *tri* colored LED (two LED's in a package, three pins). A *bi* color LED has two LEDs in one package connected in parallel, but in opposite directions, and so has only two pins. In the later case you can only get one of the two LEDs to light at a time (the current flowing forwards or backwards through the device). In the former you get three colors, since you can drive both LEDs at the same time to get a third color (IOW it's red if you power one LED, green if you power the other, or yellow if you turn on both).

If you're using bi-color LEDs, here are a few circuits (with different tradeoffs) for driving them off a single pin device (although you'll have to add more current handling ability if I'm understanding your application).

formatting link

Reply to
robertwessel2

Your idea won't work with bi-polar transistors. They turn on at 0.7 volts on the base. There is no voltage you can use that will turn them both off. You *can* however turn them both ON!

I don't think you will get this to work well with 5 volt drive, but you might. It depends on the characteristic of the MOSFETs. You need parts that have a threshold voltage that is *much* higher than 2.5 volts. All you need to do is use two resistors to bias the gates to

2.5 volts when the MCU is not driving the circuit. By leaving it tristated, you are not controlling the voltage at all and the gates will float which can be up or down or somewhere in the middle.

There is an easier way. Use an LED that has 4 pins and a 3.3 volt supply. You can put the two LEDs in series, across the power with neither of them turning on. Use a current limiting resistor from the middle connection to the MCU pin. The MCU can pull up to turn one on, down to turn the other on or tristate to let the voltage float with both LEDs off. To make this work with 5 volts, you need LEDs that have a forward voltage much higher than 2.5 volts.

Reply to
rickman

I put 5 V on the base and 0 V on the emitter for the NPN. I put 0 V on the base and 5 V on the emitter for the PNP.

I set the microcontroller pin as an input, this will turn them both off. (I've already tested it and it works) :-D

Reply to
Tomás Ó hÉilidhe

I have no idea what you are talking about. Does your circuit only consist of the transistors and a power supply??? What you have just described will blow the transistors. The B-E junction will only support about 0.7 volts. Trying to put 5 volts on this junction will burn up the transistor.

Ok, maybe it does if you use the transistors in a follower configuration. But the forward voltage spec of the LEDs is loose enough (depending on the exact model you choose) that you can't guarantee they will be off in all situations. What you are really doing is using the B-E junction as a diode for the voltage drop... which is what someone told you to do. Can you explain how your circuit works??? Do you understand it???

You consistently ignore principles of of good design and jury rig things. I don't know if you are learning anything or not. Or are you trying to learn every method that you shouldn't use?

Reply to
rickman

Of course normally one puts a resistor on the base of a bi-polar transistor in order to limit the base current, but because the transistor is being used to power a multiplexed LED with a one sixteenth duty cycle, I tried taking out the resistor and it worked. If I increase the duty cycle though, the microcontroller dies. Perhaps it's the output capacitance of the microcontroller pin that prevents the current from rising too high before the display multiplexer moves on to the next LED.. ?

Reply to
Tomás Ó hÉilidhe

If you put your hand on top of the stove at 1/16 duty cycle, it still works. There might be minor burns or damages short term or long term, but you can still use your hand. Would you please try it for a few hours? Just don't to talk on the phone at the same time.

Reply to
linnix

... snip ...

Just think about it. The voltage on the gate controls the conductance. This is called transconductance, and is characterized by the GM. That specified dI/dV at some point. However there is a specified gate voltage for full turn-on, and another for full turn-off. Connect two gates together and they are at the same voltage. They are high-Z inputs, so that voltage depends on leakage paths when not driven. If Vcc is less than the sum of the minimum Vons both can turn off, but there is no guarantee that is so. If Vcc is higher the odds are that both will turn on, producing a short, and destroying at least one.

Read the data sheets. Think about the basic way FETs are controlled.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.


** Posted from http://www.teranews.com **
Reply to
CBFalconer

And remember too that the microcontroller that has its output floating has more than likely got inputs on that pin which are suffering the same fate of both the hi and lo inputs turning on. Rocky

Reply to
Rocky

Spice is your friend, or you can look at this data sheet:

formatting link

It shows P/N fet interaction with input swing quite nicely.

-jg

Reply to
Jim Granville

'Working' and 'properly engineered' are two quite different things.

Yikes! Precisely proves my point. Did this not worry you just a little ? Did this not suggest that there could be some flaw in your thinking ?

and perhaps not..... [I have heard of this before with PIC devices, and incorrect design assumptions ]

Read the data sheet, it gives maximum ratings for a reason.

Learn to design things properly, "I tried taking out the resistor and it worked" will not cut it. Imagine that approach in Civil Engineering ?!

-jg

Reply to
Jim Granville

This works, because bipolars are current driven devices. When you put the MCU into tri-state, the only source of base current would be the collector to base leakage of the opposite bipolar transistor (which might be considerable at high temperatures).

MOS devices are voltage driven, so that simple approach does not work. You really need to use two output pins on the MCU to separately control the NMOS and PMOS device, if you want also a high impedance state.

Paul

Reply to
Paul Keinanen

Before I bother to address the design issues you present, I want you to go back and reread the last couple of messages you posted and tell me exactly what circuit you have described. I only see described a pair of transistors with their B-E junctions connected directly to the power supply. I have no idea if you are talking about an emitter follower configuration or a common emitter configuration.

Either circuit has current gain as the transistor provides. So I have no idea how the MCU can limit the current in the LED. More likely the LED current is limited by the gain of the transistor. However, if you think the output capacitance of the MCU pin is limited the current to the transistor, whew! you have a lot to learn. BTW, what is the speed of your multiplexing? Is it above 100 MHz? The rise time of a typical I/O pin on an MCU is on the order of a few ns. So the multiplexer would have to be running seriously fast for the output capacitance to have any effect on it.

Have you tried reading some books on embedded system design? Or are you planning to learn it all on your own from first principles?

If you go back to the MOSFET parts, this circuit will work ok. The gate does not need current drive. When the MCU is not driving the gates can be pulled to the mid voltage point with a pair of resistors and you can pick MOSFETs with high enough threshold voltage that there will be no chance of either LED being on, as long as you use an emitter follower circuit. You do still need a current limiting resistor in the drain leg.

If you think all of this is unneeded, then please explain why the MCU I/O pin burned out when the LED didn't have a current limiting resistor? And no BS. Either figure it out so that you understand it and can explain it, or don't bother replying. The MCU is not burning out why you think it is.

Reply to
rickman

Decaff rickman, decaff. Tom=E1s is at least asking questions. I agree that a bit more thought about forward voltage drop etc. is in order. See the thread "Clock and Asynchronous Reset with just one pin". Tom=E1s would also be advised to study OHM's law. Rocky

Reply to
Rocky

I am trying to get him to see that he is ignoring a lot of principles of engineering. He doesn't seem to care about actually understanding how or why the circuit works, just that it works on his bench for a day. His latest thread talks about multiplexing LEDs with a 200:1 duty cycle. I guess he is going to pump 4 Amps into the LED for one microsecond to give the same light as 20 mA continuously.

Tom=E1s!!! Try learning something about what you are doing! You are just kludging a circuit that doesn't fail in the brief time you are testing. This is not at all the same as designing a circuit that works. One of the basic principles of engineering is that you *can't* prove that something works by testing it.

Reply to
rickman

Sci.electronics.basic is the place for this type of questions.

And large and small signal transistor models, basic semiconductor theories, etc. Isn't that what he is in college for?

You forgot the keyboards and other stuffs. He want to drive everything in one pin. I guess later on he will patent it, so if by any chance somebody else try to market it. He will sue.

Agree, you can only prove something doesn't work by testing.

Reply to
linnix

Is 72 hours long enough? I've left it on for three days straight. No problems.

Reply to
Tomás Ó hÉilidhe

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.