P-Channel mosfet controlling car 12v light

I would like to control a 12v light in a car. (grounded on one side) will this circuit work?

Thanks

Swap over the source and drain an it will.

You can see the diode pointing forwards on the P-channel, so yeah, swap that around. Also, I think the 10 kOhm pull-up is a bit weak. It will make the P-channel switch slowly, and if it's weak and/or the load is heavy, it might overheat. Also, the transistor and base current limiting resistor are not needed. A 500 Ohm or 1 kOhm resistor from the Arduino to the gate of the MOSFET is all you need if you're using an N-channel that switches on the bottom -- that will be a lot more efficient. If you still need a P-channel, then use a 500 Ohm or 1 kOhm resistor into the gate of a small-signal N-channel MOSFET (like the BS170) and a 1-2 kOhm pull-up, instead of the BJT NPN you're using.

So, what I would do, assuming the grounding of the lamp is not interruptible or reversible to power (so, must use P-channel): 500 Ohm resistor from Arduino to gate of BS170. BS170 source to ground, BS170 drain to P-channel gate and 2 kOhm pull-up to 12V. P-channel source to 12V. P-channel drain to light.

The way car bulbs are wired is one side to the grounded chassis, so that only one wire needs to be run to the light, so high-side switching is mandatory - that circuit (with source and drain swapped) is OK unless you want to PWM the light, where the weak-pullup will start to be an issue (by causing slow switching).

You do need to ensure the p-channel device has a low enough on-resistance for the load in question. Aim for no more than 0.25V across the device when on (IR), and less than 0.5W dissipation (I^2 R) if poss - otherwise a heatsink becomes needed.

So if I use an N-channel the circuit would look like this?

No, again it is backwards - look at the diode inside the FET.

Also, N-Channel is better for low-side switching. I would stick to the P-Channel and keep the NPN.

One addition I would recommend is a 10K? pull-down resistor between the base of the NPN and ground. This will force the NPN to be OFF when the input is floating, which it will be before you to a pinMode(xx,OUTPUT); on the relevant IO pin.

kajmaya: So if I use an N-channel the circuit would look like this?

No - the simple rule is drain always connects to load, n-channel switches on low-side, p-channel on high-side (for a positive supply rail).

Also, the transistor and base current limiting resistor are not needed. A 500 Ohm or 1 kOhm resistor from the Arduino to the gate of the MOSFET is all you need if you're using an N-channel that switches on the bottom

Yes but he is not he is using a P channel FET so that transistor IS needed to ensure the FET can turn off. What was it about

Swap over the source and drain

That is puzzling you? You still have not done it.

the simple rule is drain always connects to load

Simple rules are generally wrong. There are cases where you may want to switch a load on source/emitter.

There are cases where you may want to switch a load on source/emitter.

And do we know why we generally do not oh dear Henry?

I'll give you a clue, we are switching a 12V load with a 5V signal. Ring any bells? Light any lights?

Grumpy_Mike:

Also, the transistor and base current limiting resistor are not needed. A 500 Ohm or 1 kOhm resistor from the Arduino to the gate of the MOSFET is all you need if you're using an N-channel that switches on the bottom

Yes but he is not he is using a P channel FET so that transistor IS needed to ensure the FET can turn off. What was it about

Swap over the source and drain

That is puzzling you? You still have not done it.

Oh, yea (S=source) oops. i'm not thinking. So is this correct for an N-channel MOSFET? I changed the resistor as well. (I omitted the Diodes inside the fet for faster drawing on my side)

There needs to be a pull-up or your mosfet will never turn off the lamp.

Take one of your earlier schematic and just swap out drain and source.

dhenry: There needs to be a pull-up or your mosfet will never turn off the lamp.

Take one of your earlier schematic and just swap out drain and source.

I thought with an "N" you didn't need the pull-up. But the "P" you do. I changed to the "N" MOSFET because of "jwatte" suggestion and did the switch at the bottom. Otherwise I will swap the "D" and "S" and go with my original post the "P-channel MOSFET". Im starting to get a bit confused.

I would rather go the "N" route as I have very little board space.

What do you think?

Here's what a few have tried to get you to do, note the difference in the FET's Source and Drain

I would rather go the "N" route as I have very little board space.

You will have to place that between the lamp and Ground (chassis). How will you do that?

Yes I understand

Thanks

You can switch from the low side with a n channel mosfet or even switch from the high side with a n channel mosfet (not very efficient).

The issue of chassis polarity (whether it is grounded positive or negative) does come into play, particularly that your fixture isn't coorporating: for example of the low side is grounded to the chassis at the fixture.

But if you are ok with your own fixture, that's not a limiting factor.

dhenry: You can switch from the low side with a n channel mosfet or even switch from the high side with a n channel mosfet (not very efficient).

The issue of chassis polarity (whether it is grounded positive or negative) does come into play, particularly that your fixture isn't coorporating: for example of the low side is grounded to the chassis at the fixture.

But if you are ok with your own fixture, that's not a limiting factor.

Are you saying (The vehicle being a negative ground) if I ground my device/board the N low side switch will work efficiently? That would great. I could save a transistor. I know it doesn't sound like a big real estate savings. But this circuit is duplicated 5 times.

work efficently?

You can only use an N-Channel efficiently if you can place the MOSFET between the light and the ground.

In a negative chassis car, you can't do that.

If you use an N channel, you will be using it incorrectly as a high side switch.

Stick with the P-channel, and use the NPN transistor. They're only small (the ones I work with are about 2mm x 1mm - SOT-23 surface mount). Even in a TO-92 they don't take up much space.

Are you saying

If your vehicle is ground negatively, and the fixture couldn't be changed, using a n-channel to switch on the high side will not be efficient.

That, obviously, may not be a problem if you aren't switching much current. And that could be a huge problem if you are switching a lot of current.

This is without a doubt the most confusing and confused thread I have ever seen.

What people should have done is point you [OP] towards some diagrams that show the proper circuit in the first place. Eg, see ckt diagram in the section "Prevent Electrostatic Damage". Note where the S and D pins of the n-channel MOSFET are connected. D1,D2 are not strictly required, but give extra protection [probably good to use in a car environment].

http://www.softwareforeducation.com/wikileki/index.php?title=MOSFET_Switch

You can only use an N-Channel efficiently if you can place the MOSFET between the light and the ground.

In a negative chassis car, you can't do that.

The 1st statement here is in line with the diagram cited. I'm not sure what the 2nd statement here means, because in general, it's easiest to work with ckts which have a common "negative" ground [ie battery negative is the ground buss], and ALL devices including Arduino and MOSFET ckt would be tied to this negative ground.

Eveything else on this thread, I find totally confusing.