Categories
PROJECTS

FreshFridge: Monitoring Community Fridge Capacity

Authors: Asha Bazil, Jenna Epstein, Kristin Chang, Celine Apollon

INTRODUCTION

Philadelphia residents are experiencing unprecedented levels of food insecurity. 17% of Philly’s population was considered food insecure in 2021,while in 2019 the City generated approximately 240,000 tons of food waste. On top of this, recent escalations in food costs mean that people are relying more on community fridges. The volunteers and mutual aid networks that stock these fridges have limited capacity, and are well aware of the gravity of the situation. The fridges they oversee could be refilled every half hour. They just don’t have the resources to do so.

FreshFridge seeks to inform better allocation of these limited financial and human resources necessary to keep Philly’s community fridge system running. FreshFridge is a monitoring and response system that comes in an easy to install kit that will save time, and optimize the amount of quality, fresh food available for community members around the city. The FreshFridge kit measures the amount of food, the internal conditions, and the frequency of use at each fridge site and sends that information to a realtime database. The information is then layered onto a public online map giving residents real-time information about available food. The map and additional data provided in a supporting dashboard can also be accessed via login by those stocking and maintaining the fridges. Our two main user groups are those who are coordinating the delivery of produce to the fridges, and those who are consuming that produce.

FRESHFRIDGE: THE KIT

Equipment List

  • 1 WiFi-enabled Arduino board: ESP8266 NodeMCU
  • 1 temperature / humidity sensor: DHT-11
  • 1 door magnet sensor: Gikfun MC-38
  • 4 Ultrasonic sensors per shelf: HC-SR04
  • 1 5V or higher power source with micro-usb adapter: Belker Adapter
  • Several M-F, F-F, and M-M wires
  • 1 methane sensor (optional): MQ4

Overview Diagram

This diagram shows very generally how the FreshFridge kit is installed, using the Powelton Fridge as the pilot site. The entire FreshFridge kit will be powered by the same power source as the fridge on site. The kit is comprised of several sensors (as noted in the equipment list) and a WiFi-enabled Arduino board which sends sensed information to a realtime database on Google Firebase.

The sensors, and their purposes, include: 

  • A sensor that detects both temperature and humidity to regulate the internal conditions of the fridge
  • A motion sensor placed on the fridge door to document each time the door is opened, and to make sure it’s not left open
  • A series of ultrasonic distance sensors on each shelf to estimate the amount of food in the fridge. 
  • We also have an “add on” option for a methane sensor to detect methane emitted by spoiled produce. 

Zooming into one shelf

Looking closer at one shelf, 4 distance sensors are placed at the back of the shelf to detect the presence of food by measuring the distance to the door or any object in front of them. For our prototype, we used a distance of 16 inches based on the total depth of our pilot fridge to define the shelf’s capacity. 

  • For instance, if all 4 sensors measure 16 inches or greater, then the shelf is empty since that is the absolute distance from the back of the fridge to the door. 
  • If 1 to 3 of the sensors measure a distance of 16 inches or more, the shelf is partially empty
  • and if none of the sensors measure a distance of 16 inches or more, the shelf is considered full.

These combined measurements provide a rough “snapshot” of the fridge at any given time. and would be placed on each shelf in the fridge and calibrated to the depth of that specific fridge. 

The rest of the kit (WiFi arduino, temperature/humidity sensor, and optional methane sensor), can be placed in an unobtrusive location within the fridge on just one of the shelves. 

TUTORIAL

High-level: Each sensor is connected to the wifi board, and the sensed data is sent to a Firebase database. You’ll have two power rails on your breadboard– one supplying 3.3V, and one supplying 5V.

Wiring

  1. Wire the temperature sensor to the D2 pin and the 3.3V power + ground.
  2. Wire the methane sensor*  to the A0 pin and the 3.3V power + ground.
  3. Wire the door sensor to the D0 pin + ground.
  4. Wire one** distance sensor to D5 and D6 + the 5V power + ground. Tutorial here

*Optional add-on sensor

** For the purposes of this tutorial, only one ultrasonic distance sensor is configured. To connect multiple ultrasonic distance sensors, as intended, it is best to use as few pins as possible. We suggest referencing this forum. For wiring multiple ultrasonic distance sensors across multiple shelves, we recommend using the “Octosonar” library and implementation. It allows for connection of up to 16 ultrasonic range sensors to an Arduino using a I2C bus and just one pin. See details here.

These photos show what each of these sensors looks like in our prototype fridge. In this case the distance sensor is at the front of the shelf so we could test it with the door open, but it works best when they’re placed at the back.

Configuration

Follow this tutorial to set up your Firebase account (note that the ESP boards are different but the process is the same).

Code

Below is the code used to collect, analyze, and send sensed data to the database created in the configuration step. If issues arise uploading this code to the ESP8266 NodeMCU, please find troubleshooting tips in the tutorial linked above.

Now the sensed data will send to your Firebase database. See the details of the data below, as well as a video showing an example of how the distance sensor sends information to Firebase in realtime.

SENSED DATA IN ACTION: THE FRESHFRIDGE WEB APPLICATION

We envision a dashboard-driven web application to make the sensed information accessible and useful to the public as well as community fridge maintainers and stockers. We propose building on top of an existing map maintained by a group of community volunteers. The map is based on a Google Sheets file with information about fridges such as the address, zip code, website, and relevant notes. The data then populates a map instance through Google Maps. We would like to build functionality on top of this existing implementation. Here is a sequence of screens that we envision.

When a user clicks a fridge point, a side panel opens to the right with details about the fridge. The information at the top comes from the Google Sheet owned by the network of volunteers, and the information in the table comes from the Firebase database. There is also an aggregate counter of how many times the fridge door has been opened in the past 24 hours to provide an understanding of general traffic.

For each timestamp, the sensor data is displayed in a user-friendly format. The fridge’s “amount of food” measure – the red, yellow, and green dots for empty, partial, and full – are displayed as visual indicators to the right of each timestamp so that it is immediately clear to the viewers what the status is at each given log. When a user clicks to expand a timestamp, the data from the DHT11 humidity and temperature sensor are displayed.

Maintaining the Dashboard

In this model, we would rely on the current map network maintainers to add or remove fridge points (and their associated data) from the map when a fridge is added or removed, or information is edited. 

Using a Google plugin called “geosheets”, the map would update as the Sheet is edited. If a new FreshFridge kit were to be deployed to a fridge in the city, its kit-specific fridgeID will be joined into the same Firebase database, easing the technical lift needed to enable a new kit.

THE FUTURE OF FRESHFRIDGE

FreshFridge App. 2.0

Our vision for the next iteration of the FreshFridge application is a mobile rollout. We would leverage the cloud messaging feature associated with Google Firebase to make this happen.

The push notifications and key information are geared towards maintainers and stockers, and will be customizable based on specific user priorities. Examples of push notifications can be sent when fridges are empty, when the temperature is too high, or when the door has been left open.

Anyone from the public could also download the app and sign up for push notifications. For the future of FreshFridge, we envision creating the capability for members of any neighborhood to check the capacity status of their nearest fridge, and to vouch for where new fridges should be added based on their knowledge.

This can be done by displaying QR codes throughout the city — enabling residents to check fridge statues, provide user input,  and/or download the FreshFridge App 2.0. We recommend using QR.io which will collect the count, date, and location of scans to understanding hotspots or gaps in QR participation. Further, places with fewer total scans of QR codes inform managers to rethink their awareness strategy and perhaps evaluate how to better serve the needs of the community. 

Add-on Features and Alternatives

There is flexibility to adapt the FreshFridge kit for your specific fridge needs!

Methane Sensors

 An MQ-4 sensor can be added to detect methane that may be emitted from spoiling food. For most fridges, currently, this is not a high priority feature because items have not been staying in fridges for long due to rising food sales prices. However, it is available and easy to attach using this tutorial. NOTE: the code to calibrate and collect data using the MQ-4 methane sensor is already included and commented out in the FreshFridge tutorial code above. 

Shelf Capacity

Some alternative options to measuring shelf capacity per fridge include load cell weight sensors or tactile buttons. You may consider switching either of these options out for the ultrasonic distance sensors if you are looking to take more precise measurements.

  • You may follow this tutorial to calibrate and collect data from the load cell sensor. We recommend starting with two per shelf with the FreshFridge kit. 
  • Using tactile buttons instead of the ultrasonic distance sensors may provide more precise information about shelf capacity. When an item is placed on top of the button, it is pushed down, and when the item is removed, the button will need to be pressed by a user to reset it. When used perfectly, this could provide more exact readings. To setup and collect data using button sensors, you may follow the Elegoo Super Starter Kit Lesson 5 tutorial on digital inputs found online here.

Recommendations for Scaling

  1. Enhance the features by researching the for the most economically and sustainably optimal sensors. By incorporating higher quality sensors, the accuracy of the sensed data will improve, thus ensuring that fridges are being communally used and operated in the most efficient way possible.   
  2. Diversify hardware to accommodate for varying neighborhood contexts. For example, this could include offering a cellular as well as a wifi enabled kit option for areas of Philadelphia without access to wifi. The cellular option is a bit more expensive in terms of hardware. 
  3. We propose establishing a city-wide initiative to secure funding and house+aggregate community fridge usage data. The funding would be for supplying food and deployment and maintenance of the kits, perhaps in conjunction with programs such as the Philadelphia Food Waste Business Challenge in the Office of Sustainability. In the long term, the initiative’s funding could also establish a workforce training program to teach members of the community how to use and manage the FreshFridge, which could then lead to full-time paid positions as official community fridge managers.The data managed by the initiative will equip advocates another method of communicating the need for increased funding and prioritization.

Acknowledgments

Thank you to Bunnyhop, a volunteer-led mutual aid group providing free food to neighbors in West Philadelphia. We greatly appreciate the time and insights they shared with us as we developed this project.

Thank you to Allison Lassiter and Logan Weaver for their instruction and guidance.

CITATIONS

Leave a Reply

Your email address will not be published. Required fields are marked *