Battery-Powered Operation Environment for Raspberry Pi Pico - Part 1

Friday, August 27, 2021

Raspberry Pi Pico

t f B! P L

I created a battery-powered operation environment for the Raspberry Pi Pico. It implements simple yet integrated power management covering standby, normal operation, DeepSleep, shutdown, and charging states, combined with external circuits using only commonly available components.

Raspberry Pi Pico battery-powered environment

Battery Operation Features of the Raspberry Pi Pico

Before explaining the battery operation environment, the Raspberry Pi Pico has battery operation support features not typically found on standard microcontroller boards. These will be fully utilized.

Step-Up/Step-Down DC/DC Converter

RICHTEK RT6150B-33GQW

Typical boards use a step-down DC/DC or LDO from USB 5V to 3.3V. However, for Li-po batteries, the voltage ranges from 4.2V (full) to ~2.9V (near depletion), requiring a step-up/step-down DC/DC converter to generate 3.3V. The Raspberry Pi Pico features RICHTEK'sRT6150B-33GQW, supporting 1.8V-5.5V input and up to 800mA output, powering both the Pico and peripheral circuits. The following features are also supported on the Raspberry Pi Pico board in conjunction with this DC/DC converter, and are very useful for battery operation.

  • DC/DC EN Control via Pin 37 3V3_EN
 
DC/DC EN Control

When 3V3_EN is unconnected, DC/DC is always enabled via pull-up.

  • DC/DC PS Setting via GPIO23
 
DC/DC PS Setting

PS=0: efficiency-priority (PFM), PS=1: ripple reduction (PWM, less efficient at low load). Default PS=0.

USB Power Connection Detection

USB Power Detection

GPIO24 input: High=USB connected, Low=USB disconnected.

Battery Charger Connection Support

Battery Charger Connection

pico-datasheet.pdf Referring to the Using a Battery Charger section, a battery charger connection example is shown. By connecting a P-ch MOSFET as shown, battery power is used when USB is disconnected, and USB power supplies the DC/DC converter while charging when connected. The parts shown in red are not implemented on the Raspberry Pi Pico board and require additional circuitry. This section uses the P-ch MOSFET differently from a typical high-side switch, which is instructive, so I will comment on it separately in the circuit diagram section.

Voltage Detection

VSYS Detection

Power supply voltage can be detected using GPIO29_ADC3. The VSYS voltage is measured by ADC; with the charger connected, it reads USB or battery voltage accordingly. While voltage thresholds (e.g., >4.3V=USB, <4.3V=battery) could be used, the threshold requires careful consideration, so GPIO24 detection is simpler and more reliable. The ADC3 input uses a 200K/100K resistor divider from VSYS, which has two drawbacks: (1) small but constant current draw (<15uA), and (2) high output impedance to the ADC causing potential measurement error. For more accurate measurement without constant current draw, an active circuit measuring only when needed is an option, but the Raspberry Pi Pico's built-in method is sufficient for approximate voltage measurement.

DeepSleep Feature

Transition to dormant state is provided in pico-extras'pico_sleep. It effectively minimizes power while keeping RP2040 ON. CPU enters dormant state but GPIO states are maintained. Wake-up supports GPIO level (High/Low) or edge detection (rising/falling). The SDK supports dormant transition and wake-up condition setup, but restoring the pre-dormant state (e.g., clock settings, PWM, timer interrupts) requires custom procedures.

Overall Power Management Architecture

Requirements

The following functional requirements were considered.

  1. Provide a standby state with DC/DC OFF
  2. Power states controllable using one or two switches
  3. Support DeepSleep using RP2040's dormant mode
  4. DeepSleep/standby transitions fully under program control
  5. In DeepSleep, DC/DC stays ON but peripheral power can be OFF
  6. Monitor battery; enter standby below threshold
  7. Keep DC/DC ON when USB connected (for programming)
  8. Display status on OLED for verification

Power State Transitions

The following power states are prepared. Transitions are as implemented in the sample; different modes possible by changing conditions.
Power State Transition Diagram

Stand-by State

  • Very low power state with DC/DC OFF
  • Power OFF to RP2040 and peripherals
  • Long-press Power for Normal state
  • Enter Charge when USB connected
 

Normal State

  • LED on the Pico board blinks to indicate normal operation
  • Toggle peripheral power via User switch (OLED ON/OFF)
  • USB vs battery operation shown on OLED
  • Long-press User switch for DeepSleep
  • Long-press Power or low battery triggers Shutdown
 

DeepSleep State

  • pico-extras'pico_sleep supported dormant mode is utilized
  • Minimize DeepSleep power by cutting peripheral power
  • Press Power to return to Normal
 

Shutdown State

  • Show Shutdown on OLED, enter Charge after 3s
 

Charge State

  • When USB powered, show Charge on OLED and enter dormant after 3s
  • Without USB power, enter Stand-by via hardware
  • Press Power to enter Normal
  • Program rewriting is performed in this state
 

External Circuit

External circuits are presented: an optimized SMD version and a breadboard-friendly version.
Optimized circuit using SMD components
Breadboard test circuit
PDF versions available here.

Sample Program

The sample program is published on GitHub.
https://github.com/elehobica/pico_battery_op

This concludes Part 1. Next, the circuit and sample program will be explained.
Battery-Powered Operation Environment for Raspberry Pi Pico - Part 2

About Me

My photo
Electronics, programming & audio

Featured Post

Synchronizing Radio-Controlled Clocks with Raspberry Pi Pico W (JJY Standard Radio Wave Emulator)

As a Raspberry Pi Pico W application, I built a JJY emulator for radio-controlled clocks (for time synchronization) with minimal peripheral...

QooQ