Electrical – Turning off external sensors with Arduino: MOSFET vs I/O pin

low-powermosfetsensor

For a project, I made an environmental sensor system, consisting of an Arduino Pro Mini 5V (with ATmega328P microcontroller), a data logger module and three sensors.

To save power between data logs I used several techniques I read about online, including turning off the power to the sensors using a MOSFET (I used the IRLB8721PbF).

Recently, I started reading a bit more about MOSFET's and turning off external devices with Arduino's, and I realized that since my sensors only use about 4mA, I could have used the a I/O pin (set to output) on the Arduino instead.

As I was curious to see if there were any difference in current draw between the two methods, I tested the current draw when using the MOSFET vs when using the I/O pin to turn the sensors on. When using the MOSFET, the current draw increased with 4 mA when the sensors are turned on, corresponding to the sensor draw. However (!) when using the I/O pin the current draw first shortly increased with 6 mA, after which it settled at a 4 mA increase. These differences would suggest that it is more power efficient to use a MOSFET, even with low current draw apllications.

Now my question is (1) why do I see this short spike to 6 mA increase in current draw when using the I/O pin to power on the sensors? (2) And is it more preferable to use a MOSFET even with low current draw applications and why?

Another thing related to this: I recently read that a resistor in series with the gate is necessary when using a MOSFET, however I have been using the MOSFET for my application without a resistor and I have had no problems whatsoever for more than 6 months and counting. (3) Could someone explain why it has been working fine for my application? Does it have something to do with the fact I use the MOSFET to switch a low current draw load? Or does it have something to do with the type of MOSFET I am using (the IRLB8721PbF).

Lot's of questions, I'm kinda new to electronics…

Thanks in advance for taking the time to answer!

Best Answer

The way you powered your sensors is exactly correct, using an external FET to switch the supply.
I'd almost bet that the difference you see in the current is due to some capacitance in the sensors.

In both situations I am assuming you actually use an I/O pin on the Arduino:

  1. Using the external FET you are driving the FET gate from the Arduino pin. The gate does have some capacitance, but you'd be hard pressed to show the voltage rise on the pin without an Oscilloscope, and even more challenged to accurately measure the current from the I/O pin in charging the gate. This gate capacitance is why you see the series resistor added from the I/O pin to the gate ….to limit the maximum current drawn (you sacrifice turn on time). When the FET turns on, it is capable of delivering much more current from the VCC supply than the I/O pin, so charges the sensor capacitors very much more rapidly. The high current (it may actually be 10-100mA) during which the sensors supply voltage increases will be very short. Without an Oscilloscope you will never see this effect.

  2. When powering sensors directly from the I/O pin you have to directly charge any capacitors in the sensors (could be anything from 0.1-100uf depending on the sensor) via the I/O pin. To charge this capacitance you have to draw a lot of current from the I/O pin. The I/O pin exceeds its current rating and the voltage drops, which simply increases the time taken to charge the sensors capacitors.
    This allows you to see the current flow for much longer, and it's easier to see on a multimeter (I assume this is what you did).

Powering sensors directly from the I/O pins might in the extreme pop the fuse for that I/O block in the MCU. I'd advise against it unless you really understand your sensor circuitry.

For very low current functions such as a real time clock, you will see them controlled directly from an I/O pin. Again, providing you know exactly what the function/sensor circuit is you are taking a risk.

Update:

You don't describe your sensors in any detail, but the capacitance I'm talking about is that which would be used on the supply line:

schematic

simulate this circuit – Schematic created using CircuitLab