A portable voice-activated dietary assistant for people with FODMAP and gluten restrictions.
Safe Bite is a pocket-sized device that helps people make safe food choices. They ask "Can I eat apples?" and instantly see:
FODMAP: HIGH 🔴
GLUTEN: NO 🟢- Voice queries — Ask about any food in English or Portuguese
- Offline mode — Works without WiFi using a local database of 176 foods
- Color-coded answers — Red (avoid), Yellow (small portions), Green (safe)
- Kid-friendly — Simple interface with just 2 buttons
- WiFi connectivity — Non-blocking connection with visual status indicator
- Voice recording — 6-second PDM microphone capture for voice search
- M5StickC Plus2 (~€20)
With WiFi:
- Press button and speak
- Audio sent to Mistral Voxtral (speech-to-text)
- Query sent to Mistral Small
- Result displayed on screen
Without WiFi:
- Navigate categories with buttons
- Select food from list
- Result displayed from local database
- Clone this repository
- Install PlatformIO
- Copy
include/config.example.htoinclude/config.hand fill in your credentials:
// include/config.h
#define WIFI_SSID "your_network"
#define WIFI_PASSWORD "your_password"
#define MISTRAL_API_KEY "..."All commands use PlatformIO CLI.
Compile the firmware:
pio runUpload firmware to the device:
pio run --target uploadBuild and upload the food database (LittleFS filesystem):
The data/foods.json file is stored on the device's LittleFS partition. Upload it separately from the firmware:
pio run --target uploadfsRun this whenever you edit
data/foods.json. The device and firmware uploads are independent — you only need to re-flash what changed.
Full flash (firmware + filesystem):
pio run --target upload && pio run --target uploadfsMonitor serial output:
pio device monitorDefault baud rate is 115200 as set in platformio.ini.
The device connects to WiFi in the background without blocking the UI:
- Green circle — Connected and ready for voice search
- Yellow blinking — Connecting...
- Red outline — Disconnected (will auto-retry)
If no config.h is present or WiFi fails, the device works in offline mode with the local food database.
When WiFi is connected, a "Voice Search" option appears at the top of the categories menu:
- Select "Voice Search" and press M5 button
- Speak your food query (6-second recording)
- Visual countdown shows recording progress
- Audio is captured as 8kHz mono WAV and sent to Mistral Voxtral for transcription
The PDM microphone (SPM1423) captures speech at 8000 Hz sample rate with 16-bit depth.
| Item | Cost |
|---|---|
| Hardware | €20-25 (one-time) |
| Mistral API | ~€1/month |
I'm documenting the build process:
- Building Safe Bite: Why I'm Making This — The personal story behind this project
- Building Safe Bite: Offline Mode — Local database and menu navigation
- Inspired by this LinkedIn post
- FODMAP data based on Monash University guidelines
- CH34x USB driver for macOS — Required for M5StickC Plus2 serial connection
- arduinohw — The project that inspired Safe Bite
MIT