Trying to understand mosfet in battery discharger

For electronics practice I'm building a simple Arduino powered AA battery discharger but I'm seeing behaviour I don't understand.

I made the following circuit: Simple Arduino battery discharger - Album on Imgur

When the mosfet is turned on, everything is fine. I see a voltage drop over R1 pretty similar to the voltage of the battery.

But when the mosfet is turned off, I still see ~0.5v over R1.
Even though, when I measure the resistance between S and D of Q1, I measure between 2.2-2.9Megaohm with my multimeter.

When I put my multimeter in series with the battery and measure current, I also measure ~0.5A, so I'm certain the current is flowing.

For test, I've just removed the Arduino from the circuit to make the following circuit:

I still see the same behaviour.

How come there's 500mA flowing from my battery through R1 and Q1, even though the multimeter measures 2.2-2.9Mohm over this path?

Shouldn't it be more like 1.2V / 2200000 ohm = 0.000000545A?

Hello Erik,
Welcome to the Arduino fora.

++Karma; // For experimenting and trying to understand how stuff works, and for successfully managing to navigate this forums painful image posting system.

You have your MOSFET backwards, well you do if it is actually wired as per your schematic. Source to ground (0V)

Check the voltage on the gate, it should be 0V when off, whatever the battery voltage is when on.

Assuming you mean a single cell AA battery, 1V5, then I think trying to draw 1A5 from it is a bit much! Maybe use a higher value resistor, 20 Ohms perhaps.

I don't recognise the pin designations on whatever device you have, what are they really?

What does PC2 do?

Please post your code.

PerryBebbington:
You have your MOSFET backwards, well you do if it is actually wired as per your schematic. Source to ground (0V)

From the front: 1. Gate. 2. Drain. 3. Source.

I got my common ground (battery - and Arduino GND) on the drain.
Should this be on the source? This sounds counterintuitive to me.

Check the voltage on the gate, it should be 0V when off, whatever the battery voltage is when on.

The voltage on the gate is 0V when off.
The voltage on the gate is 5V when on.

I don't recognise the pin designations on whatever device you have, what are they really?

What does PC2 do?

They didn't have an Arduino Uno block, so I grabbed an ATMega328 block.

PC2 is A2.

Please post your code.

I'm testing with:

int mosfetGatePin = PD2;

void setup() {
  pinMode(mosfetGatePin, OUTPUT);
  Serial.begin(115200);

}

void loop() {
  digitalWrite(mosfetGatePin, LOW);
  Serial.write("LOW\n");
  delay(5000);
  digitalWrite(mosfetGatePin, HIGH);
  Serial.write("HIGH\n");
  delay(5000);
  }

erik-smit:
From the front: 1. Gate. 2. Drain. 3. Source.

I got my common ground (battery - and Arduino GND) on the drain.
Should this be on the source? This sounds counterintuitive to me.

Boom, that's it!

I put the common ground on the source and the resistor on the drain and now it works as expected!

Hi,
What model Arduino are you using?
It is usual in code to use the Arduino pin allocations.

Like A0 and A1 etc.
Digital pins are just 2,3,4,5,6 etc.


PC6 is RESET so how do you aim to use that in your code?
Tom... :slight_smile:

Glad you got it sorted!

Should this be on the source? This sounds counterintuitive to me.

Negative to the source, yes. Remember that electrons flow negative to positive, I have always assumed (but I don't actually know) that's the reason source is negative.

Note that the IRFZ44N is not a logic level FET, which means that with 5V on the gate it won't be fully on. For experimenting like you are doing that maybe won't matter, but for building working projects it will matter as you will find that the MOSFETs in your circuits get hotter than they would if they were logic level. Typically logic level MOSFETs have an L in the part code, for example IRL530.

Also note that the convention for circuit schematics is highest voltage at the top, lowest at the bottom, so +ve supply drawn at the top of the page and -ve or 0V at the bottom. Signals from left to right where possible.

Hi,
Circuit like this.


Tom... :slight_smile:

Thanks for all your great advice, guys!

Wasn't sure whether to take the short route, but crossing A5/A4, or the long route to prevent crossings.


versus

I guess both is fine and the message is clear.

I read about the IRF vs. IRL after I'd already bought this one, but it's fit for this purpose now. It doesn't even get warm to the touch, whereas the power resistor gets nicely toasty.

The schematic is made with DigiKey Scheme-it: Scheme-it | Free Online Schematic and Diagramming Tool | DigiKey Electronics

They don't have a symbol for most Arduinos, so I just grabbed the ATMega328, that's why you see this pin names instead of the Arduino pin names.

I know I should put a current limiting resistor on the gate and also a resistor to pull the gate to ground, but I'm purposely doing it as minimal as possible and in steps, so I can understand everything I'm doing.

The Arduino project uses Eagle for schematics. The other popular, free design tool for schematics is KiCad. I don't know anything about Scheme-it.

Just a hint when using a pull down resistor with a MOSFET that has a series gate resistor do not connect it to the gate. It should always be connected on the source side of the gate resistor. If you put it at the gate you form a voltage divider which reduces the Vgs voltage. It is even worse if you are powering the Arduino from the USB you lose the additional voltage drop of the protection diode. Here is a link to a Ohms Law Calculator, it will work great in calculating your load (discharge) resistor. Ohms Law Calculator

Hi,
The CAD I use here on the forum is ExpressPCB, however and I haven't checked this of late, it does not produce a gerber file if you are designing PCBs.
I use ExpressPCB here because it is quick and clean, making your own component symbols is very easy and each component has 4 or 5 parameter to check, unlike Eagle with its over the top multiple parameter listing, and is capable of in the wrong hands producing a terrifying schematic of junk.

For Schematic and PCB I use EasyEDA CAD that makes small projects very easy to realise.

Tom.... :slight_smile:

PerryBebbington:
Negative to the source, yes. Remember that electrons flow negative to positive, I have always assumed (but I don't actually know) that's the reason source is negative.

That's definitely not the reason, as in case of a p-MOSFET the source goes to the positive side.

I do know that the source connection is where the power comes from... that's negative power supply for an n-MOS, the positive power supply for a p-MOS. That's maybe the easiest way to remember.

That's definitely not the reason, as in case of a p-MOSFET the source goes to the positive side.

Good point! :slight_smile:

The source provide carriers to flow into the channel, they flow through the chain and out to the drain,
hence the names. The electric field due to voltage on the gate is what forms/controls the channel.

With an n-channel MOSFET the carriers are electrons, with p-channel they are holes.

Power MOSFETS are very asymmetrical between source and drain, the drain being the underside of the
die, and the layered structure means there is also an integral "body" diode as part of the structure.

The tiny MOSFETs that make up logic circuits in CMOS chips are symmetrical, so the source and drain
are identical in behaviour - you'll see the symbol for them is different to power MOSFET symbol as
a consequence.

@MarkT
++Karma; // Thanks for the explanation :slight_smile:

gilshultz:
Just a hint when using a pull down resistor with a MOSFET that has a series gate resistor do not connect it to the gate. It should always be connected on the source side of the gate resistor. If you put it at the gate you form a voltage divider which reduces the Vgs voltage.

Do I understand your comment correctly?

Yes - but in reality it doesn't really matter, as the difference in voltage at the gate between the two is just 0.224V (at 5V signal).

MarkT:
Power MOSFETS are very asymmetrical between source and drain, the drain being the underside of the
die, and the layered structure means there is also an integral "body" diode as part of the structure.

The tiny MOSFETs that make up logic circuits in CMOS chips are symmetrical, so the source and drain
are identical in behaviour - you'll see the symbol for them is different to power MOSFET symbol as
a consequence.

I believe the body diode is not the result of different geometry or something like that. In discrete MOSFET the substrate is connected to the source which forms the diode. In an IC the substrate is connected to the most negative (positive) voltage, drain voltage can "never" be higher (lower) than the substrate voltage and so diode is not activated.