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

Publié par

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

Actualité

Sorry, your filter selection returned no results.

Nous avons mis à jour notre politique de confidentialité. Prenez un moment pour lire les changements. En cliquant sur "J'accepte", vous acceptez la clause de confidentialité d'Arrow Electronics ainsi que les conditions d'utilisation.

Notre site Internet place des cookies sur votre appareil pour améliorer votre expérience et pour améliorer notre site. Pour en savoir plus sur les cookies que nous utilisons et la façon de les désactiver, cliquez ici. Des cookies et des technologies de suivi peuvent être utilisés à des fins de marketing. En cliquant sur « Accepter », vous consentez au placement de cookies sur votre appareil et à notre utilisation de technologies de suivi. Cliquez sur « En savoir plus » pour de plus amples informations et instructions sur la façon de désactiver les cookies et les technologies de suivi. Même si l'acceptation des cookies et technologies de suivi est volontaire, leur désactivation peut entraîner un mauvais fonctionnement du site Internet et certaines publicités peuvent être moins pertinentes pour vous. Nous respectons votre confidentialité. Lisez notre politique de confidentialité ici.