Anyone else using a Raspberry Pi to log their battery stats overnight?

by Mountain Barry · 3 weeks ago 36 views 5 replies
Mountain Barry
Mountain Barry
Active Member
15 posts
Joined Jan 2025
3 weeks ago
#18812

Been running a Pi Zero 2 W for about eight months now logging my Fogstar Drift 200Ah LiFePO4 stats overnight — honestly one of the best things I've done for understanding my system.

I've got it pulling data from my Victron BMV-712 via the VE.Direct cable into a little Python script that dumps everything into InfluxDB, then Grafana for the pretty graphs. Nothing groundbreaking, plenty of guides out there, but seeing the overnight discharge curves across different seasons has been genuinely eye-opening.

What surprised me most was discovering I had a phantom load somewhere draining about 18W I hadn't accounted for. Only spotted it because the overnight graphs showed this consistent, suspicious floor that didn't match what I thought I had switched off. Turned out to be an old inverter sitting in standby. Saved me a fair bit of battery wear once I sorted it.

A few things worth knowing if you're just starting:

  • The Pi itself draws around 1–2W on the Zero 2, which matters when you're counting every watt at a cabin
  • Keep your SD card writes minimal — log to RAM and flush periodically, or the card will die within a year
  • VE.Direct to USB cable from Victron is the easy route, no messing about

Running mine off a separate small panel and a cheap 20Ah SLA purely so the monitoring doesn't interfere with the main bank readings.

Anyone else doing something similar? Curious whether anyone's gone further and set up automated alerts — I've been thinking about a Telegram bot to ping me if the SOC drops below a threshold overnight.

Simon Kelly
Simon Kelly
Regular
60 posts
thumb_up 35 likes
Joined Jun 2023
3 weeks ago
#18824

@MountainBarry great project — I've been doing something very similar with my motorhome setup for about 18 months now.

One thing worth adding to your logging stack: pull the Victron VE.Direct data alongside your battery stats if you haven't already. The vedirect Python library makes this relatively painless, and correlating your MPPT charge current against the Fogstar's voltage recovery curve overnight has been genuinely eye-opening for spotting subtle capacity fade.

I'm logging to InfluxDB + Grafana running locally on a Pi 4, which lets me overlay:

  • Battery temp vs charge acceptance rate
  • Resting voltage vs true SoC
  • Overnight parasitic drain

The parasitic drain graph alone justified the whole exercise — found a relay chattering away drawing ~800mA that I'd never have noticed otherwise.

Worth setting up data retention policies in InfluxDB early on, otherwise the SD card fills surprisingly fast.

Cleggy
Cleggy
Active Member
38 posts
thumb_up 24 likes
Joined Aug 2023
3 weeks ago
#18836

@MountainBarry this is exactly the kind of project I've been meaning to tackle — what library are you using to pull the data? Is it going straight into something like InfluxDB/Grafana or just flat CSV files?

I've got a Victron SmartShunt on my 280Ah Fogstar setup and I know I could just use VRM, but I like the idea of having full local control of the data, especially for overnight EV charging sessions where I want to correlate battery discharge rate against actual miles added.

Do you find the Pi Zero 2 W has enough grunt for the logging tasks, or does it struggle at all? I nearly went with a full Pi 4 but the power draw seemed counterproductive on an off-grid system 😄

Daily Solar
Daily Solar
Regular
73 posts
thumb_up 41 likes
Joined Mar 2023
2 weeks ago
#18880

@MountainBarry brilliant project — I've been doing almost exactly this for my cabin setup, though I went slightly mad and threw a full Pi 4 at it because I wanted to run Node-RED alongside the logging.

For anyone wanting to pull data from Victron kit specifically, the dbus-python library is your friend if you're running Venus OS on a Cerbo GX. Alternatively, Victron's MQTT broker is criminally underrated for this — expose it on your local network and your Pi can subscribe to essentially every parameter your system knows about.

For LiFePO4 cells specifically, logging the tail current at full charge is genuinely revelatory. That single metric has told me more about my Fogstar cells' actual state of health than anything else.

@Cleggy minimalmodbus is worth investigating if your BMS has RS485 — surprisingly painless to set up.

Crispy Mender
Crispy Mender
Active Member
11 posts
Joined Apr 2025
2 weeks ago
#18905

@MountainBarry solid setup. I've been running something similar at my cabin using a Pi 4 (overkill, I know) pulling data from my Victron SmartShunt via the VE.Direct USB cable into a Python script that writes to InfluxDB, then visualised through Grafana. The overnight resting voltage curves are genuinely fascinating once you've got a few weeks of data stacked — you can spot cell imbalance creeping in long before the BMS starts complaining.

One thing worth adding: I've got a watchdog timer configured so if the Pi locks up overnight I'm not flying blind come morning. Also running it on a small UPS hat so a brief grid blip doesn't corrupt the SD card mid-write — lost one that way before I got smart about it.

Burn Walker
Burn Walker
Active Member
36 posts
thumb_up 28 likes
Joined Mar 2023
2 weeks ago
#19026

Does this actually hold up when the Pi loses power mid-night though? I've had issues on my narrowboat where shore power cuts unexpectedly and corrupts the SD card, which then takes the logging setup with it. Running a Victron SmartShunt here and the built-in history is passable but I'd rather have proper granular overnight data pulled somewhere more reliable.

Is anyone writing to an external SSD instead of the SD card? Or running the Pi off the actual battery bank so it stays up regardless of shore power? Seems like the obvious solution but curious whether the USB boot route causes other headaches.

Also what's the minimum viable hardware — does it actually need to be a Pi or will one of the cheaper Raspberry Pi alternatives handle this without faffing about with driver compatibility?

Log in to join the discussion.

Log In to Reply