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

Publicado por

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

Últimas noticias

Lo sentimos, pero su selección de filtros no devolvió resultados.

Hemos actualizado nuestra política de privacidad. Por favor tome un momento para revisar estos cambios. Al hacer clic en Acepto, usted está de acuerdo con la Politica de Privacidad de Arrow Electronics y sus condiciones de uso.

Nuestro sitio Web coloca cookies en su dispositivo para mejorar su experiencia y nuestro sitio. Lea más sobre las cookies que utilizamos y cómo desactivarlas aquió. Es posible que se utilicen las cookies y tecnologías de seguimiento con fines de marketing.
Al hacer clic en "Aceptar", usted está consintiendo la colocación de cookies en su dispositivo y el uso de tecnologías de seguimiento. Haga clic en "Leer más" a continuación para obtener más información e instrucciones sobre cómo desactivar las cookies y tecnologías de seguimiento. Si bien la aceptación de cookies y tecnologías de seguimiento es voluntaria, la desactivación de estos puede resultar en que el sitio web no funcione correctamente, y es posible que ciertos anuncios sean menos relevantes para usted.
Respetamos su privacidad. Lea nuestra política de privacidad aquió