This project started with a practical question: can a small home lab run like a disciplined microgrid instead of a set of independent devices fighting each other? I built a multi-node orchestrator that shifts loads by tariff, forecast, and battery health while preserving safety and comfort constraints.
![]()
Stock photo source: Wikimedia Commons.
Figure 1: Architecture linking metering, inverter gateway, and Rust-based schedule planner.
Core objective
The objective was not only lower bills. It had four equal goals:
- reduce energy cost,
- reduce peak import,
- protect battery lifetime,
- keep predictable behavior under outages.
Without explicit multi-objective tradeoffs, optimization tends to overfit one metric and harm the rest.
Hardware and edge topology
The deployment used:
- Arduino metering nodes with CT clamps,
- inverter/battery gateway using Modbus,
- Pi cluster running scheduling and observability services,
- relay domain for controllable circuits.
A strict separation was enforced between observation and actuation channels. This reduced risk of bad commands caused by telemetry glitches.
Scheduling model in Rust
The Rust scheduler solved a constrained planning problem in rolling windows. Inputs:
- short-term load forecast,
- tariff schedule,
- solar irradiance estimate,
- battery state and degradation model,
- circuit priority policy.
Output:
- per-circuit schedule,
- battery charge/discharge plan,
- confidence score + fallback plan.
I used conservative fallback when forecast uncertainty exceeded threshold, especially during volatile weather periods.
Reliability and fail-safe behavior
Critical fail-safe rules:
- priority circuits always preserved,
- relays had grace windows to prevent chatter,
- inverter disconnect triggers immediate fallback profile,
- command bus had idempotent replay protection.
If cluster services failed, local Arduino logic held safe defaults until planner recovery.
Observability and operator control
The dashboard included:
- cost and peak demand curves,
- battery stress indicators,
- per-circuit state timeline,
- override actions with audit trail.
The audit trail was essential for tuning. Manual overrides showed where the algorithm disagreed with human priorities.
Pilot results
Figure 2: 10-week pilot impact on cost, peak demand, and battery stress.
Measured improvements:
- grid energy cost down 28 percent,
- peak import reduced by 34 percent,
- battery stress index improved by 16 percent,
- zero unexpected inverter disconnects after fallback hardening.
The biggest hidden win: predictable behavior during partial outages. Operators trusted the system because it failed safely.
What went wrong initially
Early mistakes:
- too aggressive load shifting near tariff boundaries,
- underestimating inverter ramp limitations,
- insufficient visibility into forecast uncertainty.
Fixes:
- ramp-aware transition constraints,
- uncertainty bands in planner UI,
- per-circuit minimum hold times.
Why this is a special project
It combines embedded metering, edge optimization, safety logic, and human override workflow in one coherent system. Many home energy tools stop at monitoring. This one actively orchestrates while remaining explainable.
Next release plan
Planned expansion:
- neighborhood cooperative scheduling experiments,
- better probabilistic weather integration,
- battery chemistry-aware cycle planning,
- hardware-in-loop simulation harness for major planner changes.
For similar projects, make fallback logic boring and deterministic. Sophisticated optimization is valuable only when the failure modes are thoroughly engineered.