solar powered · grid as backup
2026-11-30 a solar-powered webserver on a 12 V island
This page is served by a Raspberry Pi 4 that sits on a shelf in my flat. The Pi, three more Pis and a QNAP NAS next to it run from a 12 V bus fed by two 180 W panels on the balcony and a 100 Ah LiFePO4 battery. A ThinkPad T420 joins the bus when I need the Immich photo server. The setup has been running since spring 2026. It is a 12 V island; the grid is only a backup charger, not a feed-in point. A switched 10 A LiFePO4 charger tops up the battery from the grid when it is low. The website is therefore solar-powered for much of the year and grid-assisted in the dark half of the year. That is the honest version: a 1 kWh battery is not a winter power plant.
At the time of writing the measured load is about 50 W, or 1.2 kWh per day. From April to August the panels produce that on a good day. From November to February they produce a fraction of it. The battery covers the night, not a cloudy week.
- the 12 V island
- the loads
- generation and storage
- the energy budget
- the switching problem
- components
- the NAS conversion
- the on-demand Immich server
- monitoring
- what I learned
- safety
- further reading
the idea: a 12 V island
The main idea is a complete 12 V island, not an AC-coupled solar system. I did not use a microinverter to feed into the house wiring. The panels charge the battery, and the Pis and the NAS run directly from the 12 V bus through DC-DC converters. A microinverter would be convenient for grid feed-in, but the server would then convert DC to 230 V AC and back to 12 V DC; every conversion costs a few percent. The 12 V island avoids the inverter and the mains charger in the normal path, which should make the whole chain more efficient. The only 230 V connection is the backup charger, and it is switched on only when the battery needs help.
Most small solar server builds start with a false choice: either everything runs from the battery until it is empty, or a UPS takes over. I wanted the server to keep running without noticing the transition, and I wanted the grid to be a backup, not the primary supply. The result is a 12 V bus fed by the panels through the MPPT, buffered by the battery, with a switched mains charger as backup.
The loads never change their supply. The battery is always on the bus. The solar controller feeds the bus when there is sun. The mains charger is switched on when the battery needs help. A relay only switches the 230 V input of that charger, never the 12 V side.
the loads
The solar bus is a small 12 V island. It carries the four Raspberry Pis, the NAS and, on demand, the ThinkPad T420:
| device | role | typical power |
|---|---|---|
| Raspberry Pi 4, USB-C | this website, lighttpd | 3–5 W |
| Raspberry Pi 4, USB-C | Pi-hole, DNS and DHCP | 3–5 W |
| Raspberry Pi 3, micro USB | waterpi, garden monitoring | 2–3 W |
| Raspberry Pi 2 | Venus OS, Node-RED, MQTT gateway | 2–3 W |
| QNAP TS-459 Pro II, 4× SATA | NAS, backups, media | 30–40 W |
| base load | always on, measured | ≈ 50 W |
| ThinkPad T420 | Immich, on demand via WOL | 10–45 W while awake |
Those are typical values. Boot peaks and disk spin-up are higher. The 5 V converter and the picoPSU need headroom for those peaks; a supply that is sized for the idle load will fail exactly when the disks start. The 50 W base load does not include the T420. When the laptop is asleep its Wake-on-LAN circuit still draws a little standby power; when it is awake it is the second-largest load after the NAS.
generation and storage
| item | value |
|---|---|
| panels | 2× Chaori 180W-35V CRM 180W-Mono |
| open-circuit voltage | 43 V Voc |
| short-circuit current | 5.48 A Isc |
| voltage at MPP | 35 V Vmpp |
| current at MPP | 5.14 A Impp |
| nominal power | 180 Wp each, 360 Wp total |
| orientation | south, 30° |
| charge controller | Victron SmartSolar MPPT 100/30 |
| battery | 12 V LiFePO4, 100 Ah, ≈ 1.0–1.2 kWh, BMS and balancer |
| battery monitor | Victron SmartShunt (300 A or 500 A version) |
The panels hang on the balcony railing with stainless steel brackets. 30° is a compromise: it fits the railing and favours the summer half-year, which is exactly the season in which the system can be self-sufficient. A pure winter system would want a steeper angle.
The two panels are wired in series, as in the build plan: about 70 V at MPP and 86–88 V open circuit. That is close enough to the 100 V input limit that the cold-morning Voc needs checking; at −10 °C the top of that range can climb to around 97 V. Series keeps the current at about 5 A and the cable loss low. Parallel wiring is the conservative alternative if you want more headroom.
The controller is a 100/30, not the 100/20 from my first parts list. At 12 V, 360 Wp is about 30 A. A 20 A controller would clip at roughly 260–290 W depending on battery voltage, and it would clip exactly when the battery is low and the panels are cold, which is when the power is needed.
The battery is a 12 V 100 Ah LiFePO4 pack with a BMS and a balancer. The BMS should protect against over-voltage, under-voltage and charging below 0 °C; check that yours does. The balancer keeps the four cells aligned. The SmartShunt is the fuel gauge. It counts charge and discharge and estimates the state of charge. Voltage alone is useless for LiFePO4 because the curve is almost flat in the middle.
the energy budget
50 W times 24 hours is 1.2 kWh per day. The battery's nominal 1 kWh is not 1 kWh usable: the 20–80 % window leaves roughly 0.6–0.7 kWh, which is 12 hours at 50 W. The battery carries the night, not a cloudy day. That is why the mains fallback is not a compromise but part of the design. The T420 is not in that figure: an hour of Immich at 25 W adds 25 Wh, about 2 % of the daily load. The always-on base load still dominates.
rough monthly average for 360 Wp at 30° south in Weilheim in Upper Bavaria; annual total around 360 kWh (≈1000 kWh/kWp). This is an estimate from typical yield, not a measured series.
| month | yield kWh/day | load kWh/day | balance |
|---|---|---|---|
| January | ≈ 0.3 | 1.2 | −0.9 |
| February | ≈ 0.6 | 1.2 | −0.6 |
| March | ≈ 0.9 | 1.2 | −0.3 |
| April | ≈ 1.3 | 1.2 | +0.1 |
| May | ≈ 1.6 | 1.2 | +0.4 |
| June | ≈ 1.7 | 1.2 | +0.5 |
| July | ≈ 1.7 | 1.2 | +0.5 |
| August | ≈ 1.5 | 1.2 | +0.3 |
| September | ≈ 1.1 | 1.2 | −0.1 |
| October | ≈ 0.7 | 1.2 | −0.5 |
| November | ≈ 0.4 | 1.2 | −0.8 |
| December | ≈ 0.25 | 1.2 | −0.95 |
April to August is roughly break-even or better. September and March are shoulder months. October to February is a grid deficit. A second battery would not fix December; it would only move the deficit by a day. More panels or a lower base load would. The NAS with four spinning disks is the obvious place to start if the base load has to come down.
A charger also has a small standby draw while its 230 V side is on. The exact figure depends on the model; it is usually well under a watt. Left on 24/7 that is still a few kWh per year, which is exactly the kind of load the relay avoids: the 230 V side is only on when the battery needs charging.
the switching problem
The first sketch used the programmable load output of the MPPT: when the battery voltage falls below 12.5 V, the load output switches off, an inverted signal turns on the mains supply, and a relay transfers the load. It works on paper, but it has two problems. First, LiFePO4 voltage is flat; 12.5 V is already deep in the discharge curve, and the exact point depends on load and temperature. Second, and worse, it switches the load. A relay that breaks the 12 V line for even a few tens of milliseconds reboots the Pis and can corrupt the NAS. The server would notice the transition, which is exactly what I wanted to avoid.
The actual build plan went a different way: the 12 V bus stays alive, the battery is permanently connected, and only the mains side is switched. The plan used a Mean Well LRS-150-12 behind a 40 A Schottky diode, set to 13.0 V, so it would take over the bus at about 12.7 V when the battery was low. That was the only part of the build that did not work: the PV, MPPT, battery and loads worked from the start, but the PSU kept going into overload and the diode/OR-ing branch was never reliable.
I replaced the PSU and the diode with a 10 A LiFePO4 charger connected directly to the battery. It only refills the battery; the loads stay on the bus. It is a proper LiFePO4 charger, so it supplies a charge profile instead of a fixed 12 V. No Schottky diode is needed because the charger is not a power supply feeding the bus; it is a charge source on the battery. That is the version that has been running.
The charger is a 10 A LiFePO4 unit. At 14.2–14.6 V it delivers up to about 140 W. The load is about 50 W, so even while the server runs the battery still gains roughly 90 W. That is enough to recover from a low day overnight. The charger's own charge profile decides when to switch to float; the Node-RED flow only decides when the 230 V side is allowed on.
The bus rises to the charger's absorption voltage while it is charging. That is fine for the picoPSU-80-WI-32V and the 12→5 V converter, which are specified for the full LiFePO4 window. Check the input range of every converter before you copy this; a plain 12 V picoPSU or a 5 V buck that stops at 13 V will not survive the charge voltage.
The relay is driven from a Raspberry Pi GPIO through an opto-isolated relay board. The Pi never touches mains. The mains side is a DIN-rail relay or contactor with a 16 A contact and an RC snubber. The charger has an inrush current too, so check the relay's rating; a small 12 A relay may weld its contacts over time. Switching both L and N with a two-pole relay is the safer arrangement.
The current Node-RED flow uses hysteresis: the mains charger turns on below 20 % state of charge or below 12.5 V, and off at 80 %. The MPPT is switched off at 80 % and on again at 75 %, so the battery does not sit at 100 % all summer. Once a week, on Sunday between 11:00 and 16:00, the system allows a full charge to 99 % so the balancer can do its job. The thresholds are a compromise between calendar ageing and usable capacity.
Why not use the MPPT load output as the main switch? Because it is a low-voltage disconnect, not a state-of-charge manager. It would cut the server exactly when the battery is low, which is the moment you want the mains charger to take over. The SmartShunt knows the state of charge much earlier. The load output can still be configured as a last-resort alarm or disconnect, but it is not in the power path.
Fail-safe is the weak point. If Node-RED stops, the relay stays in its last state. If it was off and the sun disappears, the battery runs down to the BMS cutoff. A hardware low-voltage disconnect such as a Victron BatteryProtect, or a watchdog that forces the charger on, is the next improvement. The BMS is the last line of defence, not a control system.
components
| part | role | note |
|---|---|---|
| 2× Chaori 180W-35V CRM 180W-Mono | PV | 43 V Voc, 5.48 A Isc, 35 V Vmpp, 5.14 A Impp; south, 30° |
| Victron SmartSolar MPPT 100/30 | charge controller | 360 Wp / 12 V ≈ 30 A; a 100/20 would clip |
| Victron SmartShunt | battery monitor | 300 A or 500 A version; both are far oversized here |
| 12 V 100 Ah LiFePO4 | buffer | BMS, balancer, low-temperature charge cutoff |
| 10 A LiFePO4 charger | grid backup | e.g. Victron Blue Smart IP22 12/10 or similar; 14.2–14.6 V absorption; 10 A ≈ 140 W |
| Blue Sea ST-Blade 6-circuit fuse block | distribution | with negative bus; 15 A charger, 10 A NAS, 10 A Pi converter, 10 A T420, 5 A control |
| MRBF fuse holder + 100 A fuse | main protection | directly at the battery positive terminal |
| positive and negative busbars, 150 A | distribution | Blue Sea 2303 or similar; 4-way |
| 12 V DIN-rail relay, 2-pole, 16 A | mains switching | 12 V coil, RC snubber, opto driver; check inrush rating |
| 12→5 V DC-DC, 10 A | Pi rail | e.g. Mean Well SD-50A-5 or Pololu D24V150F5; 5 A is marginal |
| picoPSU-80-WI-32V | NAS ATX supply | 12–32 V input, 80 W continuous, 120 W peak; 12 V rail 4 A continuous |
| ThinkPad T420 | Immich, on demand | 12→20 V DC-DC (90 W class); Wake-on-LAN; 10–45 W while awake |
| 6 mm² solar cable, MC4 | PV wiring | 10 m run; 16 mm² battery, 2.5–6 mm² branches |
| DIN enclosure | safety | no separate AC fuse or RCD in the solar enclosure (see safety), strain relief, touch protection |
The panels were the cheapest part: I found both of them on kleinanzeigen.de for €20 together. The MPPT was about €66 at the time. The battery and the T420 were already here. The 10 A charger and the rest of the wiring — fuses, cable, relay, connectors, enclosure — are maybe €150–200. The expensive part is not the hardware; it is the time spent thinking about failure modes.
the NAS conversion
The QNAP TS-459 Pro II is the biggest single load: four 3.5 inch SATA disks at about 8 W each, plus the board. The original 250 W internal ATX supply is removed and replaced by a picoPSU-80-WI-32V inside the case. The wide-input version is the important part. The plain picoPSU-80 is a 12 V input device and shuts down above roughly 13–13.5 V, which a LiFePO4 reaches during charging. The WI-32V accepts 12–32 V and keeps working through the whole charge window.
The wide-input board regulates its 12 V rail as well, so the disks do not see the full charge voltage. Its 12 V rail is rated 4 A continuous and 6 A peak. Four 3.5 inch disks spinning up together can exceed that. My board works, but if I built it again I would use the 120 W wide-input version or stagger the disk spin-up. The 80 W continuous rating is fine once the disks are running; the peak is the problem.
The board needs at least 12 V at its input. A LiFePO4 near empty can dip below that under load. Set the low-voltage disconnect and the mains-charger threshold so the bus stays above 12 V, or the picoPSU will drop out before the BMS does.
the on-demand Immich server
I tried running Immich on the Raspberry Pis first. The Pi 4s can serve a small library, but they are too weak for Immich's machine learning and transcoding; the interface and the background jobs become sluggish. The T420 is not fast by modern standards either, but it has an x86 CPU and more RAM, and it is only on when I need it.
The T420 is a 2011 ThinkPad, not a server. It runs Immich for the photo and video library. Immich's machine learning and transcoding are bursty, and there is no reason to keep a 35 W-class laptop awake 24/7. The T420 needs 20 V, so it has its own 12→20 V DC-DC converter on the bus.
It stays in standby with its Ethernet controller alive; a Wake-on-LAN magic packet boots it. I send that packet from another machine on the LAN when I need photos, and I let the laptop go back to sleep or shut it down afterwards. WOL only works if the laptop has standby power and the Ethernet link is up. A laptop that is completely unplugged is dead to the network.
The point is not to make the T420 efficient. The point is to keep it off. An old x86 laptop at idle still draws more than three Raspberry Pis, and Immich can use all the CPU it can get while it is awake. On-demand is the right compromise for a solar island.
monitoring
A Raspberry Pi 2 runs Venus OS. The SmartShunt and the MPPT are connected via VE.Direct, and Venus OS publishes their values over MQTT. Node-RED on the same Pi reads the state of charge and voltage, decides when the mains charger should run, and writes the relay state back to the Venus relay. The charger negative goes to the system side of the SmartShunt, not directly to the battery; the MPPT and all load returns connect to the same negative bus. Otherwise the shunt cannot see the current and the state of charge drifts.
| Venus relay | GPIO (BCM) | 40-pin header | use |
|---|---|---|---|
| Relay 1 | 21 | pin 40 | mains charger |
| Relay 2 | 17 | pin 11 | spare / manual |
The Venus relay has to be set to Manual for Node-RED to control it. On a Raspberry Pi, the polarity is often not exposed in the GUI; in that case invert in hardware with NO/NC or use dbus to set /Settings/Relay/Polarity.
The QNAP has a small two-line LCD, and it makes a surprisingly good solar display. Line 1 shows state of charge, battery power and PV power; line 2 shows NAS disk usage. A shell script reads the MQTT topics and writes to /dev/ttyS1 at 1200 baud:
#!/usr/bin/env bash
BROKER="mqtt.local"
TOPIC_BATT="N/b827eb116720/system/0/Batteries"
TOPIC_PV="N/b827eb116720/system/0/Dc/System/Power"
TOPIC_KEEPALIVE="R/b827eb116720/keepalive"
send_keepalive() {
mosquitto_pub -h "$BROKER" -t "$TOPIC_KEEPALIVE" -m ''
}
send_keepalive
batt_json="$(mosquitto_sub -h "$BROKER" -t "$TOPIC_BATT" -C 1)"
pv_json="$(mosquitto_sub -h "$BROKER" -t "$TOPIC_PV" -C 1)"
soc=$(printf '%s\n' "$batt_json" | jq -r '.value[0].soc | floor')
pow=$(printf '%s\n' "$batt_json" | jq -r '.value[0].power | floor')
spw=$(printf '%s\n' "$pv_json" | jq -r '.value | floor')
echo "${soc}% ${pow}W ${spw}W"
The N/... topics are node values, the R/... topic is a request. The keepalive is needed so the Venus MQTT gateway keeps publishing. Battery power is positive while charging and negative while discharging. The portal ID in the topics is specific to my installation; replace it with yours. The broker name is a local DNS alias.
#!/bin/bash
# usage: lcd.sh 1 "72% -23W 145W"
line="$1"
text="$2"
stty -F /dev/ttyS1 1200
printf "M\f\x$(($line - 1)) %-16s" "$text" > /dev/ttyS1
The crontab refreshes the two lines independently:
*/1 * * * * /usr/bin/lcd.sh 1 $(/usr/bin/mqtt.sh)
*/5 * * * * /usr/bin/lcd.sh 2 $(df -h /dev/md3 | awk 'NR>1 {print $2, $3, $5}')
The core of the Node-RED decision is small. The rest is plumbing: topics, manual overrides, a virtual relay state and a debug output.
const SOC_CHARGE_ON = 20; // below -> mains charger on
const SOC_CHARGE_OFF = 80; // above -> mains charger off
const V_ON = 12.5; // below -> charger on
if (soc < SOC_CHARGE_ON || voltage < V_ON) {
relay = 0; // 0 = closed / charger on
} else if (soc >= SOC_CHARGE_OFF) {
relay = 1; // 1 = open / charger off
}
The MPPT has its own small state machine: off at 80 %, on again at 75 %, and a weekly window on Sunday from 11:00 to 16:00 that allows a charge to 99 %. The full flow is in solar_venus/akkuschutz_v2.json in my git repository. An earlier version switched relay 2; the current one uses relay 1 and also controls the MPPT mode.
what I learned
- The battery is a buffer, not a season. 1 kWh covers the night, not a cloudy week. If you want winter independence, you need more panels or less load, not just a bigger battery.
- Switch the source, not the load. A relay in the 12 V line is a reboot generator. A relay in the 230 V line of the charger is boring, which is what you want.
- Keep the island DC. A microinverter would feed the house, but the server would convert DC to AC and back to DC. The 12 V bus avoids two conversions and keeps the server independent of the house wiring.
- Keep the x86 server asleep. The T420 is useful for Immich, but leaving it on would eat the battery. Wake-on-LAN makes it a server only when I need it.
- Use the right machine. Immich on a Pi 4 works for a small library, but the machine-learning and transcoding jobs are not fun. The T420 is older, but it has the CPU and RAM for the job.
- Measure state of charge, not voltage. LiFePO4 voltage is flat in the middle. The SmartShunt is the part that makes the control loop honest.
- The NAS is the load that matters. Four disks at 8 W each are 32 W before the electronics. The Pis are almost noise in comparison.
- The wide-input picoPSU is mandatory. The plain 12 V version shuts down in the LiFePO4 charge window. The WI version also regulates its 12 V rail.
- A 5 A 5 V converter is not enough for four Pis. It is fine at idle and marginal at boot. Use a 10 A module and short, thick USB cables.
- Fuse at the battery. A LiFePO4 pack can deliver a lot of current into a mistake. The main fuse belongs as close to the positive terminal as possible.
- The 230 V side is not a hobby project. Enclosure, strain relief, house MCB/RCD and a qualified person are part of the bill of materials. My enclosure has no own AC fuse or RCD; the house installation has to provide them — check it.
safety
This is a description of one installation, not a construction manual. If you copy it, keep the two voltage worlds apart:
- Put the 230 V side in its own compartment with covered terminals and strain relief. My solar enclosure has no separate AC fuse and no RCD; the branch relies on the house MCB/RCD, if they are present. If they are not, add them. Have the mains work checked by a qualified electrician.
- Fuse the battery positive at the terminal. Use cable and terminals rated for the short-circuit current, not just the 50 W load.
- Use a DC isolator and touch protection on the PV side. Check the cold-temperature Voc before connecting the panels.
- Do not charge LiFePO4 below 0 °C. Use a BMS with a low-temperature cutoff and keep the battery above freezing.
- Check with your landlord and insurer before drilling into a balcony railing. Wind load and water ingress are real.
further reading
The idea that a website has an energy budget is not mine. Low-tech Magazine's solar-powered site is the reference for treating a server as something that lives within the weather:
- Low-tech Magazine: solar-powered website
- Victron solar charge controllers
- Victron SmartShunt
- picoPSU-80-WI-32V
If you build something similar, start with the energy budget and the failure modes, not with the panels. The panels are the easy part.