Inspiration

Cities face an energy crisis: outdated grids can't handle peak demand, renewable energy is unpredictable, and critical services like hospitals often suffer during shortages. We built NEO to fix that: an AI that allocates renewable and state grid energy fairly and efficiently in real time.

What it does

NEO (Nodal Energy Oracle) is an intelligent energy management system that: -Reads real-time data from distributed sensors (solar generation, voltage, temperature, humidity)

-Allocates power intelligently across 4 grid zones (hospitals → utilities → industrial → commercial)

-Protects critical services while maximizing renewable usage and economic benefit

-Enables conversational control through an AI chatbot

-Visualizes decisions on an interactive map with live power allocation overlay

-Simulates power allocation through various LED lights

How we built it

-Without a dedicated current/power sensor, we were forced to make a shunt resistor to measure Power. Due to resistor constraints, adding the shunt resistor lowered the current of the circuit by a great amount, meaning we had to scrap the idea of trying to represent every node (16 LEDs) to just four to represent each priority sector.

-We encountered significant noise and "ghost" readings from floating analog pins and possible current backflow. This led to unreliable data being fed into the AI manager's decision-making model. We solved this issue by creating a software workaround that always shuts off the city grid power when disconnecting the Arduino power.

-When the PWM driver wasn't actively pulling the signal to ground, the line would sometimes float, leading to flickering or unpredictable behavior in the city. We had to ensure that the internal pull-up resistors were either enabled or physically added to the breadboard to define a clear "High" state when the sink was inactive.

-The Python AI manager runs a 100ms serial control loop over USB, parsing live Arduino sensor strings and dispatching PWM commands back in real time. No networking, no latency buffer, just direct bidirectional serial communication.

-K2 Think V2 is called every 2 seconds with a full system snapshot including simulated time-of-day, duck curve demand forecasting, virtual battery state of charge, and live EIA New England electricity pricing. It returns a 16-channel PWM command array plus a plain-English reasoning string.

-The dashboard is a Flask + Socket.IO web app streaming live sensor data, reward score, and K2's reasoning log to the browser in real time.

-The reward scoring system runs every loop cycle, mathematically penalizing tier violations and relay clicks while accumulating commercial revenue, giving K2 a single optimization target rather than competing rules.

Accomplishments that we're proud of

-Moving away from the delay() function was a major turning point. By implementing non-blocking relay swap logic, we ensured the NEO could make real-time decisions without "freezing" every time it switched power sources.

-We resolved the "sink vs. pull" issue by implementing hardware-level pull-ups to eliminate floating states and using 4095 - x logic for inverted duty cycles.

-We adjusted the AI's logic to account for the Arduino's 10-bit ADC resolution, ensuring the "market economics" forecasting remained accurate despite hardware constraints.

-Getting K2 Think V2 to output strictly valid JSON in a hard real-time loop required significant prompt engineering. Reasoning models tend to burn their token budget on internal chain-of-thought, leaving nothing for the actual output. We solved this by capping thinking tokens and structuring the prompt to demand immediate JSON with no preamble.

-The duck curve demand model and simulated clock run entirely in software, letting NEO anticipate the 7pm residential spike and proactively charge the virtual battery at 4pm, before the crisis hits rather than reacting to it.

What we learned

-Real-Time Responsiveness via Non-Blocking Code: Moving away from the delay() function was a major software milestone. We learned how to use state machines and timing intervals to ensure the AI Manager remains "awake" and responsive to sensor data even while executing power swaps.

-Hardware Resolution as a Logic Constraint: Working with the Arduino’s 10-bit ADC showed us how hardware limitations define software capabilities. We learned to adjust our "market economics" and "grid stability" algorithms to account for the fact that tiny voltage drops might be invisible to the controller.

-Predictive vs. Reactive Control: We realized that a true "Oracle" can’t just react to a light sensor in real-time. This project taught us that for a grid to be stable, the AI needs to anticipate changes, like cloud cover or load spikes, rather than just responding once they happen.

-System Integration is the Real Challenge: The hardest part wasn't writing the code or soldering the wires; it was getting the two to talk to each other reliably. We learned that signal integrity is just as important as the algorithm itself when the AI's decisions have physical consequences.

-Prompt engineering for constrained output is genuinely hard. Getting a 70B reasoning model to reliably output a specific JSON schema under token pressure taught us that system prompt structure matters as much as model capability.

-Real-time AI in a hardware loop has a different failure mode than web apps. When K2 returns malformed JSON at 2am, the city goes dark. We built fallback safe-state logic so the grid always has a default command even when the AI errors out.

What's next for Nodal Energy Oracle (NEO)

-The immediate next step is to move from open-loop calculations to a fully automated "Surplus & Battery" logic. This involves using power sensors to find the exact power consumed and produced. When to draw from the bench supply versus keeping the solar grid.

-While we currently manage a virtual state grid battery, the next hardware phase involves integrating a physical Li-ion or LiFePO4 storage unit. This will test the AI's ability to manage real-world charging cycles and protection circuits.

-Scaling NEO into a city-scale AI grid controller by expanding to a Raspberry Pi with 16-bit precision sensing, physical battery storage, high-precision predictive modeling, and a real-time telemetry dashboard to enable autonomous, decentralized energy trading across massive metropolitan microgrids.

Built With

Share this project:

Updates