Raspberry Pi Pico Battery Power: VSYS, LiPo, 18650 and Sleep
Raspberry Pi Pico battery power explained: VSYS, VBUS and 3V3 pins, Schottky diode, LiPo, 18650 or AA, a battery life table, ADC voltage reading and lightsleep.
Running a Raspberry Pi Pico on battery power is easier than you might think: connect the battery's positive lead to the VSYS pin and the negative lead to GND, and the Pico starts. The reason is the switching buck-boost regulator on the board, which turns anything between 1.8 V and 5.5 V on VSYS into a steady 3.3 V. So two AA cells, a single-cell LiPo or an 18650 are all direct power sources for the Pico; unlike an Arduino Uno, you don't need to go above 7 V.
In this guide you'll first learn the Pico's power pins (VBUS, VSYS, 3V3 and 3V3_EN) and the path between them. Then you'll compare LiPo, 18650 and AA options with a voltage and battery life table, and build the Schottky diode circuit that protects the battery while the USB cable is plugged in. Finally we'll write two programs: one that reads the battery voltage with the ADC, and one that uses MicroPython's lightsleep mode to cut the current from 25 mA to about 2 mA.

The Pico's power pins: VBUS, VSYS, 3V3 and 3V3_EN
The Pico's power path is a single line. The 5 V from the micro-USB port first reaches the VBUS pin, then passes through a Schottky diode on the board onto the VSYS rail; because of that diode you'll measure about 4.7–4.8 V on VSYS with USB connected. VSYS feeds a buck-boost regulator called RT6150 (the Pico 2 uses the similar RT6154), which steps the voltage down when the input is above 3.3 V and up when it is below. Its output powers the RP2040 and is also available on the 3V3(OUT) pin for your sensors. 3V3_EN is the regulator's enable pin: it is tied to VSYS through a 100 kΩ resistor on the board, and pulling it to GND cuts the 3.3 V and switches the Pico off completely.
| Pin | Physical pin | Voltage | Purpose | Battery here? |
|---|---|---|---|---|
| VBUS | 40 | 5 V (USB) | The USB 5 V rail; can power 5 V modules while USB is plugged in | No; use VSYS for a battery |
| VSYS | 39 | 1.8–5.5 V | Main power input, feeds the regulator | Yes, this is the right input |
| GND | 38 (and 7 more GND pins) | 0 V | Common ground | Battery negative |
| 3V3_EN | 37 | Tied to VSYS via 100 kΩ | Pull to GND to shut down the 3.3 V regulator | No; a switch or transistor goes here |
| 3V3(OUT) | 36 | 3.3 V | Output for sensors, keep the total below about 300 mA | Only regulated 3.3 V, with 3V3_EN tied to GND |
| GP29 / ADC3 | Not broken out | VSYS / 3 | Measures VSYS through an on-board divider | For measurement, no wiring needed |
| GP24 | Not broken out | Digital input | Detects whether USB (VBUS) is present | For measurement, no wiring needed |
Battery input on Arduino Uno, ESP32 and Pico compared
| Feature | Arduino Uno | ESP32 DevKit | Raspberry Pi Pico |
|---|---|---|---|
| Battery input | VIN or DC jack (7–12 V recommended) | 5V/VIN pin (about 4.5–6 V) or 3V3 | VSYS (1.8–5.5 V) |
| On-board regulator | Linear 5 V (about 1 V dropout) | Linear AMS1117 3.3 V (about 1.1 V dropout) | Switching buck-boost 3.3 V |
| With one LiPo cell (3.0–4.2 V) | Won't run, needs a boost converter | Not via VIN; feed 3V3 through a low-dropout LDO | Connects straight to VSYS |
| With two AA cells (1.8–3.0 V) | Won't run | Won't run | Runs |
| Typical idle current | 45–50 mA | 30–50 mA Wi-Fi off, 80–160 mA Wi-Fi on | 20–28 mA (much more on a Pico W with Wi-Fi on) |
| Lowest sleep (whole board) | A few mA because of the LED and regulator | 1–10 mA depending on the board, µA on a bare module | About 2 mA in lightsleep, about 50 µA off via 3V3_EN |
The real difference in the table is the regulator type. The Uno and most ESP32 boards use linear regulators: the difference between input and output is burned as heat, and once the input drops below a certain level the output drops too. The Pico's buck-boost regulator keeps 3.3 V even as the battery runs down, so your ADC reference stays stable and you can drain two AA cells down to 0.9 V each. For general board power options see the Arduino power supply guide, and for the difference between regulator types read linear vs switching regulators.
Which battery? LiPo, 18650 and AA options
The choice comes down to three questions: does the voltage range fit VSYS, how long must it run, and do you want to recharge it? Single-cell lithium batteries (LiPo and 18650) start at 4.2 V when full and are empty around 3.0 V; the whole range fits VSYS and they can be recharged with a module like the TP4056. Three alkaline AA cells go from 4.5 V down to 3.0 V and are available everywhere. Two AA cells make a smaller pack, but the regulator draws more current as the voltage falls. The run times below assume about 25 mA for a Pico idling in MicroPython, an average of 2–3 mA for a program that spends most of its time in lightsleep, and 80% of the battery capacity being usable.
| Source | Voltage (full → empty) | Connection | Always running (~25 mA) | Mostly lightsleep (~2–3 mA) |
|---|---|---|---|---|
| 2 × AA alkaline (2500 mAh) | 3.0 → 1.8 V | VSYS | About 2.5 days (low voltage, ~35 mA) | About 4 weeks |
| 3 × AA alkaline (2500 mAh) | 4.5 → 3.0 V | VSYS | About 3.3 days | About 6 weeks |
| 3 × AA NiMH (2000 mAh) | 4.2 → 3.0 V | VSYS | About 2.7 days | About 4.5 weeks |
| 1S LiPo (1000 mAh) | 4.2 → 3.0 V | VSYS through a protection circuit | About 1.3 days | About 2.5 weeks |
| 18650 Li-ion (2600 mAh) | 4.2 → 3.0 V | VSYS through a protection circuit | About 3.5 days | About 6 weeks |
| Power bank (5 V) | Fixed 5 V | Micro-USB | Days, depending on capacity | May switch itself off at low current |
| 4 × AA alkaline | 6.0 → 4.0 V | Don't connect | Not suitable, exceeds 5.5 V | Not suitable |

The maths is simple: run time (hours) = capacity (mAh) × 0.8 / average current (mA). A 2600 mAh 18650 gives 2600 × 0.8 / 25 ≈ 83 hours at 25 mA, and 1040 hours (43 days) at an average of 2 mA. On a Pico W with Wi-Fi on, the average current rises to 45–60 mA and goes above 100 mA while transmitting; the same battery then lasts about a day and a half. To estimate your own circuit quickly, use the battery life calculator, and read more about capacity in the mAh battery capacity article. The only way to know the real current is to put a multimeter in series between the battery and VSYS and measure it.
USB and battery together: the Schottky diode circuit
If you plug in the USB cable while a battery is connected to VSYS, the on-board diode puts the 4.7 V from USB onto VSYS, and that voltage tries to flow back into the battery. An alkaline cell can't be recharged and may heat up and leak; a LiPo can swell from uncontrolled charging. The fix is a second Schottky diode between the battery and VSYS. The two diodes behave like an "OR" gate: whichever source has the higher voltage powers the Pico, while the other is reverse-biased and supplies nothing. With USB plugged in, VSYS sits at 4.7 V and the battery side is at most 4.2 − 0.3 = 3.9 V, so the battery drops out; when you unplug the cable, the battery takes over without interruption.
- Pick a low-drop Schottky diode: a 1 A part such as the 1N5817, SS14 or MBR120 is enough; ordinary diodes like the 1N4007 lose 0.7 V and are not suitable.
- Connect the diode's anode to the positive output of the battery (or the charger module).
- Connect the cathode, marked by the grey or white band on the body, to the Pico's VSYS pin, number 39.
- Connect the battery's negative lead to the GND pin, number 38.
- Measure VSYS with USB unplugged: you should see roughly 0.2–0.3 V less than the battery voltage.
- Plug in USB and measure across the battery: the voltage should not change, meaning no current flows into the battery.

If you want to charge the LiPo or 18650 without taking it out of the circuit, add a TP4056 module with protection. The battery goes to the module's B+ and B− terminals, and the Pico to OUT+ (to VSYS through the Schottky diode) and OUT− (GND). While you charge through the module's own USB socket, the Pico keeps running. The protection circuit (the DW01 chip) cuts the battery off at about 2.5 V, but that's low for battery life, so it's better to put the Pico to sleep in your code once the voltage drops below 3.3 V. For the module's current setting and LEDs see the TP4056 charger module guide, and for the cell itself read the 18650 Li-ion battery article.
Turning the Pico off completely with 3V3_EN
To switch the Pico off without removing the battery, just pull the 3V3_EN pin (number 37) to GND. Put a small slide switch between this pin and GND, and when the switch is closed the regulator stops and the RP2040 is completely unpowered. The current from the battery then falls to about 50 µA, flowing mostly through the 100 kΩ resistor on 3V3_EN and the VSYS measurement divider; a 2600 mAh battery lasts for years at that rate. A more advanced method is to let a timer chip such as the TPL5110 enable 3V3_EN at set intervals: the Pico wakes up, measures, finishes its job and is switched off again. Remember: don't apply external voltage to the GPIO pins while the Pico is off; it can half-power the board through the pins' protection diodes and cause strange faults.
Reading the battery voltage with the ADC
The Pico's GPIO29 is not broken out to a pin, but on the board it is connected to VSYS through a 200 kΩ and 100 kΩ divider. This pin is the ADC3 channel and sees one third of VSYS: VSYS = reading × 3.3 / 65535 × 3. For a LiPo at 4.0 V the ADC sees 1.33 V and read_u16() returns about 26,400. On the Pico W and Pico 2 W, GPIO29 is shared with the wireless chip's clock line, so ADC3 is not reliable while Wi-Fi is in use. On those boards, divide VSYS with two 100 kΩ resistors and feed it to GP26 (ADC0); the voltage divider calculator helps you size the divider. The code below shows the voltage, a rough LiPo percentage and whether the board is powered from USB or from the battery.
1# Raspberry Pi Pico: pil gerilimi ve USB algılama / battery voltage and USB detection
2from machine import ADC, Pin
3import time
4
5KANAL = 3 # 3 = GPIO29, kart üstünde VSYS/3 (Pico, Pico 2) / on-board VSYS/3
6CARPAN = 3.0 # 200k/100k bölücü / 200k/100k divider
7# Pico W: VSYS'i 100k+100k bölücüyle GP26'ya bağla, KANAL = 0, CARPAN = 2.0
8# Pico W: wire VSYS to GP26 through a 100k+100k divider, KANAL = 0, CARPAN = 2.0
9
10adc = ADC(KANAL)
11usb = Pin(24, Pin.IN) # GP24 = VBUS algılama (Pico W'de Pin("WL_GPIO2")) / VBUS sense
12led = Pin("LED", Pin.OUT)
13
14
15def pil_gerilimi(ornek=16):
16 # 16 ölçümün ortalaması gürültüyü azaltır / averaging 16 readings reduces noise
17 toplam = 0
18 for _ in range(ornek):
19 toplam += adc.read_u16()
20 return toplam / ornek * 3.3 / 65535 * CARPAN
21
22
23def lipo_yuzde(v):
24 # Kaba doğrusal tahmin: 3,0 V = %0, 4,2 V = %100 / rough linear estimate
25 yuzde = (v - 3.0) / (4.2 - 3.0) * 100
26 return max(0, min(100, int(yuzde)))
27
28
29while True:
30 v = pil_gerilimi()
31 kaynak = "USB" if usb.value() else "pil / battery"
32 print("VSYS: {:.2f} V ~%{} kaynak / source: {}".format(v, lipo_yuzde(v), kaynak))
33 led.toggle()
34 time.sleep(2)
35| Line | What it does |
|---|---|
| ADC(3) | Reads the VSYS/3 voltage on GPIO29; returns a value from 0 to 65535 |
| Pin(24, Pin.IN) | On the Pico it reads 1 when USB 5 V is present and 0 otherwise; on the Pico W this signal is on Pin("WL_GPIO2") |
| pil_gerilimi() | Averages 16 readings, converts them to volts and applies the divider factor to get VSYS |
| lipo_yuzde() | Maps 3.0–4.2 V linearly to 0–100%; a real LiPo curve isn't linear, so this is only a rough guide |
| led.toggle() | Flips the on-board LED on every reading, so you can see the board is alive without a screen |
Cutting consumption with MicroPython lightsleep and deepsleep
What determines a battery project's life most is how much of its time the Pico spends asleep. time.sleep() doesn't put the processor to sleep; it only waits, and the board keeps drawing 22–28 mA. machine.lightsleep(ms) stops the clocks, resumes the code where it left off when the time is up, and in measurements brings the current down to about 2 mA. On the Pico, machine.deepsleep(ms) uses the same sleep as lightsleep, but resets the board on wake-up so the program starts again from the top of main.py; there is no extra saving, only different behaviour. While plugged into USB, recent MicroPython versions keep the USB clocks running to hold the connection, and on some versions Thonny loses the board; either way you only see the real 2 mA consumption when the board runs on battery.
| Mode | Command | Approx. current | What happens on wake-up? | When to use it |
|---|---|---|---|---|
| Normal wait | time.sleep(1) | 22–28 mA | Code continues | Developing and testing on USB |
| Light sleep | machine.lightsleep(60000) | About 2 mA | Code resumes on the next line, variables are kept | Battery sensors that measure at intervals |
| Deep sleep | machine.deepsleep(60000) | About 2 mA (same as lightsleep) | Board resets, main.py runs from the top | When you want a clean start on every wake-up |
| Fully off | 3V3_EN pin to GND | About 50 µA | Board is off, an external circuit must turn it on | Projects with an on/off switch or a timer chip |
The code below is a data logger example: every ten minutes it measures VSYS and the RP2040's internal temperature sensor, writes a CSV line to flash, blinks the LED for 20 ms and sleeps with lightsleep. If the battery drops below 3.3 V it goes into a one-hour deepsleep; on wake-up the board starts over and goes back to sleep if the battery is still low. Save the code to the Pico as main.py in Thonny, unplug USB and connect the battery. The 3-second wait at the start lets you stop the program with Thonny's Stop button when you want to edit the code again.
1# Pilli Pico: ölç, kaydet, uyu (main.py olarak kaydet) / measure, log, sleep (save as main.py)
2from machine import ADC, Pin, lightsleep, deepsleep
3import time
4
5ARALIK_MS = 600_000 # 10 dakikada bir ölçüm / one reading every 10 minutes
6ESIK_V = 3.3 # LiPo için güvenli alt sınır / safe lower limit for a LiPo
7
8vsys_adc = ADC(3) # VSYS/3 (Pico, Pico 2)
9isi_adc = ADC(4) # Dahili sıcaklık sensörü / internal temperature sensor
10led = Pin("LED", Pin.OUT)
11
12
13def vsys():
14 return sum(vsys_adc.read_u16() for _ in range(8)) / 8 * 3.3 / 65535 * 3
15
16
17def sicaklik_c():
18 v = isi_adc.read_u16() * 3.3 / 65535
19 return 27 - (v - 0.706) / 0.001721
20
21
22time.sleep(3) # Thonny'nin araya girebilmesi için 3 sn / 3 s window for Thonny to interrupt
23sayac = 0
24
25while True:
26 v = vsys()
27 with open("kayit.csv", "a") as f:
28 f.write("{},{:.2f},{:.1f}\n".format(sayac, v, sicaklik_c()))
29 sayac += 1
30 led.on()
31 time.sleep_ms(20) # kısa yanıp sönme: çalıştığını gösterir / short blink: shows it is alive
32 led.off()
33 if v < ESIK_V:
34 # Pil bitiyor: 1 saat uyu, sonra kart baştan başlar / battery low: sleep 1 h, then the board restarts
35 deepsleep(3_600_000)
36 lightsleep(ARALIK_MS) # 2 mA'e yalnız pille iner / drops to 2 mA only on battery
37- Power sensors from a GPIO: connect the VCC of a sensor drawing 1–5 mA to a GPIO pin, switch it on before measuring and off afterwards; during sleep it draws nothing.
- Use fewer LEDs: one LED draws 2–5 mA, as much as the whole board in lightsleep. Use short blinks to show status.
- Turn off Wi-Fi on the Pico W: after sending data, shut the radio down with wlan.disconnect() and wlan.active(False); Wi-Fi left on multiplies consumption by ten.
- Lower the clock speed: reducing the 125 MHz (150 MHz on the Pico 2) with machine.freq() saves a few mA while running; very low values can affect USB and UART, so test first.
- Leave GP23 alone: this pin selects the regulator's power-saving mode; LOW (the default) gives the lowest current. Setting it HIGH reduces ADC noise but increases consumption.
- Write to flash less often: instead of writing every reading to the file, collect a few in memory and write them together; you save energy and flash wear.
Battery-powered Pico project ideas
- Garden moisture logger: measure soil moisture every hour, write it to a CSV and chart it weeks later (capacitive soil moisture sensor).
- Battery weather station: measure temperature, humidity and pressure with a BME280 and send them hourly with a Pico W (Pico W MQTT).
- Solar-powered sensor: build a self-charging setup with a small solar panel, a TP4056 and an 18650; the ESP32 version of the idea is in the solar-powered sensor article.
- Portable NeoPixel lamp: make a cordless desk lamp with three AA cells and a WS2812B ring (Pico NeoPixel ornament).
- Pocket game console: design a handheld game device with a LiPo, a small screen and a few buttons (Raspberry Pi Pico projects).
Common mistakes and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Battery gets warm when USB is plugged in | No diode between battery and VSYS, USB is trying to charge the battery | Add a Schottky diode in the battery line (anode to battery, cathode to VSYS) |
| Pico doesn't start on battery at all | Battery wired to 3V3 or VBUS, or GND not connected | Positive to VSYS (pin 39), negative to GND |
| Runs on battery but the code doesn't start | The program isn't saved as main.py | Use Save As in Thonny and save it to the Pico as main.py |
| Thonny loses the connection after lightsleep | On some versions the USB clocks stop during sleep | That's normal; use time.sleep while developing, switch to lightsleep for battery tests |
| VSYS reads 4.7 V on USB, nonsense on battery | On the Pico W, ADC3 is shared with Wi-Fi | Wire the external divider to GP26, set KANAL = 0 and CARPAN = 2 |
| Battery runs flat much faster than expected | time.sleep is used, an LED or sensor stays on | Use lightsleep, power the sensor from a GPIO, measure the current with a multimeter |
| Random resets on two AA cells | Weak cells, voltage collapses under Wi-Fi or motor current peaks | Use fresh cells or three cells, add a 100 µF capacitor between VSYS and GND |
If you're ready to run your Pico on batteries, starting with a few basic circuits makes things easier. The Raspberry Pi Pico projects in the BlueGrays app, such as LED blinking, buttons, a PWM breathing effect and an RGB LED, come with a wiring diagram and MicroPython code for every step; run them on USB first, then make them cordless with the diode battery circuit from this guide.
Frequently asked questions
What voltage battery can power a Raspberry Pi Pico?
As long as you connect it to the VSYS pin, any source between 1.8 V and 5.5 V works. Two or three AA cells, a single-cell LiPo and an 18650 all fall in that range. Four alkaline AA cells give 6 V and are not suitable.
How long will a Raspberry Pi Pico run on a battery?
A Pico idling in MicroPython draws about 25 mA, which is three and a half days on a 2600 mAh 18650. If the program spends most of its time in lightsleep, the average current drops to 2–3 mA and the same battery can last up to six weeks.
Can I connect USB and a battery to the Pico at the same time?
Yes, but you need a Schottky diode between the battery and VSYS. Without it the USB voltage flows into the battery, heating an alkaline cell or charging a LiPo without control. With the diode, whichever source is higher powers the Pico.
What is the difference between VSYS and VBUS on the Pico?
VBUS is the USB 5 V rail itself. VSYS is the main input that is fed from VBUS through an on-board diode and goes to the regulator. An external battery or power supply always goes to VSYS.
How do I check the battery level on a Raspberry Pi Pico?
On the Pico, GPIO29 sees one third of VSYS through an on-board divider; in MicroPython ADC(3).read_u16() × 3.3 / 65535 × 3 gives VSYS. On the Pico W this channel is shared with Wi-Fi, so wiring VSYS to GP26 through a two-resistor divider is more reliable.
What is the difference between lightsleep and deepsleep in MicroPython?
lightsleep resumes the code where it stopped when the time is up and keeps your variables. On the Pico, deepsleep uses the same sleep but resets the board on wake-up, so main.py runs from the top. On battery, both draw about 2 mA.
Projects to build after reading this
See all projects
Raspberry Pi Pico Onboard LED Blink (Pico and Pico W)
The opening project of the Raspberry Pi Pico series! We blink the Pico's green built-in LED to confirm the board works, the classic "Hello World" first experiment. No external parts needed, just the Pico and a USB cable. The code is written in MicroPython, the language officially supported by the Raspberry Pi Foundation.

Raspberry Pi Pico: Controlling an External LED (Breadboard)
The next step after the Pico's built-in LED: connect an external LED on a breadboard and control it through pin GP14. You'll learn how to use any of the Pico's GPIO pins as an output, the LED's polarity (long leg = anode/+, short leg = cathode/–) and why a current-limiting resistor (220Ω) is a must. Without the resistor, too much current flows through the LED and it can burn out.

Raspberry Pi Pico Alternating Two LEDs (Blink-Flip Pattern)
The next step after the Pico's single LED: the classic flip-flop animation, with two LEDs blinking in turn. One LED turns off as the other turns on, the most basic example of handling multiple GPIOs. Two LEDs of different colors (red on GP14, green on GP13) swap every 500 ms. With MicroPython's Pin.toggle() method, the code stays short and readable.

Raspberry Pi Pico Traffic Light Simulator (3 LEDs Sequential)
We recreate real traffic light logic with red, yellow and green LEDs, the first Pico project to move up to 3 LEDs! Green says "go" for 4 seconds, yellow "get ready" for 1.5 seconds, red "stop" for 3 seconds, and red+yellow "set off" for 1 second (the European traffic light pattern). You'll learn to define functions (def all_off()), state machine logic and multi-GPIO synchronization.

Raspberry Pi Pico Police Strobe Light Effect (Red + Blue)
We simulate a police car's light bar with a Raspberry Pi Pico in its simplest form! The red and blue LEDs take turns (flip-flop): while red is on, blue is off, and they swap every 0.3 seconds, forever. The code writes the two steps directly in a single while True loop; the speed is set with the WAIT_MS constant.

Raspberry Pi Pico Button Controlled LED (Push)
First input project with Pico — button read! LED lights while button is pressed, off when released. This is the big step after LED animations: signal input from the world to Pico. Learn Pin.IN (input mode), Pin.PULL_UP (internal pull-up resistor — standard for buttons), button.value() reading. GP14 LED, GP2 button (internal PULL_UP). Pressed = LOW (0), released = HIGH (1) — reverse logic seems confusing at first but is industry standard.

Raspberry Pi Pico PWM LED Fade (Breathing Effect)
The LED doesn't just blink anymore, it breathes! With the Raspberry Pi Pico's PWM (Pulse Width Modulation), the LED's brightness slowly rises and then slowly fades, a calm "breathing" effect like a sleeping laptop's light. You'll learn the machine.PWM class, the 16-bit brightness value from 0–65535 with duty_u16() and the PWM frequency.

Raspberry Pi Pico RGB LED Color Cycle (3-Channel PWM)
One LED, millions of colors! An RGB LED actually holds 3 separate LEDs: red, green and blue. Set the brightness of each one separately with the Pico's 3 PWM channels and the colors mix: red + green = yellow, green + blue = cyan, all three = white. In this project the LED cycles through 8 colors.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 750+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

