PromptHub
Back to Blog
Embedded Systems Internet of Things

I Built a Cloud-Connected Sourdough Brain and It Changed Baking Forever

B

Bright Coding

Author

13 min read 22 views
I Built a Cloud-Connected Sourdough Brain and It Changed Baking Forever

I Built a Cloud-Connected Sourdough Brain and It Changed Baking Forever

What if I told you that your "ripe" sourdough starter is probably lying to you?

Every weekend baker has been there. You peek at your jar, see some bubbles, and think—yeah, this is ready. Three hours later, your loaf comes out dense as a brick. Flat. Lifeless. The kind of bread that makes you question every life choice that led you to this moment. Meanwhile, professional bakers seem to have some sixth sense about fermentation timing. Their bread rises like magic. Their crusts shatter perfectly. Their crumb structure? Instagram-worthy every single time.

Here's the dirty secret they don't want you to know: they're not guessing. They're measuring. Tracking. Logging data over time to understand their starter's unique personality.

But who has time to babysit a jar of flour and water with a ruler and thermometer? Not you. Not me. Not anyone with a job, a life, or a Netflix queue.

Enter the iot-sourdough-starter-monitor—an open-source, cloud-connected smart lid that transforms your humble mason jar into a precision fermentation laboratory. Built by developer and sourdough obsessive Justin Lam, this project combines an ESP8266 microcontroller, time-of-flight distance sensing, environmental monitoring, and AWS↗ Bright Coding Blog cloud logging to answer the eternal question: "Is my starter actually ready, or am I just hopeful?"

This isn't a novelty gadget. This is data-driven baking at its finest. And in this guide, I'm going to show you exactly how to build it, why it works, and how it will permanently upgrade your bread game.


What Is the IoT Sourdough Starter Monitor?

The IoT Sourdough Starter Monitor is an internet-connected smart lid designed specifically for tracking sourdough starter fermentation with laboratory-grade precision. Created by Justin Lam, a software engineer who clearly understands that great bread requires great data, this project sits at the delicious intersection of embedded systems, cloud architecture, and artisanal baking.

At its core, the monitor is a 3D-printable enclosure housing a NodeMCU ESP8266 development board, a time-of-flight distance sensor, temperature and humidity monitoring, and a compact OLED display. It measures how much your starter rises, tracks the environmental conditions affecting fermentation, and pushes everything to AWS for historical analysis and visualization.

Why is this trending now? The pandemic sourdough craze never really died—it evolved. Home bakers got serious. They started asking harder questions about fermentation science, hydration percentages, and temperature control. Meanwhile, the maker community has been hungry for practical IoT projects that go beyond blinking LEDs. This project delivers genuine utility with a compelling narrative, making it irresistible to both hardware hackers and food science enthusiasts.

The full project story, complete with Justin's personal journey and deeper technical insights, lives on his blog—but the repository itself contains everything you need to replicate this build, including PCB designs, 3D models, firmware, and a full-stack web application.


Key Features That Make This Build Insane

Let's break down what makes this monitor genuinely special—not just as a novelty, but as a serious piece of engineering:

  • Precision Rise Tracking with Time-of-Flight: The VL6180X sensor measures distance with millimeter accuracy, tracking exactly how much your starter has expanded. No more eyeballing "doubled in size"—you get quantified volume change in real-time.

  • Environmental Context: The DHT22 captures temperature and humidity, the two variables that most dramatically affect fermentation speed. A starter at 65°F behaves completely differently than one at 78°F, and now you'll know why your timing was off.

  • Cloud-Native Architecture: Data flows through AWS IoT Core → Kinesis Firehose → Lambda → S3, then gets queried via Athena for the web app. This isn't a toy logging to a local database—it's production-grade serverless infrastructure.

  • Multi-Mode Local Display: The SSD1306 OLED shows max rise/time, live graphs, or "stats for nerds"—because sometimes you want quick info, sometimes you want the full data dump.

  • Full-Stack Web Application: A Heroku-deployable React↗ Bright Coding Blog app lets you review historical feeds, compare fermentation curves, and download data for deeper analysis in your tool of choice.

  • Custom PCB and 3D-Printed Enclosure: Justin didn't stop at a breadboard mess. There's a proper KiCad-designed PCB and Fusion 360 enclosure, making this a reproducible, polished product.

  • PlatformIO Native Testing: The firmware includes actual unit tests runnable locally, not just on-device—a rare and commendable practice in Arduino-land.


Use Cases: Where This Monitor Absolutely Shines

1. Eliminating the "Is It Ready?" Anxiety

Every sourdough baker knows the paralysis. Peak too early, you get underproofed dough. Wait too long, the starter collapses and your bread turns to pancake. The monitor's max rise tracking with timestamp tells you exactly when peak fermentation occurred—no guesswork, no stress.

2. Understanding Your Starter's Seasonal Behavior

Your kitchen in January is not your kitchen in August. The DHT22 data, correlated with rise curves, reveals how temperature affects your specific starter's metabolism. You'll learn whether you need to adjust feeding ratios, timing, or find a warmer spot—based on data, not hunches.

3. Optimizing Feeding Schedules for Maximum Predictability

Serious bakers maintain starters on precise schedules. By logging multiple feeds, you can identify patterns: Does a 1:2:2 ratio peak at 6 hours consistently? Does your rye-flour feed behave differently? The web app's historical view makes these comparisons trivial.

4. Remote Monitoring While You're at Work

Started a feed before leaving for the office? The AWS cloud pipeline means you can check rise progress from anywhere. No more rushing home to catch peak fermentation or coming back to a deflated, overripe starter.

5. Contributing to Open Citizen Science

Imagine aggregating anonymized fermentation data across climates, elevations, and flour types. This project's architecture could scale to genuine research on sourdough microbiome behavior under real-world conditions.


Step-by-Step Installation & Setup Guide

Hardware Assembly

Gather these components:

Component Purpose
NodeMCU ESP8266 (ESP-12E) WiFi-enabled microcontroller brain
VL6180X Time-of-flight distance sensor for rise measurement
DHT22 Temperature and humidity monitoring
SSD1306 128x32 I2C OLED Local status display
Custom PCB Clean, reliable connections (KiCad files in repo)
3D-printed enclosure Professional mounting on standard mason jar

Solder components to the PCB per the KiCad schematic, flash the firmware, and snap the assembly onto your starter jar.

Development Environment Setup

This project uses PlatformIO v5.1.0, the superior alternative to Arduino IDE for serious embedded development.

Install PlatformIO (VS Code extension recommended), then clone the repository:

git clone https://github.com/justinmklam/iot-sourdough-starter-monitor.git
cd iot-sourdough-starter-monitor

Build the firmware:

# Compile the project
pio run

# Compile and upload to your ESP8266
pio run -t upload

Monitor serial output for debugging:

# Open serial monitor at 115200 baud
pio device monitor -b 115200

Running Tests

Justin included actual test infrastructure—unheard of in hobbyist IoT projects:

# Run tests on the actual hardware
pio test

# Run tests locally on your development machine (faster iteration)
pio test -e native

The native environment is brilliant for rapid development—you can verify logic without constant hardware flashing.

AWS IoT Certificate Configuration

The ESP8266 connects securely to AWS IoT Core using X.509 certificates. Convert your AWS-provided PEM files to DER format for the ESP8266's limited storage:

# Convert device certificate to DER format
openssl x509 -in xxx-certificate.pem.crt -out cert.der -outform DER

# Convert private key to DER format
openssl rsa -in xxx-private.pem.key -out private.der -outform DER

# Convert Amazon root CA to DER format
openssl x509 -in AmazonRootCA1.pem -out ca.der -outform DER

Place these .der files in the project's data/ directory, then upload to SPIFFS filesystem:

# Upload certificate files to ESP8266 flash filesystem
pio run -t uploadfs

Alternatively, use the arduino-esp8266fs-plugin if you prefer Arduino IDE workflow.

Web Application Deployment

The frontend deploys cleanly to Heroku:

# Push only the webapp subdirectory to Heroku
git subtree push --prefix webapp heroku master

This monorepo structure—firmware and web app together—is clean and maintainable, with git subtree handling the deployment complexity.


REAL Code Examples from the Repository

Let's examine the actual implementation patterns that make this project tick.

Example 1: PlatformIO Build Configuration

The project uses PlatformIO's platformio.ini for multi-environment builds. While not shown verbatim in the README, the commands reveal the structure:

# Build for the default environment (ESP8266)
pio run

# Build and immediately flash to connected device
pio run -t upload

# Upload filesystem image containing AWS certificates
pio run -t uploadfs

The -t uploadfs target is critical for IoT security—your AWS private key never lives in firmware binary, but in separate SPIFFS storage. This separation allows certificate rotation without full firmware reflashing.

Example 2: Serial Monitoring at Production Baud Rate

# Monitor device output at 115200 baud (standard for ESP8266)
pio device monitor -b 115200

This command connects to your ESP8266's UART output, showing real-time sensor readings, MQTT connection status, and debug information. The 115200 baud rate is the ESP8266's default high-speed serial—lower rates would miss rapid data bursts during cloud transmission.

Example 3: Native Testing Environment

# Run unit tests on development machine (no hardware needed)
pio test -e native

The -e native flag selects a native compilation target, allowing your firmware logic to execute on your computer's CPU rather than the ESP8266. This enables:

  • Fast feedback loops: No 30-second flash cycles
  • CI/CD integration: Run tests in GitHub Actions automatically
  • Algorithm verification: Test rise-calculation logic with mock sensor data

This pattern separates hardware-dependent code (I2C sensor reads, WiFi management) from pure logic (fermentation state machines, data formatting), making the codebase testable and maintainable.

Example 4: AWS Certificate Conversion Pipeline

# Three-step certificate transformation for embedded TLS

# Step 1: Device identity certificate
openssl x509 -in xxx-certificate.pem.crt -out cert.der -outform DER

# Step 2: Private key (KEEP THIS SECURE)
openssl rsa -in xxx-private.pem.key -out private.der -outform DER

# Step 3: Certificate authority chain
openssl x509 -in AmazonRootCA1.pem -out ca.der -outform DER

The ESP8266's BearSSL library requires DER format for memory efficiency. PEM's Base64 encoding would waste precious RAM. These OpenSSL commands perform lossless format conversion while maintaining cryptographic integrity. The -outform DER flag ensures binary output that the ESP8266 can parse directly.

Example 5: Heroku Subtree Deployment

# Deploy only webapp/ directory to Heroku from monorepo
git subtree push --prefix webapp heroku master

This elegant Git technique pushes a subdirectory as if it were the entire repository, satisfying Heroku's expectation of a root-level package.json and Procfile. Without git subtree, you'd need complex CI pipelines or separate repositories—adding friction to deployment.


Advanced Usage & Best Practices

Calibrate Your Distance Baseline: The VL6180X measures from lid to starter surface. Mark your jar's "just fed" level and configure this as your zero point in firmware. Different jar geometries affect absolute readings, but relative rise percentage remains comparable.

Implement Predictive Peaking: With historical data in Athena, build a simple regression model. If your starter typically peaks 4.5 hours after feeding at 72°F, alert yourself at 4 hours when conditions match.

Monitor Ambient, Not Just Internal: The DHT22 reads inside the enclosure. For true environmental correlation, consider a second sensor away from the jar—starter temperature lags ambient by 15-30 minutes due to thermal mass.

Secure Your Certificates: The .der files in data/ are your AWS identity. Never commit them. Add data/*.der to .gitignore and distribute certificates via secure channels only.

Extend with Additional Sensors: The I2C bus has room. Add a second VL6180X for redundancy, or a weight sensor (HX711 + load cell) for mass-based fermentation tracking—rise and density together tell a richer story.


Comparison with Alternatives

Approach Cost Precision Cloud Logging Learning Value
IoT Sourdough Monitor ~$25 Millimeter (ToF) Full AWS pipeline Extreme
Manual ruler + notebook Free ±5mm visual None Low
Kitchen scale + spreadsheet $15 Weight only Manual entry Medium
Generic temp/humidity logger $20 No rise data Basic apps Low
Commercial bread proofer $200+ Temperature only Usually none Minimal

The iot-sourdough-starter-monitor wins on integrated measurement (rise + environment together), automated cloud logging, and hackability. You're not buying a black box—you're owning the entire data pipeline.


FAQ: Your Burning Questions Answered

Q: Do I need AWS experience to build this? A: Basic familiarity helps, but Justin's architecture uses managed services (Kinesis, Lambda, S3) that minimize operational burden. Follow AWS IoT Core setup tutorials for certificate generation.

Q: Can I use a different ESP board? A: The NodeMCU ESP8266 is specified, but ESP32 variants work with minor pin adjustments. The key requirements are WiFi, I2C for sensors, and SPIFFS for certificate storage.

Q: How accurate is the rise measurement? A: The VL6180X claims ±1mm accuracy in ideal conditions. Real-world performance depends on starter surface texture (bubbles create noise) and ambient light. Expect ±2-3mm practical accuracy—more than sufficient for baking.

Q: Is this food-safe? A: The electronics sit in a lid above the starter, not contacting it. Use food-safe 3D printing filament (PETG, not ABS) for the enclosure, and ensure the jar seal remains intact.

Q: Can I modify it for other fermentations? A: Absolutely! Kombucha, kefir, beer brewing—any process with visible volume change and temperature sensitivity benefits from this monitoring approach.

Q: What's the power consumption? A: The ESP8266 draws ~80mA average with WiFi active. A USB power bank provides days of operation, or use a 5V wall adapter for permanent installation.

Q: How do I contribute improvements? A: Fork the repository, implement your enhancement with tests, and submit a pull request. The native test environment makes contributions welcome.


Conclusion: Bake Smarter, Not Harder

The iot-sourdough-starter-monitor represents something rare in maker projects: genuine utility executed with engineering rigor. Justin Lam didn't slap a sensor on a jar and call it innovation—he built a complete system with thoughtful hardware design, production-quality cloud architecture, and actual testing infrastructure.

Your sourdough starter is a living ecosystem. Treating it as such—with data, with precision, with respect for the variables you can control—transforms baking from superstition into repeatable craft.

Stop guessing when your starter peaks. Stop blaming your oven for dense crumb. Start measuring, start logging, start understanding.

The full source code, PCB files, 3D models, and detailed build instructions await at github.com/justinmklam/iot-sourdough-starter-monitor. Fork it. Build it. Bake better bread than your local artisan bakery—because you'll know your starter better than they know theirs.

Your next loaf of sourdough deserves this level of obsession. Go build your cloud-connected fermentation brain today.

Comments (0)

Comments are moderated before appearing.

No comments yet. Be the first to share your thoughts!

Recommended Prompts

View All
All tools