For this group project, we worked with our client Steve, the director of IT, ETC. Steve runs meetings in the ETC boardroom but is frequently interrupted by the loud compressor that turns on at random. He can't unplug the fridge for the whole day, and removing it is not an option. So we came up with a plan to create a Fridge Controller to turn the fridge off and back on at specific times.
What we built
Our Fridge Controller turns the fridge in the meeting room off while a meeting is happening, so its noise doesn't interrupt anyone, and turns it back on when the meeting is over. The fridge plugs into the controller instead of the wall. The controller checks the room's calendar, and when a meeting starts, it turns the fridge off and shows how much time is left in the meeting on its display. When the time runs out, the fridge turns back on by itself. If a meeting isn't on the calendar or goes long, you can press the left button (MEETING START) to add time. If everyone leaves early, the right button (MEETING OVER) sets the clock back to 00:00 and the fridge turns on right away. The buttons still work if the Wi-Fi is down.
In the photos and videos below, a lamp is plugged in instead of the fridge.
We add a meeting to the room's Google Calendar on a laptop. After about 10 to 20 seconds, the display starts counting down the time left in the meeting and the lamp (standing in for the fridge) turns off.
The Fridge Controller during a meeting. The display shows the time left (00:40 here, in demo mode, where one press adds one minute). The lamp is off because there is still time on the clock.
With no meeting on, the display reads 00:00 and the lamp is on. (This photo has an older print of the button labels.)
The PowerSwitch Tail II is what actually turns the fridge on and off. The fridge plugs into it, and it plugs into the wall. The controller sends it a low voltage on/off signal through the orange and white wires, so our electronics never touch the wall power.
Inside the front panel: the display's driver board (top left), the two buttons held in with hot glue, and a small breadboard that shares power and ground between the parts. The ESP32 is at the right edge.
The ESP32 board connects to the campus Wi-Fi, checks the calendar, runs the timer, and tells the PowerSwitch Tail what to do. It is about the length of a thumb and is powered over USB.
The box opened up during assembly, with the display, buttons, breadboard, ESP32 and PowerSwitch Tail wired together. "FRIDGE CONTROLLER" is printed into the side of the case.
The finished controller in demo mode, where each press adds one minute instead of one hour. The clock counts down and the lamp stays off. Pressing MEETING OVER sets the clock to 00:00 and the lamp turns on. Pressing MEETING START adds time and the lamp turns off again.
Steve has a two-hour meeting in the Boardroom at 2pm on Thursday. It has been on the room's calendar for weeks. At 2:00 the fridge in the corner goes quiet, and the controller on the counter shows 02:00, then 01:59. Near the end, the group decides to keep talking, so Steve presses MEETING START once and the clock goes up by an hour. At 4:40 people start packing up. On his way out, Steve presses MEETING OVER. The display goes to 00:00 and the fridge starts humming again. The next morning the drinks are still cold, and nobody had to remember to plug the fridge back in.
We had learned through interviewing Steve that:
He wanted a timer that would be noticeable from far away
The fridge controller should be able to attach to the fridge and should be easy to put on/remove
The fridge controller should have a simple design
Originally, we had thought that extra features on the fridge controller would make it easier to understand. So, when building our prototype, we added both a NeoPixel ring and a seven-segment display to show the timer. The seven-segment display would show the timer, while the NeoPixel display would run its own countdown by turning off one light every few minutes. It also included a small LED on the bottom to indicate when the fridge was on. When we showed our prototype to Steve, he suggested simplifying the whole thing to make it less confusing for someone encountering the machine for the first time. While he personally didn't mind the two timers, he acknowledged that it could seem unclear whether or not the two timers served the same purpose. He had also mentioned that our project needed clear labelling to make the project's function as clear as possible. We ended up taking his advice on both of the major issues the project was having and only used the seven-segment display for the time. We had also workshopped a few ideas for labelling to put by the two buttons to make the function of the project obvious.
The final critique had gone well, and we had gotten a lot of positive feedback on the overall look and simplicity of our project. We had also received positive comments on the labeling and instructions on the side for any first-time users. There were many comments that we would’ve definitely implemented if given more time. One comment that we had gotten a few times was having a certain failsafe or alarm if the refrigerator has been off for too long. This would be a good idea for back-to-back meetings.
Thanks to the great input from our client Steve, we had gotten to learn the importance of testing our project with real people early on. Without testing, we wouldn’t know what parts of the project would seem unnecessary or confusing to anyone viewing the fridge controller for the first time. Another thing that we learned is that simple isn’t always simple to achieve. Steve only needed two buttons and a timer for the fridge controller. Being clear on what the buttons do and the actual purpose of the controller was a surprisingly difficult task that we had spent some time working on. We had also had to work on the labeling and instructions for a long time because the function of the fridge controller is not very intuitive to others. Labeling the buttons MEETING START and MEETING OVER fixed the on means off confusion.
The two buttons use the ESP32's internal pull-up resistors, so they don't need their own resistors.
About every half second, the ESP32 asks our Google Apps Script over Wi-Fi if there is a meeting in the room's calendar and how much time is left.
Below is the code that runs on the ESP32. The Wi-Fi login and the Apps Script URL are in a secrets.h file that we are not posting.
/*
Fridge Controller
by the Elderberries: Kaito Seto, Fion Hanaoka, Zoe Bartholomew
60-223 Intro to Physical Computing, Fall 2026
This code turns the meeting room fridge off during meetings so its noise
doesn't interrupt them. The ESP32 connects to CMU-SECURE and keeps asking
a Google Apps Script web app (linked to the room's Google Calendar) if a
meeting is on right now. The script answers "ACTIVE,<seconds left>" or
"IDLE". The time left is shown on a 4-digit 7-segment display. While there
is any time left, the PowerSwitch Tail is off, so the fridge is off. At
00:00 the fridge turns back on.
The two buttons work even without Wi-Fi. MEETING START adds 1 hour
(1 minute in DEMO_MODE). MEETING OVER sets the timer to 00:00 and ignores
the calendar until the current meeting ends. The display shows HH:MM
normally and MM:SS in DEMO_MODE, which we used at the final crit so the
countdown is easy to see.
Pin mapping:
ESP32 pin | role | description
-----------|--------|-------------------------------------------------
21 I/O 7-segment display backpack SDA (I2C)
22 output 7-segment display backpack SCL (I2C)
19 input MEETING START button (other leg to GND, INPUT_PULLUP)
18 input MEETING OVER button (other leg to GND, INPUT_PULLUP)
23 output PowerSwitch Tail II +in (-in to GND); HIGH = fridge on
3V3, GND power 7-segment display backpack VCC and GND
The board is powered by a 5V USB power adapter. The Wi-Fi login and the
script URL are in a separate secrets.h file that we are not posting. It
needs to define USE_ENTERPRISE, WIFI_SSID, EAP_USERNAME, EAP_PASSWORD,
HOTSPOT_SSID, HOTSPOT_PASSWORD and SCRIPT_URL.
Credit: the display uses the Adafruit LED Backpack and Adafruit GFX
libraries. WiFi, HTTPClient, WiFiClientSecure and Wire come with the
Espressif arduino-esp32 core, and the CMU-SECURE (WPA2-Enterprise)
WiFi.begin() line is based on its WiFiClientEnterprise example.
AI use: we used Claude Opus 5.5 (Anthropic) between October 26 and
November 13, 2026. Functions written with its help are marked with
"// written with help from Claude". The prompts we used (shortened):
"Help me connect an ESP32 to Google Calendar through Apps Script and
show the time left in the meeting on a 7-segment display"
"Make one button add time and the other button reset the timer"
"Connect the ESP32 to CMU-SECURE (WPA2-Enterprise)"
"The display freezes while it waits for the calendar, how do I fix it"
"Reduce the lag before the display updates"
This code is released to the public domain by the authors, November 2026.
*/
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>
#include "secrets.h" // not posted (Wi-Fi login and script URL)
const int RESET_BUTTON = 18; // MEETING OVER button
const int ADD_BUTTON = 19; // MEETING START button
const int RELAY_PIN = 23; // PowerSwitch Tail II "+in"
const int SDA_PIN = 21;
const int SCL_PIN = 22;
// DEMO_MODE for presentations: MEETING START adds 1 minute and the display
// shows MM:SS so the countdown is visible. false = 1 hour, HH:MM
const bool DEMO_MODE = true;
const unsigned long ADD_SECONDS = DEMO_MODE ? 60 : 3600;
const unsigned long CALENDAR_INTERVAL = 500; // pause between requests
const unsigned long WIFI_RETRY_INTERVAL = 30000; // enterprise login can be slow
Adafruit_7segment display = Adafruit_7segment();
uint8_t displayAddress = 0x70;
// time from the calendar and time added with the button are kept separately
unsigned long calendarSeconds = 0;
unsigned long manualSeconds = 0;
unsigned long lastSecond = 0;
unsigned long lastCalendarCheck = 0;
unsigned long lastWifiAttempt = 0;
bool lastResetButton = HIGH;
bool lastAddButton = HIGH;
// after MEETING OVER, don't let the same meeting restart the timer
bool ignoreCalendarUntilIdle = false;
// written with help from Claude
// calendar fetch runs on its own task so the display never freezes
// during the HTTP request; it hands results to loop() through these
volatile bool calendarResultReady = false;
volatile bool calendarActive = false;
volatile unsigned long calendarResultSeconds = 0;
void setup() {
Serial.begin(115200);
// buttons connect the pin to GND when pressed
pinMode(RESET_BUTTON, INPUT_PULLUP);
pinMode(ADD_BUTTON, INPUT_PULLUP);
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, HIGH); // fridge on at startup
Wire.begin(SDA_PIN, SCL_PIN);
displayAddress = findDisplayAddress();
display.begin(displayAddress);
display.setBrightness(10);
updateDisplay();
WiFi.mode(WIFI_STA);
WiFi.onEvent(onWiFiEvent);
// list nearby networks once, to check CMU-SECURE is visible
int n = WiFi.scanNetworks();
for (int i = 0; i < n; i++) {
Serial.printf("SCAN %s ch%d %ddBm auth%d", WiFi.SSID(i).c_str(),
WiFi.channel(i), WiFi.RSSI(i), WiFi.encryptionType(i));
Serial.println();
}
WiFi.scanDelete();
startWiFi();
// run the calendar requests on core 0, separate from loop()
xTaskCreatePinnedToCore(calendarTask, "calendar", 12288, NULL, 1, NULL, 0);
lastSecond = millis();
}
void loop() {
readButtons();
updateTimer();
updateFridge();
// keep trying Wi-Fi in the background; buttons keep working offline
if (WiFi.status() != WL_CONNECTED &&
millis() - lastWifiAttempt >= WIFI_RETRY_INTERVAL) {
startWiFi();
}
static bool wasConnected = false;
if (WiFi.status() == WL_CONNECTED && !wasConnected) {
Serial.print("WiFi connected, MAC ");
Serial.println(WiFi.macAddress());
}
wasConnected = (WiFi.status() == WL_CONNECTED);
applyCalendarResult();
checkDisplayConnection();
updateDisplay();
}
// written with help from Claude
// if the display was unplugged or powered up late, set it up again
void checkDisplayConnection() {
static unsigned long lastCheck = 0;
static bool wasConnected = true;
if (millis() - lastCheck < 2000) return;
lastCheck = millis();
Wire.beginTransmission(displayAddress);
bool connected = (Wire.endTransmission() == 0);
if (!connected) {
displayAddress = findDisplayAddress();
} else if (!wasConnected) {
display.begin(displayAddress);
display.setBrightness(10);
Serial.println("7-segment reconnected");
}
wasConnected = connected;
}
// the backpack can be set to any address 0x70-0x77, so look for it
uint8_t findDisplayAddress() {
for (uint8_t addr = 0x70; addr <= 0x77; addr++) {
Wire.beginTransmission(addr);
if (Wire.endTransmission() == 0) {
Serial.print("7-segment found at 0x");
Serial.println(addr, HEX);
return addr;
}
}
Serial.println("7-segment not found, using 0x70");
return 0x70;
}
// written with help from Claude
// print why Wi-Fi drops, to debug CMU-SECURE logins
void onWiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
if (event == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) {
Serial.print("WiFi disconnected, reason ");
Serial.println(info.wifi_sta_disconnected.reason);
} else if (event == ARDUINO_EVENT_WIFI_STA_CONNECTED) {
Serial.println("WiFi associated");
} else if (event == ARDUINO_EVENT_WIFI_STA_GOT_IP) {
Serial.print("WiFi got IP ");
Serial.println(WiFi.localIP());
}
}
// written with help from Claude
// connect to CMU-SECURE, or a phone hotspot for testing (set in secrets.h)
void startWiFi() {
lastWifiAttempt = millis();
Serial.print("Connecting to WiFi... status ");
Serial.println(WiFi.status());
WiFi.disconnect();
if (USE_ENTERPRISE) {
// WPA2-Enterprise (PEAP) for CMU-SECURE
WiFi.begin(WIFI_SSID, WPA2_AUTH_PEAP, EAP_USERNAME, EAP_USERNAME, EAP_PASSWORD);
} else {
WiFi.begin(HOTSPOT_SSID, HOTSPOT_PASSWORD);
}
}
// written with help from Claude
// background task: ask the calendar again as soon as the last answer arrives
void calendarTask(void* param) {
for (;;) {
if (WiFi.status() == WL_CONNECTED) {
checkCalendar();
}
vTaskDelay(CALENDAR_INTERVAL / portTICK_PERIOD_MS);
}
}
// called from loop(): use the newest calendar answer, if any
void applyCalendarResult() {
if (!calendarResultReady) return;
calendarResultReady = false;
if (calendarActive) {
if (!ignoreCalendarUntilIdle) {
calendarSeconds = calendarResultSeconds;
}
} else {
calendarSeconds = 0;
ignoreCalendarUntilIdle = false;
}
}
// written with help from Claude
// one HTTPS request to the Apps Script web app
// it answers "ACTIVE,<seconds left>" or "IDLE"
void checkCalendar() {
WiFiClientSecure client;
client.setInsecure(); // prototype only: skips TLS certificate check
client.setHandshakeTimeout(6); // give up fast on a stuck handshake and try again
client.setTimeout(6000);
HTTPClient http;
if (!http.begin(client, SCRIPT_URL)) {
Serial.println("HTTP begin failed");
return;
}
// Apps Script answers with a redirect to googleusercontent.com
http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
int httpCode = http.GET();
if (httpCode == HTTP_CODE_OK) {
String response = http.getString();
response.trim();
Serial.print("Calendar: ");
Serial.println(response);
if (response.startsWith("ACTIVE,")) {
calendarResultSeconds = response.substring(7).toInt();
calendarActive = true;
calendarResultReady = true;
} else if (response.startsWith("IDLE")) {
calendarResultSeconds = 0;
calendarActive = false;
calendarResultReady = true;
}
} else {
Serial.print("HTTP error: ");
Serial.println(httpCode);
vTaskDelay(200 / portTICK_PERIOD_MS); // short pause, then retry
}
http.end();
}
// react once per press, with a short debounce
void readButtons() {
bool resetButton = digitalRead(RESET_BUTTON);
bool addButton = digitalRead(ADD_BUTTON);
// MEETING START: add time
if (addButton == LOW && lastAddButton == HIGH) {
manualSeconds += ADD_SECONDS;
delay(50); // debounce
}
// MEETING OVER: clear the timer and ignore the current meeting
if (resetButton == LOW && lastResetButton == HIGH) {
calendarSeconds = 0;
manualSeconds = 0;
ignoreCalendarUntilIdle = true;
delay(50); // debounce
}
lastResetButton = resetButton;
lastAddButton = addButton;
}
// count both timers down once a second without delay()
void updateTimer() {
while (millis() - lastSecond >= 1000) {
lastSecond += 1000;
if (calendarSeconds > 0) {
calendarSeconds--;
}
if (manualSeconds > 0) {
manualSeconds--;
}
}
}
// any time left on the timer means the fridge should be off
void updateFridge() {
bool fridgeOff = (calendarSeconds + manualSeconds) > 0;
digitalWrite(RELAY_PIN, fridgeOff ? LOW : HIGH);
}
// show the time left with the colon on
void updateDisplay() {
unsigned long totalSeconds = calendarSeconds + manualSeconds;
// normal: HH:MM (minutes rounded up), demo: MM:SS
unsigned long left, right;
if (DEMO_MODE) {
left = totalSeconds / 60;
right = totalSeconds % 60;
} else {
unsigned long totalMinutes = (totalSeconds + 59) / 60;
left = totalMinutes / 60;
right = totalMinutes % 60;
}
// only two digits on each side
if (left > 99) {
left = 99;
right = 59;
}
display.clear();
display.writeDigitNum(0, left / 10);
display.writeDigitNum(1, left % 10);
display.drawColon(true);
display.writeDigitNum(3, right / 10);
display.writeDigitNum(4, right % 10);
display.writeDisplay();
}