By Evelyn Chin
When starting out with small simple projects, it's easy to feel discouraged by how insignificant their impact might seem. But in this project, I tried my hand at keeping it simple, while tackling a bigger problem: climate change.
Flux aims to reduce a user's carbon footprint and mitigate fluctuations in demand by periodically informing them of their regional power grid's demand through SMS text messaging. I'll be showing you how to build this out yourself so you can decrease your carbon footprint too.
Prerequisites
- An Azure Subscription (can be created for free)
- A Twilio account (can be created for free)
- Visual Studio Code with the Azure Static Web Apps (Preview) extension installed
Overview: How Flux Works

- Azure Static Web Apps hosts a remote website that takes in basic user data through an HTML5 form.
- Azure Cosmos Databases receives and stores the inputted data as a document.
- The Azure Function periodically shoots a signal every hour to request power demand data from the U.S. Energy Information Administration API, and returns it to the Function.
- The Function calculates the quartiles of the average demand over the past 24 hours, and determines if the most recent demand data is an anomaly.
- If the demand from the previous hour is considered an outlier AND a change from the previous demand state, the Azure Function will send the message to the Twilio API.
- Finally, Twilio accepts the array of messages for each user and sends them to each mobile number.
If you want to see what your code will look like in the end, check out my Github repo flux
!
Setting Up Databases
First, we'll use Azure Cosmos Databases to store users' names, phone numbers, and states/regions.
- Create a Cosmos DB account from the Azure Portal.