Inspiration

As an 8th-semester computer science engineering student deeply interested in machine learning and full-stack software development, I wanted to build a project that tackles a practical, real-world problem. Energy management is critical for both cost reduction and grid stability. I realized that while complex microgrid data exists, it is rarely accessible or understandable to the average user. I wanted to bridge that gap by combining predictive machine learning with a conversational AI assistant, creating a platform that doesn't just show data, but actually explains how to optimize it.

What it does

MicroGrid AI is a modern energy intelligence platform that predicts electricity demand, analyzes renewable solar potential, and provides real-time optimization insights. It uses real-time weather data to feed a predictive machine learning model, generating a comprehensive dashboard with 24-hour forecasts and efficiency scores. The standout feature is GridSense AI, an integrated chatbot that reads the user's live dashboard data like predicted demand and solar potential and provides exactly three highly contextual, actionable tips to reduce electricity costs and optimize appliance usage.

How we built it

The platform is built on a fully decoupled, cloud-deployed architecture: Frontend: A responsive web application built using React and Vite, featuring interactive Recharts for data visualization and a custom floating chatbot interface. It is hosted globally on Vercel. Backend: Driven by FastAPI and Python, and deployed live on an AWS EC2 instance. Predictive Engine: We trained an XGBoost Regressor on 5,000 synthetic samples utilizing features like temperature, humidity, wind speed, cloud cover, and temporal data (hour, day of the week). For real-time context, the backend integrates with the Open-Meteo API. Generative AI: We utilized the Groq API to power GridSense AI with Llama 3.1, passing the calculated energy metrics securely into the LLM's system prompt to generate dynamic, data-driven advice.

Challenges we ran into

Bridging the gap between the live Open-Meteo API data and our XGBoost model's expected input format was trickier than expected. Because the model was trained on a specific synthetic dataset, we had to carefully normalize the incoming live weather data and implement logic to clamp extreme values to prevent the model from generating unrealistic predictions.

Furthermore, we faced significant hurdles during cloud deployment. We had to configure Vercel proxies to resolve HTTPS/HTTP Mixed Content blockers, and manage detached background processes on our Ubuntu server to ensure the backend remained alive and stable 24/7.

Accomplishments that we're proud of

Achieving an R^2 ~ 0.92 score on our XGBoost predictive model. Successfully deploying a decoupled full-stack application to the cloud (Vercel + AWS EC2) so it is live and accessible. Successfully bridging predictive ML and generative AI, allowing the chatbot to act as an interpreter for the raw mathematical data. Creating a beautifully seamless UI where the AI chat widget feels native, responsive, and highly interactive. Building a privacy-first system that requires no user accounts or persistent tracking to deliver high-value insights.

What we learned

Building MicroGrid AI forced me to figure out how to actually connect the dots between different tech stacks in a production environment. Getting a trained XGBoost model to serve predictions via FastAPI was one thing, but piping that live data into an LLM was the real challenge. I spent a lot of time dialing in the prompt engineering specifically, forcing the Llama model to drop the conversational fluff and strictly format its output so the frontend could parse it. On the React side, I had to figure out how to properly render the AI's Markdown and manage state so the chat UI didn't break or freeze while waiting for asynchronous API calls. Overall, it taught me what it actually takes to build a decoupled architecture that holds together in practice.

What's next for MicroGrid AI

The immediate next step is integrating real IoT sensor data rather than relying purely on weather-based estimations. I also plan to implement user accounts so people can track their energy savings over time, and eventually develop a mobile application to send push notifications when optimal solar generation windows open up.

Built With

Share this project:

Updates