Inspiration

The University of Chicago surveyed and found that 4 in 10 U.S. adults are "extremely" or "very" concerned about artificial intelligence's environmental impact. I want to create an app to show that AI can actually help us reduce our carbon footprint! I drive an EV, and I discovered I pay a lot less for home charging when I charge during "off-hours," instead of midday or in the evening. My application helps people across the US pick the best time based on local power grid data to run their electrical appliances, reducing carbon emissions and saving money.

What it does

My app accesses available APIs to get information about the user's local grid data, with options to fall back to generally available information and make inferences if an API is unavailable. Based on the type of appliance the user intends to run, the app tells them the carbon and money savings they will have if they run their appliance at the recommended time.

How I built it

I used ChatGPT with 5.6 Sol to refine the idea for my app and create documentation (markdown files) to guide Codex in creating the app. I then had GPT generate prompts for each pass with Codex. I gave these instructions to Codex in checkpoints, starting with 6 checkpoints for base functionality, then 4 passes to refine the UI. I then did another 7 checkpoints to upgrade the functionality and API usage of the app, finishing with 4 more passes to debug the app and refine the UI again. I would put Codex outputs into GPT, having it evaluate progress and generate the prompt for the next checkpoint when the current one was sufficiently completed.

Challenges I ran into

I discovered that the API provided by the US Energy Information Administration gives data about grid balancing authorities across the US, but it did not provide a way to link user locations to their relevant balancing authority. I ended up parsing a spreadsheet from the Department of Energy, making a lightweight version that is loaded into my app's backend at runtime. The app searches a ZIP code provided by the user, finds their relevant balancing authority, and uses the EIA API to pull the grid data for that area. This took me a considerable amount of time to figure out. I also encountered issues with using the OpenAI API to run my app's AI chatbot, Spark. The backend was having connectivity issues. After using my browser's dev tools, I discovered Spark was rejecting the OpenAI API's output since it was expecting a slightly different JSON format. After a few changes, Spark works great!

Accomplishments that I'm proud of

I'm very proud of the multi-layer strategy used to map a user's ZIP code to their local grid balancing authority and then pull the data relevant to them. This was pretty big for me. I'm also proud of the UI. It looked terrible at first, but after a couple ~25 minute coding passes, I got Codex to fix it and implement some graphics I generated, creating a friendly and easy-to-use UI.

What I learned

I learned a lot about API usage, including expected inputs and outputs, importance of protecting keys, and how to control key access on the OpenAPI dashboard. I learned a lot about Git, including commit commands and creating checkpoints I can return to if future changes go haywire. I also learned a ton about how the US power distribution system works. I was quite happy to learn that using electrical appliances at an optimal time can add up to huge savings in carbon output. Seeing the real data from my APIs while using this project really impressed that on me.

What's next for PowerPal

I intend to turn PowerPal into a live web service where users can sign up, get appliance usage recommendations, and view their personalized history, stats, and reminders. I plan to make a mobile app as well, hoping to extend access to this tool to as many people as possible. I hope this app can help us all improve our carbon footprint together!

Built With

  • codex
  • data
  • doe
  • eia
  • eslint
  • fastapi
  • gpt-5.6
  • httpx
  • localstorage
  • openai
  • openpyxl
  • pydantic
  • pytest
  • python
  • react
  • responses
  • rest
  • ruff
  • typescript
  • uvicorn
  • vite
  • vitest
  • zod
  • zustand
Share this project:

Updates