Title
Building a Reliable Cat Flap Camera with FireBeetle 2 ESP32-P4 + Camera Module
Ā
Ā Summary
I built a real-world cat flap monitoring system using the DFRobot FireBeetle 2 ESP32-P4 platform and camera hardware. The project focuses on reliability first: live web streaming, local SD snapshot storage, OTA updates, and a clean path toward on-device cat identification.
Ā
I also want to acknowledge that I used Codex heavily during development for iterative firmware refactoring, debugging workflows, and documentation help.
Ā
Why This Board
The FireBeetle 2 ESP32-P4 stood out for this project because it combines:
Ā
- enough performance for camera pipelines
- practical wireless integration via companion connectivity
- SD card support for local persistence
- strong ESP-IDF software ecosystem
Ā
For a cat flap use case, local-first behavior matters more than cloud-first behavior. This board made that possible.
Ā
What I Built
Current firmware features:
Ā
- live stream in browser
- manual snapshot capture
- ultrasonic-triggered snapshot capture
- SD card snapshot ring buffer
- snapshot gallery with delete
- OTA firmware update endpoint
Ā
The full project code is in my repo:
- https://github.com/janholtzhausen/esp32p4-catflapmonitor
Ā
Ā Technical Highlights
Ā Ā 1) Local snapshot pipeline
Instead of relying on immediate cloud upload, snapshots are:
1. captured
2. resized for inference-friendly dimensions (224x224)
3. encoded as JPEG (quality 100)
4. saved to SD card
Ā
This reduced failure modes and improved responsiveness.
Ā
Ā Ā 2) SD reliability work
I spent most effort on robust SD behavior:
- controlled SDMMC slot/bus/frequency configuration
- fallback from 4-bit to 1-bit where needed
- ring retention by file count to avoid unbounded directory growth
- deterministic timestamped filenames
Ā
Ā Ā Ā 3) OTA maintainability
Dual OTA partitions and password-protected update endpoint make field updates practical.
Ā
Ā Roadmap
Next goals:
Ā
- optional Teachable Machine upload workflow for dataset curation
- tiny on-device tensor/YOLO classification for immediate cat identification
- MQTT event alerts for intruder-cat detection
Ā
Thank You
Thanks to DFRobot for sponsoring the board and camera hardware used in this build. The platform was a strong base for a serious edge-camera firmware project.
Ā









