Running a small computer somewhere without mains power, a shed, a remote sensor post, a wildlife camera, sounds simple until the card corrupts or the battery dies overnight. Off-grid power for a Raspberry Pi or a similar board is mostly arithmetic and a few safety habits, not luck. Get the current budget, the battery size and the shutdown behaviour right, and a solar-fed board can run for months with almost no attention. What follows sets out the numbers to work through and the steps that keep the storage card intact when the sun refuses to cooperate.
Budgeting the current draw
Every plan starts with how much current the board actually pulls, because that figure drives everything downstream. A Raspberry Pi 4 sitting idle draws roughly 500 to 600 milliamps at 5 volts, and closer to 1,000 milliamps under steady load, while a smaller Pi Zero can idle near 120 milliamps. Add whatever you attach, since a camera, a screen or a USB drive each take their own share.
Measure rather than guess wherever you can. A cheap inline USB power meter shows the real draw as your program runs, which is more honest than datasheet figures. Note the peak as well as the average, because a supply that sags during brief spikes causes the same instability as one that is simply too small. Sensors that wake only occasionally can cut the average sharply, a point the primer on reading sensors on a small board develops further.
Working out battery capacity
Battery capacity is quoted in ampere-hours or milliamp-hours, and the core sum is refreshingly plain. A board drawing 0.6 amps from a 12 amp-hour battery would, in theory, run for 20 hours. Real life is messier, so derate. Lead-acid cells last far longer if you use only half their capacity, and converting the battery voltage down to the board’s 5 volts wastes perhaps 10 to 20 percent as heat.
The right battery depends on the board and what it does all day, since the many jobs covered in common Raspberry Pi uses span very different power needs. A practical version of the sum: take your average current in amps, multiply by the hours you need between charges, then divide by the usable fraction of the battery, around 0.5 for lead-acid or 0.8 for lithium. A Pi Zero at 0.15 amps needing 48 hours wants about 14 usable amp-hours, so a 30 amp-hour lead-acid battery leaves comfortable margin.
Solar panels and charge controllers
Solar turns a battery that only drains into one that refills. Size the panel to replace a full day’s use within the few good sun-hours a location really gets, not the theoretical peak. If a board consumes 15 watt-hours a day and you count on four usable sun-hours, a panel of at least 5 watts covers the raw energy, though 10 to 20 watts is wiser once clouds and dirt are allowed for.
Never wire a panel straight to the battery. A charge controller sits between the two, stopping overcharging and, on better models, drawing the most power the panel can give. An MPPT controller costs more than a simple PWM type but gathers noticeably more on cold, bright days. A touchscreen is one of the hungriest additions you can make, so if your build includes one, budget for it before sizing anything, as the guide on fitting a display or touchscreen to a project points out.
Putting the power chain together
With the numbers in hand, the physical build follows a clear order. These steps keep the parts matched and the card safe.
- Measure the board’s average and peak current with an inline meter while your real program runs.
- Multiply the average current by the hours needed between charges to get raw ampere-hours.
- Divide by the usable fraction of your chosen battery chemistry to size the battery honestly.
- Pick a panel that replaces a full day’s watt-hours within the local sun-hours, then oversize it for cloud.
- Fit a charge controller between the panel and the battery, matching its voltage to your cells.
- Add a regulator or converter that feeds the board a clean, steady 5 volts.
- Wire a low-voltage cutoff or a monitoring script so the board stops before the battery is drained flat.
Shutting down safely on low power
The quickest way to ruin one of these builds is to let the battery fall until the board browns out in the middle of a write. A half-written SD card often will not boot again. The cure is to shut down cleanly before that point, which means the board has to know the battery is getting low.
Two approaches work. A hardware low-voltage disconnect cuts the load at a set threshold, blunt but dependable. Better, a small circuit or add-on board reports the battery voltage to the Pi, and a script triggers a proper shutdown once it drops below, say, 20 percent. Some makers add a supercapacitor or small backup cell that holds the board up for the few seconds a clean shutdown takes.
Weatherproofing the whole thing
Outdoor power gear fails from water, heat and condensation far more often than from bad wiring. House the board and battery in a sealed enclosure rated at least IP65, and add cable glands where wires pass through so the seal holds. Mount any connectors facing downward so water cannot pool on them.
Heat is the quieter enemy. A sealed box in direct sun can cook the electronics, so shade it, add a vent with a rain baffle, or choose a light-coloured case. Condensation forms when warm damp air cools inside the box overnight, so a sachet of desiccant helps in humid places. Getting the box and the airflow right is the same balance the guide on enclosures and cooling for single-board computers sets out.
Keeping it running unattended
An off-grid board rewards honesty in the planning stage. Undersize the battery or panel and you get a system that works in summer and dies in November, then corrupts its card on the first cold, dark week. Build in margin instead, size the storage for the worst realistic conditions, and add a shutdown that protects the card, and the whole thing quietly looks after itself.
Treat the first month as a test rather than a finished install. Log the battery voltage, watch how low it falls before dawn, and adjust the panel angle or capacity before you seal everything for good. A build you can measure is one you can trust to sit alone for a season.
Frequently asked questions
Can I run a Raspberry Pi on solar?
Yes, and many people do. The trick is sizing the panel and battery for the board’s real daily energy use, then adding margin for cloudy days. A charge controller protects the battery, and a regulator supplies the steady 5 volts the Pi needs. A low-power Pi Zero is far easier to run this way than a hungry Pi 4 with peripherals attached.
How long will a battery run a Pi?
Divide the usable battery capacity by the board’s average current. A Pi Zero drawing 0.15 amps from a 10 amp-hour battery, using half its capacity safely, lasts around 33 hours. A Pi 4 pulling 0.8 amps from the same battery manages roughly 6 hours. Peripherals, conversion losses and cold weather all shorten these figures, so always plan for less than the theoretical number.
How do I stop power loss corrupting the card?
Give the board a way to shut down cleanly before the battery dies. Monitor the battery voltage and trigger a proper shutdown at around 20 percent, or fit a low-voltage disconnect. A supercapacitor or small backup cell can hold the board up long enough to finish writing. Using a quality card and a read-only root filesystem lowers the risk further.
