HardwareParts and accessories

A UPS for a Raspberry Pi or mini PC agent host

An agent host is meant to stay on, and Raspberry Pi's own docs warn that power dropouts can corrupt storage. A Raspberry Pi takes a UPS board that clips underneath it; a mini PC or a Mac mini takes a small desk UPS and a USB cable. Here is what each kind does, what it reports, and how to make the machine shut down cleanly and come back on its own.

In short: On a Pi 5, a pogo-pin UPS board such as the Geekworm X1200 or X1202, or Waveshare's UPS HAT (E), with PSU_MAX_CURRENT=5000 set in the bootloader. On a mini PC or a Mac, a small line-interactive UPS on USB, read by NUT on Linux. Runtimes printed by the makers are their claims: measure your machine's draw and read the UPS maker's chart.

At a glance
Why botherRaspberry Pi: power dropouts can cause storage corruption, and so can low quality supplies
Pi 5 boardsGeekworm X1200 (two 18650 cells), X1202 (four 18650), Waveshare UPS HAT (E) (four 21700)
Pi 5 settingPSU_MAX_CURRENT=5000 in sudo rpi-eeprom-config --edit, so the board gets its 5 A budget
Mini PC or MacA USB line-interactive UPS; NUT reads HID Power Device Class units with usbhid-ups
NUT piecesupsd (data server, port 3493), upsmon (monitor and shutdown), the driver; Debian package nut-server
Mac mini settingStart up automatically after a power failure, in System Settings, Energy

Why an agent host wants one

Raspberry Pi puts it plainly: "power dropouts can cause storage corruption." An agent writes all the time (logs, its database, session files, container layers), so the chance that a cut lands in the middle of a write is real. A UPS turns a cut into an event the machine can react to: keep running through a short dropout, or shut down cleanly before the battery is empty. The other half of the job is coming back: a host that stays off after the power returns is as down as one with a broken disk. If an SD card has already died on you, the causes and fixes are on SD card corruption.

UPS boards for the Raspberry Pi 5

These boards mount under the Pi, feed it through pogo pins and leave the 40-pin header free. The figures below are the makers' own.

BoardCellsOutputWhat it reportsNotes from the maker
Geekworm X1200Two 18650, not included5.1 V, up to 5 APower loss over GPIO; battery voltage and percentage over I2CAuto power-on when power returns; programmable safe shutdown on low battery; "up to 6 hours" (maker claim, depends on cells and load)
Geekworm X1202Four 18650, not included5.1 V, up to 5 APower-loss detection and battery statusFeed it from its USB-C or its DC input, never both
Waveshare UPS HAT (E)Four 21700, not included5 V, up to 6 AVoltage, current, power and remaining capacity from a fuel gauge ICPD 3.0 charging up to 40 W; pogo pins for Pi 5, 4B and 3B+

Three warnings from Geekworm's wiki apply to the whole category:

  • Power the Pi through the UPS board, not through the Pi's own USB-C socket.
  • Use unprotected, flat-top cells: the X1200 page says not to use 18650 cells with a built-in protection circuit.
  • If the X1200 does not detect the Pi 5, it shuts itself down within 3 seconds; that is expected, not a fault.

Older boards are not all for the Pi 5: Waveshare's UPS HAT (B) wiki lists the Pi 3, 3B+ and 4B, and Geekworm marks its X1209 for the Pi 5B, 4B, 3B and 3B+. Check the listing names the Pi 5 (UPS HAT for the Pi 5 on Amazon).

The 5 A message, PSU_MAX_CURRENT and the power-off draw

A Pi 5 asks its supply for 5 A through USB Power Delivery. Behind a UPS board that negotiation does not happen, and Waveshare notes that the Pi then limits the current to 3 A: USB peripherals drop to 600 mA, and Geekworm's FAQ quotes the message you see, "This power supply is not capable of supplying 5A". Geekworm and Waveshare give the same fix: tell the bootloader the supply's rating.

sudo rpi-eeprom-config --edit
PSU_MAX_CURRENT=5000

Raspberry Pi documents the setting: on the Pi 5 only, it makes the firmware "skip USB power-delivery negotiation and assume that it is connected to a power supply with the given current rating". Waveshare also mentions usb_max_current_enable=1 in config.txt as an alternative. More on the message itself: the Pi 5 power supply warning.

One more EEPROM setting matters on a battery. Raspberry Pi says a Pi 5 that is shut down still draws about 1 W to 1.4 W; with POWER_OFF_ON_HALT=1 in the same bootloader config, that drops to about 0.01 W. Our reading: after a low-battery shutdown, that keeps the cells from draining further while the Pi waits for the mains.

Clean shutdown on a Pi board

The HAT boards report over I2C and GPIO, not over USB. We found no NUT driver for them, so NUT is not the tool here: use the maker's scripts, or the board's own behaviour. The X1200 does a programmable safe shutdown when the battery runs low and powers the Pi back on when the mains returns. The UPS HAT (E) does not restart the Pi by default; Waveshare gives a command that tells its controller to cut the Pi's power 30 seconds later, check the charging port after 60 seconds, and restart the Pi if power is back:

i2cset -y 1 0x2d 0x01 0x55

Whatever the board, test the whole cycle once (pull the plug, wait for the shutdown, plug back in) before you trust it with the agent, and make sure the agent starts as a service at boot.

Mini PC or Mac mini: a USB UPS and NUT

A box with a mains adapter takes an ordinary desk UPS. A line-interactive model with a USB port is the usual small choice (line-interactive UPS on Amazon). On Linux, Network UPS Tools (NUT) turns that USB cable into a clean shutdown. NUT lists at least 201 manufacturers and 1441 known compatible models, and is free software under the GPL. Its parts:

  • A driver. usbhid-ups handles USB units that use the HID Power Device Class: full support for newer Eaton USB units, MGE, Dell and AMETEK Powervar UPM; partial for APC, Belkin, Cyber Power Systems, EcoFlow, Powercom, PowerWalker, TrippLite and Vertiv.
  • upsd, the data server, which listens on port 3493 unless you configure another.
  • upsmon, the monitor and shutdown controller, which shuts the machine down when the UPS reports a low battery.

On Debian the package is nut-server (version 2.8.1 in Trixie; NUT's latest release is 2.8.5, April 2026), which ships the core system and the serial and USB drivers. Because upsd serves the status over the network, one UPS can protect several machines: the one on the USB cable shares it, the others run upsmon as clients.

On a Mac mini, set the restart side in System Settings, Energy: "Start up automatically after a power failure", or on newer macOS "Start up when power is connected" with After power failure. Without it, the Mac stays off when the power returns.

How big a UPS

Small machines draw little: Raspberry Pi gives a typical bare-board current of 800 mA for the Pi 5, Apple measured the Mac mini M4 at 4 W idle at the wall, and Intel rates the N100 at 6 W (a chip figure, not the box at the wall). Runtime charts are the UPS makers' claims, made for their own test loads, so read your real draw with a plug-in meter (power meter on Amazon), add the router if it shares the UPS, and pick the model whose chart covers a clean shutdown with margin. Our view: for an agent host, the goal is minutes to shut down safely, not hours of uptime. Yearly consumption by machine is on the power cost guide.

What to buy

Shop links go through /go/ and open Amazon (amazon.fr in the EU and Switzerland, amazon.com elsewhere). As an Amazon Associate we earn from qualifying purchases. Your price does not change and no brand pays for a place on this page (disclosure). We write no price down: it moves, the shop shows today's.

Questions

Does NUT work with a Raspberry Pi UPS HAT?
We found no NUT driver for boards such as the Geekworm X1200 or the Waveshare UPS HAT (E). They report over I2C and GPIO, not USB HID; use the maker's scripts or the board's own low-battery shutdown.
Why does my Pi 5 say the power supply is not capable of supplying 5A on a UPS board?
The board does not do USB Power Delivery negotiation, so the Pi assumes 3 A. Set PSU_MAX_CURRENT=5000 with sudo rpi-eeprom-config --edit, as Geekworm and Waveshare advise.
How long will a UPS HAT keep a Raspberry Pi 5 running?
Geekworm claims up to 6 hours for the X1200, depending on cells and load. We have not measured it, and no figure holds without your cells and your load.
Will a Mac mini turn back on after a power cut?
Only if you set it. In System Settings, Energy, turn on Start up automatically after a power failure (or Start up when power is connected, After power failure, on newer macOS).
Which port does NUT use?
upsd listens on port 3493 unless configured otherwise. Other machines run upsmon as clients against it, so one UPS can shut down several hosts.

Sources