P-channel MOSFET switching

Thread Starter

sean1553

Joined Oct 27, 2015
11
We were using Arduino in college as part of a mechanical engineering course and I had the idea of building a homemade quickshifter for a motorcycle. I'm trying to build a circuit that will cut the ignition using a P-channel MOSFET. I had no real experience with electronics before this so I've spent a lot of time reading, researching, etc. I know it can be done as I've seen a similar project online but the details were a bit vague.

So far I've built a circuit on a breadboard using a 100v p-channel to switch the 12v supply and the gate is connected to a NPN transistor, which is being switched by Arduino. I'm using a car headlight bulb at the moment instead of the ignition system so I don't damage anything important.

When I connect it all up, the MOSFET conducts and the bulb lights up whether the Arduino pin is high or low. What is my problem? I'm not exactly sure of the theory behind the resistor selection, I'm just going by other circuits I've found online. The MOSFET also heats up very fast so I can only leave it on for a few seconds. I suppose this is to be expected using such a high current and no heatsink for the MOSFET??

I've attached a diagram of the circuit. Apologies if it's a bit crap as I've never had to draw one before...

schemeit-project.png
 

shortbus

Joined Sep 30, 2009
10,045
Your showing a "high side" switch, is there a reason for this? An N mosfet and putting it between the ignition and ground wold be a "low side" switch and the more normal way of doing something like this. Almost all of the devices in a car that are controlled by the computer/ECM are done with a low side switch. There are many more options for N mosfets than P mosfets, value wise also.
 

Thread Starter

sean1553

Joined Oct 27, 2015
11
Your showing a "high side" switch, is there a reason for this? An N mosfet and putting it between the ignition and ground wold be a "low side" switch and the more normal way of doing something like this. Almost all of the devices in a car that are controlled by the computer/ECM are done with a low side switch.
Well mainly because the only similar project I could find used a p channel so I know it works. I was thinking the only common wire to the coils would be positive anyway and that's why they did this? To be honest I didn't give this part of it much thought as their project was on a nearly identical bike and his had a lot of extra features that were pretty complicated so they must have a genuine reason for using the p channel.

I wanted to get the circuit working on a breadboard myself before concentrating on the bikes electrics
 

TheButtonThief

Joined Feb 26, 2011
237
I think you're representing the Arduino with a battery, this is a little confusing as it suggests there is a constant source of current at the base of your transistor. Also, you won't need the transistor, MOSFET's are voltage driven, not current driven and so there's no need for any current limiting resistor or intermediate switching (unless inverted logic is concerned).

The reason why you're light is always on in this case (despite weather the transistor is in saturation or not) is because of that 1k resistor at the gate of the MOSFET, it's connected to positive, pulling the gate high. Also, it's an "enhancement" MOSFET, if you want the lamp to be off when the gate is high, you'll need an attenuation MOSFET. Or, of course, you could use the same MOSFET but program your micro to send a low signal to the output in order to get a high output from the MOSFET (inverted logic).

Just simply connect the gate straight to the output of the Arduino. Hope this helps
 

dl324

Joined Mar 30, 2015
16,839
When I connect it all up, the MOSFET conducts and the bulb lights up whether the Arduino pin is high or low. What is my problem?
My guess is that you have the MOSFET wired wrong; source and drain reversed so you're always conducting through the body diode.

Post voltage measurements of the collector with the bipolar transistor on and off.
 

dl324

Joined Mar 30, 2015
16,839
The reason why you're light is always on in this case (despite weather the transistor is in saturation or not) is because of that 1k resistor at the gate of the MOSFET, it's connected to positive, pulling the gate high.
A P channel enhancement mode MOSFET will be off when Vgs=0.
Also, it's an "enhancement" MOSFET, if you want the lamp to be off when the gate is high, you'll need an attenuation MOSFET.
AFAIK, there's only enhancement or depletion mode. Never heard of attenuation mode...
 

Thread Starter

sean1553

Joined Oct 27, 2015
11
Your PMOS is upside down. Connect PMOS source to VCC and drain to the load.
Just noticed this after I had the circuit drawn. Source is connected to the 12v supply IIRC. I'll check over the circuit again after work and see if I have everything connected the right way round
 

dl324

Joined Mar 30, 2015
16,839
I've attached a diagram of the circuit. Apologies if it's a bit crap as I've never had to draw one before...
Not bad, considering it's your first.

It's generally preferable to have the "flow" be left-to-right and top-to-bottom. If you make the gate resistor vertical, move the 12V supply to the left (and make it upright), remove unnecessary wire jogs, and minimize white space; you're a pro...

EDIT: And make the 5V battery vertical and be consistent with connection dots. It used to be that only crossing wires that were connected were "dotted". Now the convention seems to be dotting any connection of more than 2 wires...
 
Last edited:

Thread Starter

sean1553

Joined Oct 27, 2015
11
My guess is that you have the MOSFET wired wrong; source and drain reversed so you're always conducting through the body diode.

Post voltage measurements of the collector with the bipolar transistor on and off.
I rewired the whole thing and it still doesn't turn off if I connect the base of the NPN to Arduino 5v (through the 1k resistor). With the 5v disconnected I get 5.7v at the collector of the transistor and this drops to about 2v when connected.
 

dl324

Joined Mar 30, 2015
16,839
With the 5v disconnected I get 5.7v at the collector of the transistor and this drops to about 4v when connected.
With 5V applied to the base of the NPN transistor through a 1K resistor, it should be saturated and the collector should be near 0V. That should turn on the MOSFET and the light.
 

Thread Starter

sean1553

Joined Oct 27, 2015
11
The light and mosfet are always on. It's a P-channel. Should they not turn off when I apply 5v to the base for or am I getting really confused now? :confused:
 

dl324

Joined Mar 30, 2015
16,839
With oV on the base of the transistor, the PMOS device should have 12V on the gate and be off. What voltages do you measure on the gate and drain of the MOSFET when it should be off?
 

dl324

Joined Mar 30, 2015
16,839
Remove the NPN transistor from the circuit and see if MOSFET turns off.

You're certain the MOSFET is wired correctly? Measure the voltage on the drain and source before removing the transistor.
 

Thread Starter

sean1553

Joined Oct 27, 2015
11
I found another transistor, the same as I have been using here, swapped them out and it works perfectly now. The old one must have been faulty or else I damaged it. Valuable lesson learned here!! Thanks for the help dl324, its tough being a beginner!!
 

dl324

Joined Mar 30, 2015
16,839
I found another transistor, the same as I have been using here, swapped them out and it works perfectly now. The old one must have been faulty or else I damaged it. Valuable lesson learned here!! Thanks for the help dl324, its tough being a beginner!!
Glad you figured it out. Are you practicing safe handling procedures? MOSFETs are static sensitive. Even if devices include protection, it's best to not put it to the test. IIRC, testing is only done to a few thousand volts. You can generate more than that under some conditions...
 

Thread Starter

sean1553

Joined Oct 27, 2015
11
Glad you figured it out. Are you practicing safe handling procedures? MOSFETs are static sensitive. Even if devices include protection, it's best to not put it to the test. IIRC, testing is only done to a few thousand volts. You can generate more than that under some conditions...
No I'm not really geared up for dealing with electronics to be honest. Is there any diy method of preventing static damage? I had read warnings about damaging MOSFETs all right but it was actually the NPN that was the problem.

Now I've got to figure out how to get all these wires and the MOSFET hooked up in a reliable and safe package that won't vibrate itself to pieces once I start the bike. It's a steep learning curve when you have zero experience!!
 
Top