Inspiration
Imagine you're at home on the third day of a heat wave. It's 110 °F outside. Your AC is the only thing keeping your house bearable, and your grandma's oxygen machine is humming in the next room.
Then everything goes quiet. The AC stops! The machine stops!! The power is out!!!
It's not just your house. Every AC in town was running at once, the power line overheated, and it shut off. The hospital is on backup. The fire station is on backup. Your street is just dark.
Here's the frustrating part: there was almost enough power. Not enough for everyone, but enough for the people who needed it most, if someone had shared it carefully.
And this is just one of the worst things that could happen. It can get even worse:
- A hospital runs out of backup fuel while patients are on ventilators.
- The fire station loses power just as a wildfire starts nearby.
- An elderly neighbor living alone overheats, with no AC and no way to call for help.
- Insulin and medicine spoil in fridges that have stopped running.
- Cooling centers go dark, so people have nowhere safe to go.
The solution to this is brought by our project, Headroom. It's a smart controller for a neighborhood's power line. When a heat wave leaves too little electricity to go around, Headroom shares it by priority, plans hours ahead, and makes sure the line never overloads. Your grandma's machine stays on. The hospital stays on. And your AC? It might get turned down for an hour, but your house was cooled early, because Headroom predicted the heat peak hours before it hit. So you stay safe, and you get paid for the power you gave up.
Today, utilities mostly wait for the line to fail, or cut power to whole neighborhoods in turn. Nobody asks who needs the power most. We wanted to change that.
What it does
Every power line has a safe limit: the most electricity it can carry before it overheats. The gap between what the town is using and that limit is the line's headroom. That's where our name comes from.
In a heat wave, the headroom shrinks from both sides:
- Everyone uses more, because every AC is on.
- The line can safely carry less, because on a hot day with little wind, the wire can't cool down as well.
When the town uses more than the line can safely carry, the line overloads and shuts off for everyone.
Headroom keeps that from happening. Every 15 minutes it decides how much power each building gets:
- Hospitals, fire stations and people on medical equipment come first. Always. A home never gets power that a hospital needs.
- Everyone else shares what is left.
- The line never goes over its safe limit.
And it doesn't just react. It starts preparing 72 hours before the heat arrives, and every hour it plans the next 48 hours:
- Days before the heat, it charges every backup battery to full.
- Hours before the peak, it cools homes down early, so they can go without AC for a while and stay safe.
- Before prices spike, it books backup batteries and trucks.
- After the heat, it pays every home for the power it gave up.
See it for yourself
- 🌐 Play your own heat wave: headroom.wiki. Scan the QR code at our table, or open it on your phone. Every visitor gets their own town.
- 🏘️ At our table: a working model town. Buildings switch between grid, battery and off. LEDs show who has power. A fan blows "wind" on the power line and a servo shows the wire sagging in the heat. Put a toy battery truck on a dock and Headroom uses it right away.
The results
We ran the same 6-day scenario with two controllers: Headroom, and a simple one that only reacts to what is happening right now. The scenario is 3 days to prepare, a 2-day heat wave, then a 24-hour wildfire shutoff.
| Simple controller | Headroom | |
|---|---|---|
| Times the line overloaded and shut off | 5.7 | 0 |
| Hours the hospital, fire station or medical homes were unsafe | 23.2 | 0 |
| Hottest the wire got | 102.5 °C | 73.6 °C |
| Money spent | $16,000 | $17,509 |
Headroom spends about 9% more and gets zero shutoffs. The extra money goes to backup it booked early. That's the whole idea: a little planning ahead costs far less than a blackout.
How we built it
The brain: a planner on a Raspberry Pi
All of Headroom's decisions are made on the device, at the edge of the grid. A Raspberry Pi sits next to the neighborhood and collects real-time data from two places:
- Sensors on the table, several times a second: the current flowing to every building, the air temperature, sunlight, and how much the power line sways in the wind. It also senses which dock each backup truck is parked at.
- Live weather forecasts, every 30 minutes: from the National Weather Service, Open-Meteo and the Storm Prediction Center, collected by our Apify Actor.
With that data, it re-plans the whole town's power every 15 minutes. It plans at two speeds:
| How often | Looks ahead | Decides | |
|---|---|---|---|
| Big picture | Every hour | 48 hours | Batteries, backup trucks, spending |
| Right now | Every 15 minutes | 2 hours | Exactly how much power each building gets |
This method is called model predictive control. Each plan is a math problem that we solve with HiGHS, a free optimization solver. The forecast is never certain, so the big-picture plan considers several possible futures at once and picks a plan that works in all of them. We used the IEEE 738 standard to work out how much electricity a hot wire can safely carry.
The planner runs on the Pi itself. It needs no internet, which matters, because the internet often goes down in a heat wave too.
The model town
- ESP32-S3 (the town): 16 relays switch each building between grid, backup and off. Current sensors measure every building. Magnet sensors detect the toy battery trucks. An LED strip shows each building's status.
- Arduino Uno (the power line): a fan for wind, a servo for wire sag, an LCD that shows the headroom left, and a buzzer for warnings. Its sensors read the real temperature, light and line sway, and Headroom reacts to them live.
- Safe by design: if a board resets or a cable falls out, every building goes back on the grid. The hospital, fire station and medical homes are never left off.
The money: an autonomous treasury
Headroom runs its own emergency budget, with a hard cap of $19,000. It approves small spending on its own. Anything over $3,000 waits for a human to approve it on the dashboard, with a 30-second timer. Every payment is recorded in a ledger that always balances, and payouts are sent through Capital One's Nessie API.
Our sponsors' tools
- Capital One Nessie: pays every home for the power it gave up.
- Apify: our own Apify Actor collects live forecasts from the National Weather Service, Open-Meteo and the Storm Prediction Center every 30 minutes, so Headroom always has fresh weather, even on venue Wi-Fi. Apify actor id - P12gzIgnmPUpEeeKm
- Cartesia: reads alerts out loud, like "The line is down. The hospital is on battery."
- Claude: explains every decision in plain English. It only explains. The planner makes the decisions.
- Tiger Data: saves every step of every storm, so you can look back at past heat waves.
- Vultr: hosts headroom.wiki, with 5 heat waves running at once.
Challenges we ran into
- Getting two planners to work together. Our second challenge was coordinating a 48-hour planner with a 15-minute planner. The fast one has to follow the slow one’s plan, never break the priority order, and never push the wire past a safe limit that keeps changing with the heat and wind. And it all has to run live on a Raspberry Pi. We got there by splitting the work cleanly between the two planners and shrinking the big-picture problem for live use, so the town keeps moving while the next plan is solved.
- *The Planner * The planner has to commit to decisions, like booking backup batteries, before it knows exactly when the heat will peak or how long the shutoff will last. A plan built on one forecast breaks as soon as the weather changes. We solved this by having the planner plan for several possible versions of the storm at once and choose the plan that keeps everyone safe in all of them, then re-plan every 15 minutes as the real weather comes in.
- We switched boards halfway through. We moved from an Arduino Mega to an ESP32-S3. We had to remap every pin around the parts of the ESP32 that are off-limits, and add small circuits so 5 V sensors don't damage its 3.3 V pins.
- Making it fail safely. We wired every relay so that a dead board means everyone is back on the grid, not everyone in the dark.
Accomplishments that we're proud of
- Zero shutoffs and zero unsafe hours for the most important buildings in our tests.
- One brain, three places: the same planner runs in our simulation, on our public website and on a physical table.
- A real working model town that reacts to real sensors.
- More than 450 automated tests, covering the planner, the money and the hardware messages.
What we learned
- In a heat wave, the hard part isn't making more power. It's deciding, hours ahead, who gets the power that is there.
- Forecasts are always a little wrong. Planning again every 15 minutes fixes that.
- With hardware, plan for failure first. What happens when a cable comes out matters as much as what happens when everything works.
What's next for Headroom
- Real data: run it on a real power line's data and the live forecast, every day.
- Smarter demand: learn how much power each building really needs from its meter history.
- A real pilot: test it with a community microgrid or a utility's wildfire shutoff program, where a priority list already exists on paper.
Built With
- anthropic-claude
- apify
- arduino
- c++
- capital-one-nessie
- cartesia
- css
- docker
- esp32
- fastapi
- highs
- html
- javascript
- national-weather-service-api
- numpy
- open-meteo
- pandas
- pydantic
- pyserial
- python
- raspberry-pi
- tiger-data
- uvicorn
- vultr
- websockets
Log in or sign up for Devpost to join the conversation.