The pantry tracker: a CoreS3 SE stacked on the QRCode module and its battery base, the screen glowing red while it scans
Back to projects
Internship project

Pantry Expiry Tracker

I built this expiry tracker for the fridge door during my internship at M5Stack. You scan a product’s barcode and pick when it expires, and the screen always shows what to eat first, with product names in Chinese or English.

Built with
ESP32-S3PlatformIOPythonDockerMosquitto MQTT

Internship project at M5Stack, November 2026. M5Stack CoreS3 SE, Module13.2 QRCode, C++, Python, Docker, MQTT.

Demo

I filmed this at my desk, first scanning products off a demo sheet on my laptop and then a real carton of 冰红茶, before scanning the carton a second time and moving to a second pantry.

Try it

This is a copy of the tracker’s screen that runs the same steps. Tap SCAN NOW and pick a product from the shelf to hold up to the scanner, then set when it expires and save it. You can also swipe a card to the left to delete it, and scanning something that is already on the list opens it instead.

Pantry +

The pantry, 4 items, sorted by what expires first.

Tap a product to scan it

The barcodes on the shelf are the products’ real EAN-13 codes, so the tracker itself can scan them off this page.

What it does

The tracker sits on the fridge door, and every screen below is a capture from it.

The expiry picker for 牛奶面包 by Brioche Pasquier, with Days 0, Weeks 1 and Months 0, a week from today, and a green SAVE button

Scan a product

When you tap SCAN NOW and hold a barcode about a hand’s width from the scan window, the screen glows red while the scanner looks for a code. The tracker then shows the product’s name, brand, size and photo, which mostly come from Open Food Facts, while products sold in mainland China come from GS1 China through a free account.

You set the expiry with the arrows under Days, Weeks and Months and then tap SAVE.

The home screen: Prince expired in red, Pesto alla Genovese in 2 days and Skyr in 5 days in amber, with SCAN NOW at the bottom

See what to eat first

The home screen lists the pantry with the soonest expiry at the top, and the count turns red within a day of the date and amber within a week.

The item page for Barilla Pesto alla Genovese: added today, expires Wednesday 2026-11-11, 2 days, with a red DELETE button

Scan again to open it

Scanning something that is already on the list opens it instead of adding it twice, so you can check its date or delete it from there.

The Prince card slid to the left, showing a red bin button

Swipe to delete

Swiping an item from right to left shows a red bin to tap, and swiping from left to right anywhere takes you back.

The pantry menu open: Default Pantry with 6 items, Fridge with 1, and Create Pantry

Keep several pantries

The Pantry button switches between pantries such as the fridge, the freezer or a cupboard, and it can create a new one too.

The control centre: a beep switch, a brightness slider, 100% battery and Home Assistant connected

A control centre

The status button at the top right opens the beep switch, the screen brightness and the battery level, and its house icon turns green when the tracker is connected to Home Assistant.

Manage it from a browser

The same list is on a web page, where you can add items by barcode, rename them and organise pantries from a computer or a phone. A small badge beside each name shows where it came from, such as OFF for Open Food Facts or GS1 for GS1 China.

The pantry web page: tabs for All, Default Pantry and Fridge, a barcode and date form, and the items sorted by expiry with their source badges
The pantry web page

Reminders in Home Assistant

Each pantry appears in Home Assistant as its own device, with its item count, what is expiring soon and the next item to expire. Every scan, add and delete also fires an event, so you can build your own automations on top of it, such as a reminder on your phone the day before something expires.

Three devices in Home Assistant: Pantry Tracker, Default Pantry and Fridge, each with expired, expiring soon, item count and next expiry
The pantry devices in Home Assistant

How it works

The tracker only handles the screen and the scanner, while a Docker container on the home network does the rest: it stores the list, looks up barcodes, caches product photos and publishes everything to Home Assistant over MQTT. I split it this way because the ESP32-S3 can’t run the GS1 China sign-in, and because keeping one list on the server means the tracker, the web page and Home Assistant always agree.

System overview: the tracker on the fridge talks to the pantry server over WiFi, the server looks products up on Open Food Facts and GS1 China and publishes to Home Assistant over MQTT, and any browser can open its web page
How the parts connect
What happens when you scan: the barcode is read over UART, the server is asked whether it is already saved, the product is looked up and cached, you pick the expiry, the item is saved and Home Assistant is updated
What happens when you scan

Hardware

  • CoreS3 SEruns the tracker, with the touch screen and WiFi.
  • Module13.2 QRCodereads 1D and 2D barcodes and stacks under the CoreS3 SE.
  • A battery basegoes underneath, so it runs on the fridge without a cable.
The tracker stuck to a grey fridge door, showing its Set me up screen with a QR code
On the fridge door, ready to be set up

You also need a computer that stays on for the server, and Home Assistant if you want reminders.

Setting one up

Everything you need is free to download: the firmware flashes from your browser, and the server comes as a Docker bundle with its images included, so nothing has to be pulled from Docker Hub while it installs.

  1. On the QRCode module, slide the interface toggle to UART and switch on number 2 in both the TX and RX DIP blocks, then stack the three parts.

    The interface toggle set to UART, switch 2 on in the TX and RX DIP blocks, and the CoreS3 SE stacked on the module and the battery base
  2. Open Flashdeck in Chrome or Edge, choose Pantry, plug the CoreS3 SE in over USB-C and press Install, which flashes the firmware straight from the browser.

  3. Download the server for the computer that will run it, either the bundle for Intel and AMD computers or the bundle for Apple Silicon Macs and a Raspberry Pi. Unpack it, set TZ in docker-compose.yml to your time zone and run ./install.sh in that folder.

  4. Turn the tracker on, scan the QR code on its screen with your phone, and enter your WiFi and the server address, for example http://192.168.1.20:8080.

    First boot: the tracker opens a Pantry hotspot with a QR code, the phone joins it, the setup page takes the WiFi and server address, and the home screen loads
  5. Tap SCAN NOW and scan this code once, which switches the scan engine from USB to serial.

    The scan engine setting code 21424000, Serial Communication
  6. In Home Assistant, add the MQTT integration with the server’s IP address and port 1883.

  7. For Chinese barcodes, add a free gds.org.cn account under Settings on the server’s web page and sign in once.

The GitHub repository has the full guide in its README, along with the firmware and server code if you would rather build them yourself.

Product names and photos on this page come from Open Food Facts (CC BY-SA) and GS1 China.

More to explore

Other projects

Personal
OCR Reader with DrumNet, an OCR water meter solution

OCR Reader

A battery-powered water meter reader where a 693K-parameter DrumNet pipeline on an ESP32-S3 reads the drums and reports over LoRaWAN, built on a custom KiCad PCB inside a 3D-printed shell.

Personal
Project June rover

Project June

A 5G rover with three live camera feeds, GPS, a laser pointer and seven sensors, driven from a web console.

Internship
Pip, a cyan desk pet, on the M5Stack Tab5

Pip

A desk pet on an M5Stack Tab5 whose brain is the DeepSeek Harness on my server, so it can drive a browser, build its own apps and watch my other agents.