How to Use a Low Power MOSFET for Raspberry Pi Power Cycling

Published By

We previously explored powering a Raspberry Pi via solar energy, as well as how such a system can be cycled on and off with a relay to conserve electricity. While this can result in substantial power savings — especially when there’s a long time between actions that the Pi needs to take — one drawback is that just holding the relay on requires around 70mA, compared to the Pi itself, which runs at roughly 130mA. The system also consumes around 5mA when off — more than you’d expect from just the power-efficient ATtiny85 “sleep coprocessor” alone.

MOSFET for Power Efficiency

Is there a better solution? While it’s hard to beat the simple operation of a magnetically operated switch — i.e. a relay — using a solid-state device like a low power MOSFET transistor can allow you to cut your usage even further.

To test this, I chose an FQP30N0L MOSFET. This particular component has a maximum gate threshold voltage of 2.5V, making it fully switchable via an Arduino, ATtiny85 or other such devices. The drain-source breakdown voltage is a minimum of 60V, and it can handle a continuous current draw of 22.6A, both well above the needs of the Pi Zero W (or any Pi, for that matter). Despite this excellent performance, they’re still available, as of this writing, meaning a substantial cost savings over the relay module used previously.

MOSFET Switch

Low Power MOSFET for Raspberry Pi Image 2

To control power with this MOSFET, the path to ground is switched on and off, not the positive line (as was the case with the relay implementation). Here, the USB positive going to the Pi is connected to the 5V bus, while the negative connects to the MOSFET’s gate pin. The MOSFET source is connected to the ground bus, while the gate is connected to the ATtiny85’s output pin.

Results

This new setup resulted in significant power savings when compared to using a relay:

·      136 mA total current draw with Pi Zero W on, including extra LED

·      2.75 mA with Pi off

·      Savings over Pi/Relay on (200mA) condition: 64mA

This comes out to a roughly 32 percent drop in power (when on) over the relay setup, and around a 2mA — or 40 percent — drop when off. Regardless of how long your Pi’s power cycle is, this represents a huge increase in performance. For low-power applications, it pays to consider your switching hardware. Otherwise you’ll have to pay in the form of a larger solar panel and/or battery equipment.

Power Cycle Code

Low Power MOSFET for Raspberry Pi Image 1

I used the same code as in the earlier experiment, but when testing over several hours, I found that the ATtiny85 eventually stopped cycling properly. It’s possible there was an issue with the long delay() function, so the new code instead uses millis()for timing. Using millis() is generally considered good programming practice, though it does roll over after about 50 days. This may or may not be an issue, but should be considered for projects with an extremely long time span.

Raspberry Pi code, as well as both versions of the ATtiny85 shutdown code are available here on GitHub. Note that application of current measurement equipment during testing resulted in a small voltage drop. A 2200µF capacitor was applied during evaluation to help compensate.

Overstock AV Page Footer 560x140 2 1 1

Latest News

Sorry, your filter selection returned no results.

We've updated our privacy policy. Please take a moment to review these changes. By clicking I Agree to Arrow Electronics Terms Of Use  and have read and understand the Privacy Policy and Cookie Policy.

Our website places cookies on your device to improve your experience and to improve our site. Read more about the cookies we use and how to disable them here. Cookies and tracking technologies may be used for marketing purposes.
By clicking “Accept”, you are consenting to placement of cookies on your device and to our use of tracking technologies. Click “Read More” below for more information and instructions on how to disable cookies and tracking technologies. While acceptance of cookies and tracking technologies is voluntary, disabling them may result in the website not working properly, and certain advertisements may be less relevant to you.
We respect your privacy. Read our privacy policy here