Build a Bird Cam That Names Every Bird
Build a private bird camera that identifies feeder visitors on a home network.
Introduction
30 Second Summary
Birds rarely wait for you to look out the window before visiting a feeder. A brief visit can disappear before you know what landed there.
In this project, you will build a private Bird Journal that records feeder visits from a webcam or ESP32-CAM. Local image classification on your Mac adds a bird name before the password-gated journal shows the visit across your home network.
What You'll Build
Picture opening Bird Journal on your phone to see a feeder visit with its photo, species name, confidence score, skipped-frame count, and today's tally.
By the end of this project, you'll have:
- A password-gated Bird Journal you can open from your Mac or phone to see feeder visits appear with their upload times.
- A local bird classifier that adds a species name and confidence score to each saved photo without sending it to a paid vision API.
- A motion filter that raises the skipped-frame count during still scenes while movement creates a new journal card.
- Secret Mission: Record a 15-second audio clip that BirdNET turns into a separate heard visit.
What Do I Need?
You need an Apple silicon Mac running macOS 15 or later, home Wi-Fi, a feeder view, and Claude Code access.
The $0 webcam path needs no camera hardware, while the hardware path costs about $10 to $20 for the ESP32-CAM kit plus a Micro USB data cable and stable USB power.
Before We Start
First, choose the camera path and feeder view that fit your space. This gives your bird cam a clear purpose before you set up any tools.
Set Up Your Tools
The Bird Journal, local classifier, and camera scripts need one isolated Python environment so every part uses the same package versions.
A virtual environment keeps this project's packages separate from the rest of your Mac. Claude Code gives you one place to check the environment before you create the Bird Journal files.
In this step, get ready to:
- Install Python 3.13.17 and Claude Code.
- Create the birdcam folder with an active virtual environment.
- Install and verify every pinned Python package.
Install Python and Claude Code
Python runs the journal server, image classifier, and camera sender. Version 3.13.17 is the final Python 3.13 release that provides a macOS installer.
- Download Python 3.13.17 from the official Python release page.
- Scroll to Files on the release page.
- Select macOS installer.
- Run the downloaded macOS installer for Python 3.13.17 until it reports that installation is complete.
You should see a completed installation message, which means the Python executable is ready to check.
- Press Cmd+Space to open Spotlight.
- Type Terminal.
- Press Enter to open Terminal.
- Check the installed Python version by running this command:
python3.13 --version
What does this command do?
The command asks the Python 3.13 executable to print its version. This confirms that your terminal can find the installation.
You should see Python 3.13.17 in the output.
✔️ I see version 3.13.17
Python is installed at the version this project uses.
ⓧ I see an older version
Your terminal found another Python installation. Install 3.13.17 from the linked release page.
- Close Terminal after the installer finishes.
- Open a fresh Terminal window through Spotlight.
- Run the version check above again until it reports Python 3.13.17.
ⓧ Command not found
The Python installer has not added the executable to your fresh shell yet.
- Run the Python 3.13.17 macOS installer again.
- Close Terminal after the installation completes.
- Open a fresh Terminal window through Spotlight.
- Run the version check above again.
Claude Code runs from Terminal and checks the project without requiring a separate editor. The installer below adds its command-line tool to your Mac.
- Install Claude Code from the official setup guide by running this command:
curl -fsSL https://claude.ai/install.sh | bash
What does this command do?
The command downloads Claude Code's official installation script. Your shell runs that script to install the command-line tool.
You should see the installer finish without an error.
- Start a fresh shell by opening a new Terminal window.
- Press Cmd+Space to open Spotlight.
- Type Terminal.
- Press Enter to open another Terminal window.
- Verify the Claude Code installation by running this command:
claude --version
What does this command do?
The command asks Claude Code to print its installed version. A version number confirms that the fresh shell can find it.
You should see a Claude Code version number in the output.
✔️ I see a version number
Claude Code is installed and available from Terminal.
ⓧ Command not found
The current shell has not picked up the installation path.
- Close every Terminal window.
- Open Terminal again through Spotlight.
- Run the Claude Code version check above again.
- Repeat the official installation command if the version check still fails.
Still missing Python or Claude Code?
A newly installed command may stay hidden from Terminal until you open a fresh window. Reopen Terminal before repeating either installer.
If the problem continues, ask for help diagnosing the missing command.
Create the project environment
The birdcam folder gives every project file one predictable home. Its .venv environment isolates the pinned packages from other Python projects.
- Move to your Desktop in the fresh Terminal window by running this command:
cd ~/Desktop
What does this command do?
The cd command changes Terminal's current folder. The ~ symbol represents your home folder.
- Create the birdcam folder by running this command:
mkdir birdcam
What does this command do?
The mkdir command creates a folder in the current location. Its name becomes the project's path for every later step.
- Confirm the folder exists by running this command:
ls
What does this command do?
The ls command lists the current folder's contents. It gives you a quick check before you move into the project.
You should see birdcam in the list.
- Enter birdcam and create its .venv environment by running these commands:
cd birdcam
python3.13 -m venv .venv
What does this command do?
- The first command moves Terminal into the birdcam folder.
- The second command asks Python 3.13 to create an isolated environment named .venv.
- Activate the new virtual environment by running this command:
source .venv/bin/activate
What does this command do?
Activation makes this Terminal window use the Python executable and packages inside .venv.
You should see (.venv) at the start of the terminal prompt.
- Create requirements.txt inside the active birdcam folder by running this command:
nano requirements.txt
What does this command do?
Nano opens a plain-text editor inside Terminal. Giving it the name requirements.txt creates that file when you save.
- Paste these exact package pins into requirements.txt:
Flask==3.1.3
transformers==5.26.0
torch==2.15.0
Pillow==13.0.0
opencv-python==5.1.0.95
requests==2.34.2
python-dotenv==1.2.4
numpy==2.5.5
What does this file do?
Each line pairs a package with one exact version. These pins make your environment reproducible when the journal starts using Flask, Transformers, PyTorch, Pillow, OpenCV, Requests, python-dotenv, and NumPy.
- Press Ctrl+O to write the file to disk.
- Press Enter to confirm the filename.
- Press Ctrl+X to exit Nano.
- Confirm the file exists by running this command:
ls
What does this command do?
This second directory listing checks the contents of birdcam after you save the package file.
You should see requirements.txt in the output.
✔️ Awesome, I've got everything!
Your package file is saved inside birdcam.
ⓧ I'd like to double check the full code
Compare your complete requirements.txt file with this reference:
Flask==3.1.3
transformers==5.26.0
torch==2.15.0
Pillow==13.0.0
opencv-python==5.1.0.95
requests==2.34.2
python-dotenv==1.2.4
numpy==2.5.5
The next download can take several minutes because PyTorch, Transformers, and OpenCV are substantial packages. A steady stream of installation output means the process is still working.
- Install the exact dependencies inside the active virtual environment by running this command:
python -m pip install Flask==3.1.3 transformers==5.26.0 torch==2.15.0 Pillow==13.0.0 opencv-python==5.1.0.95 requests==2.34.2 python-dotenv==1.2.4 numpy==2.5.5
What does this command do?
The command runs pip through the active virtual environment's Python executable. Every == pin requests the exact version listed in requirements.txt.
You should see the installation complete without a package error.
Did the package installation fail?
Check that the terminal prompt still begins with (.venv). Reactivate the environment before repeating the installation command if that prefix is missing.
If pip still reports a dependency problem, ask for help with the installation output.
Check the environment with Claude Code
The environment now has all eight pinned packages. Claude Code can test their import names and report their installed distribution versions without changing any files.
- Complete the browser sign-in flow if Claude Code requests authentication after launch.
- Start Claude Code inside the active birdcam folder by running this command:
claude
What does this command do?
The command starts an interactive Claude Code session in the current folder. That folder context lets it inspect the active environment while respecting your instruction to leave files unchanged.
- Ask Claude Code to check the imports and installed versions by pasting this prompt:
Check that flask, transformers, torch, PIL, cv2, requests and dotenv import in this folder's virtual environment. Print the installed distribution versions for Flask, transformers, torch, Pillow, opencv-python, requests and python-dotenv. Also report whether torch.backends.mps.is_available() is true on a Mac. Do not change any files yet.
What does this prompt do?
The prompt checks each package through the name Python imports. It also asks for distribution versions because some installation names differ from their import names.
The MPS result tells you whether PyTorch can use Apple's graphics processor on this Mac. A true or false result completes the check.
Claude Code should report successful imports and the pinned distribution versions. It should also report whether MPS is available without creating or editing files.
- Return to the active shell by pressing Control-C.
Before you run the final check, do you expect every printed version to match requirements.txt?
- Verify the five core package versions by running this command inside the active .venv environment:
python -c "from importlib.metadata import version; print(version('Flask'), version('transformers'), version('torch'), version('Pillow'), version('opencv-python'))"
What does this command do?
Python reads the installed distribution metadata for the five core packages. Printing the versions on one line makes any mismatched pin easy to spot.
You should see 3.1.3 5.26.0 2.15.0 13.0.0 5.1.0.95.
That is the setup complete: your birdcam environment can import the tools that power the journal, classifier, and camera sender.
Your local toolkit is ready. Next up, you will turn it into a password-gated Bird Journal that can receive its first photo.
Build the Bird Journal Page
Your isolated project environment is ready. Now you can turn it into something visible from your Mac and phone.
Before adding machine learning or a live camera, you need a visible Flask page that proves one JPEG can travel over HTTP to another device.
In this step, get ready to:
- Create the Bird Journal application and its test uploader.
- Add private local credentials and start the development server.
- Upload a JPEG and open the password-gated journal from two devices.
Create the first Bird Journal files
The journal needs two separate entry points. A browser uses the password-gated page while a camera uses a token-protected upload route.
- Ask Claude Code to create the first runnable journal and uploader by pasting this prompt:
Write app.py with Flask. POST /upload takes a JPEG in the request body and only accepts it when the X-Bird-Token header matches BIRD_TOKEN from a .env file. Save each photo to captures/ with the time, and log it in journal.json. GET / is a page called Bird Journal, behind a login with the password BIRD_PASSWORD from .env, showing photos newest first. Also write send_test.py that uploads a JPEG file I name. Put .env, journal.json, captures/ and firmware/birdcam/secrets.h in .gitignore. Create .env.example with placeholders, then tell me to copy it to .env and replace the placeholders. Keep this first version valid and runnable because later prompts will extend app.py.
What does this prompt build?
- The upload route checks `X-Bird-Token` before accepting the JPEG bytes.
- The login route checks `BIRD_PASSWORD` before showing the journal.
- The uploader reads a named JPEG and sends it to the local server.
- Let Claude Code finish creating the files before sending another prompt.
Claude Code should report that it created `app.py`, `send_test.py`, `.env.example`, and `.gitignore` without changing `requirements.txt`.
Claude did not create every file?
Check that Claude Code is still working inside `birdcam`. Ask it to list only the files it created during the last prompt.
If anything is missing, ask Claude Code to finish the original prompt without rewriting completed files.
Configure private values and start the server
Your support files keep private values out of version control. They also reserve space for photos and visit data that the app creates while running.
- Ask Claude Code to normalize the support files and create the local `.env` copy by pasting this prompt:
Update the support files without changing app.py, send_test.py, or requirements.txt. Set .env.example to exactly:
BIRD_TOKEN=replace-with-a-long-random-token
BIRD_PASSWORD=replace-with-a-private-password
Set .gitignore to exactly:
.venv/
.env
__pycache__/
captures/
journal.json
bird-listen.wav
firmware/birdcam/secrets.h
Copy .env.example to .env. Do not print .env or reveal any values from it.
What does this prompt protect?
The example file documents the required names without holding real credentials. The ignore file keeps `.env`, captured photos, visit data, and future firmware credentials out of version control.
Claude Code should confirm that `.env.example`, `.gitignore`, and `.env` now exist while leaving the application files unchanged.
- Use this structure when editing `.env` locally:
BIRD_TOKEN=replace-with-a-long-random-token
BIRD_PASSWORD=replace-with-a-private-password
What do these values control?
`BIRD_TOKEN` authenticates camera uploads. `BIRD_PASSWORD` unlocks the browser page.
Both values stay in `.env`. The public `.env.example` keeps placeholders only.
- Replace both placeholder values in `.env` with private values you choose.
- Save `.env` locally without sharing its completed contents.
Your upload token and journal password now live only in the ignored `.env` file.
This server is for your trusted home network. Keep port `5000` closed to the public internet.
The next command keeps running while the journal is available. Use a second Terminal window for it so Claude Code remains available in the original window.
- Create a second Terminal window.
- Return to the `birdcam` folder from earlier.
- Reactivate `.venv` with the same command you used in Step 1.
- Allow incoming connections on your private network if macOS asks after the server starts.
- Start the Bird Journal from `birdcam` with the active `.venv` by running this command:
flask --app app run --host=0.0.0.0 --port 5000
What does this command do?
- `--app app` selects the Flask application in `app.py`.
- `--host=0.0.0.0` makes the development server reachable from other devices on your home network.
- `--port 5000` gives the Bird Journal a consistent local port.
You should see the Flask server list local addresses and keep running, which means the Bird Journal is ready to receive a photo.
Server not starting?
- Confirm the server terminal is inside `birdcam`.
- Confirm `.venv` is active in that terminal.
- Check that `.env` contains both required names without the original placeholder values.
Still stuck? Ask for help checking the Flask startup failure.
Upload a photo and open the journal
The uploader acts like a tiny camera client. It reads JPEG bytes from disk and sends the private token in the request header.
- Save a JPEG bird photo as `bird.jpg` inside `birdcam`.
The test photo should now sit beside `send_test.py` in the `birdcam` folder.
- Switch back to the original terminal in `birdcam`.
- Leave Claude Code when you have finished using it so the active `.venv` shell is available.
Before you run the uploader, do you expect the token-protected endpoint to accept the JPEG?
- Send `bird.jpg` to the running Bird Journal by running this command:
python send_test.py bird.jpg
What does this command do?
Python runs `send_test.py` with `bird.jpg` as its image argument. The script reads `BIRD_TOKEN` from `.env` before sending the JPEG to `/upload`.
You should see `Uploaded: 200` followed by the server response. The upload creates `captures`, saves the JPEG there, and records the first visit in `journal.json`.
Upload did not return 200?
- Confirm `bird.jpg` is inside `birdcam` beside `send_test.py`.
- Confirm the Flask server is still running in the second terminal.
- Check that `BIRD_TOKEN` has the same private value available to both the server and uploader through `.env`.
If the upload still fails, ask for help without sharing the token.
- Open the Bird Journal on your Mac at `http://127.0.0.1:5000`.
- Select your browser's address bar.
- Enter `http://127.0.0.1:5000`.
- Unlock the Bird Journal with the private `BIRD_PASSWORD` value from `.env`.
- Enter the password in the password field.
- Submit the login form.
You should see the uploaded bird photo with its upload time, which confirms the browser can read the first saved visit.
- Open the network URL printed by Flask on a phone connected to the same Wi-Fi.
- Select the phone browser's address bar.
- Enter the Flask network URL that ends with port `5000`.
- Unlock the phone's Bird Journal page with the same private password.
- Enter the password in the password field.
- Submit the login form.
That is the first full loop working. Your Mac accepted a protected JPEG upload while both devices displayed the saved visit behind the password gate.
Your private Bird Journal can now receive and display a real photo. Next, you will add the local classifier that gives each visit a bird name and confidence score.
Name the Bird
Your Bird Journal already accepts private photo uploads from devices on your home network. Each visit currently records the photo and its upload time.
A local image classifier gives your photo-only Bird Journal the bird name and confidence score it currently lacks.
In this step, get ready to:
- Add a local bird classifier with a confidence threshold.
- Test the classifier with an empty feeder or plain wall.
- Compare the empty-scene result with a new bird.jpg result.
Add the local classifier
The Transformers image-classification pipeline ranks the model's bird labels for each photo. A score below 0.5 becomes Not sure.
- Ask Claude Code to create namer.py and extend app.py by sending this prompt from the birdcam folder:
Write namer.py that loads the Hugging Face model chriamue/bird-species-classifier once with the transformers image-classification pipeline and returns the top label and score for a photo. Use the MPS device when torch.backends.mps.is_available() is true, otherwise use CPU. If the top score is under 0.5, return Not sure. Call it from /upload, store the name and score in journal.json, show them under each photo in title case, and add a Today's Tally table of species and counts. Keep the existing upload token and password gate working.
What does this prompt change?
- The new namer.py file loads chriamue/bird-species-classifier once. Reusing the classifier avoids loading the model for every upload.
- The get_classifier() function selects mps when your Mac supports it. Otherwise it selects cpu.
- The /upload route calls identify_bird() before writing the visit to journal.json.
- The Bird Journal displays each result beneath its photo. Today's Tally counts the classified visits by name.
Claude Code creates namer.py. It updates app.py while preserving the password gate and upload token.
- Restart the Flask development server on port 5000 so it loads the new classifier code.
- Switch to the terminal running the Flask development server.
- Press Control-C to stop the current process.
- Rerun the Flask launch command from the previous step.
The server starts listening again on port 5000. The updated upload route is ready to classify JPEGs.
Probe the classifier with an empty scene
An empty feeder or plain wall is an out-of-distribution image because it may look unlike the bird photos used to train the model. This test reveals how the confidence threshold behaves when the input does not contain a clear bird.
- Choose a JPEG showing an empty feeder or plain wall.
- Record the JPEG's path as path/to/your/empty-scene-photo.jpg.
The first classification starts a one-time model download. Give it several minutes to finish before treating the quiet terminal as a problem.
Before you upload the empty scene, do you expect its top score to stay below 0.5?
- Send the empty-scene JPEG through the existing uploader by running this command from the birdcam terminal where .venv is active:
python send_test.py "[[EMPTY_SCENE_PATH=\"path/to/your/empty-scene-photo.jpg\"]]"
What does this command do?
- The send_test.py uploader reads the JPEG from the path you recorded.
- The uploader sends the JPEG bytes to /upload with the private token from .env.
- The server passes those bytes to identify_bird() before saving the visit.
The uploader eventually prints Uploaded: 200. This confirms that the server accepted and classified the empty-scene JPEG.
- Reload the Bird Journal on your Mac to display the empty-scene result.
- Return to the browser tab containing the Bird Journal.
- Refresh the page from your browser's toolbar.
The newest card shows Not sure when the top score is below 0.5. It may instead show a confident bird label that does not match the empty scene.
First classification not finishing?
- Keep the Flask terminal running while the model download completes.
- Confirm that the upload terminal still has the .venv environment active.
- Check that your Mac remains connected to the internet for the first model download.
Why is my first local bird classification upload failing?
The 0.5 threshold handles low confidence by returning Not sure. A non-bird image can still score above that threshold because the classifier always ranks labels from its trained bird classes.
Compare a real bird photo
The empty scene showed how the classifier behaves at the edge of its training data. Your known bird photo gives you a second result to compare against that baseline.
Before you upload bird.jpg again, do you expect it to receive a stronger result than the empty scene?
- Send bird.jpg through the updated classifier by running this command:
python send_test.py bird.jpg
What does this command do?
The command uploads bird.jpg through the same authenticated route as the empty scene. Using the same route makes the two classification results directly comparable.
The uploader prints Uploaded: 200 after classification finishes. The server records the label and score in journal.json.
- Reload the Bird Journal on your Mac to display the newest bird.jpg visit.
- Return to the browser tab containing the Bird Journal.
- Refresh the page from your browser's toolbar.
- Compare the newest bird label and confidence percentage with the empty-scene result.
The newest card shows a title-cased label and confidence percentage. Today's Tally increases by one for that label.
You have the full classification loop working. Each accepted photo now becomes a named visit in your private Bird Journal.
Your Bird Journal can now name uploaded visits. Next, you will connect a camera that sends a new JPEG every two seconds.
Connect Your Camera
Your Bird Journal can name a photo after you upload it. The next goal is to replace those manual tests with a camera that keeps sending frames.
Manual uploads hide how quickly continuous camera frames change the journal. This step connects your selected camera path and sends a JPEG every two seconds.
In this step, get ready to:
- Prepare a webcam, iPhone, or ESP32-CAM as your camera source.
- Create and start a sender that uploads one JPEG every two seconds.
- Watch repeated camera frames fill the Bird Journal with classified visits.
Choose your camera path
Both paths send the same JPEG upload to the existing server. The webcam path uses OpenCV on your Mac. The hardware path uses an ESP32-CAM that can remain near the feeder.
Webcam or iPhone
A built-in webcam needs no extra hardware. An iPhone can also act as the Mac's camera through Continuity Camera.
- Mount your iPhone securely near the Mac if you are using the iPhone path.
- Lock the mounted iPhone in position.
- Make the iPhone available to the Mac by following Apple's Continuity Camera requirements.
Your webcam or iPhone is now positioned for the sender to probe its camera index.
ESP32-CAM
The hardware path uses Arduino CLI to compile and flash the camera firmware. The Arduino-ESP32 core supplies the AI Thinker board definition and camera libraries.
- Check the installed Arduino CLI version by running this command:
arduino-cli version
What does this command do?
The command prints the installed Arduino CLI version. Use the matching tab below for the result you see.
✔️ I see version 1.6.0
Arduino CLI 1.6.0 is ready for the ESP32 board core.
ⓧ I see an older version
- Update the Homebrew package to Arduino CLI 1.6.0 by running these commands:
brew update
brew upgrade arduino-cli
What do these commands do?
- The first command refreshes Homebrew's package information.
- The second command upgrades the existing Arduino CLI package.
- Confirm the updated version by running this command:
arduino-cli version
What does this command do?
The command checks the installed version again after Homebrew finishes the upgrade.
You should now see version 1.6.0 in the output.
Homebrew cannot upgrade Arduino CLI?
Follow the official Arduino CLI installation guide to repair the Homebrew installation.
Ask for help with the exact terminal output you received.
ⓧ Command not found
- Install Arduino CLI through Homebrew by running these commands:
brew update
brew install arduino-cli
What do these commands do?
- The first command refreshes Homebrew's package information.
- The second command installs Arduino CLI on your Mac.
- Confirm the installation by running this command:
arduino-cli version
What does this command do?
The command prints the installed version when Arduino CLI is available in your terminal.
You should see version 1.6.0 in the output.
Still seeing command not found?
Open a new Terminal window so it reloads the command path. Follow the official installation guide if the command still cannot be found.
Help me diagnose why Arduino CLI is still unavailable.
- Install the ESP32 board core and list the AI Thinker board by running these commands:
arduino-cli config init
arduino-cli config add board_manager.additional_urls https://espressif.github.io/arduino-esp32/package_esp32_index.json
arduino-cli core update-index
arduino-cli core install esp32:esp32@4.0.0
arduino-cli board listall "ESP32-CAM"
What do these commands do?
- The configuration commands create Arduino CLI's settings and add Espressif's stable board index.
- The core commands download the board index and install Arduino-ESP32 4.0.0.
- The final command searches the installed boards for the ESP32-CAM definition.
You should see AI Thinker ESP32-CAM with FQBN esp32:esp32:esp32cam.
Cannot find the AI Thinker board?
Check that the Espressif package index URL was copied exactly. Confirm the core installation completed before running the board search again.
Help me fix my ESP32 board installation.
Create your selected sender
The sender turns each camera frame into a JPEG and posts it to the existing upload route. The same token in .env keeps unknown senders from adding visits.
Webcam or iPhone
- Return to Claude Code in birdcam and send this prompt:
Write webcam.py using OpenCV. Probe camera indexes 0 through 4 and print the indexes that open. Accept a camera index argument, read a frame every 2 seconds, encode it as JPEG, and POST it to http://127.0.0.1:5000/upload with the X-Bird-Token value from .env. Print Uploaded: followed by the HTTP status code. Always release the camera when the script stops.
What does this prompt create?
Claude Code creates webcam.py as a continuous camera sender. It probes indexes 0 through 4 so you can identify the camera macOS exposes.
Each successful read becomes a JPEG upload with the token from .env. The finally block releases the camera when the script stops.
Claude Code should create webcam.py inside birdcam.
✔️ I have webcam.py
Your webcam sender is ready to run. Make sure Claude Code saved webcam.py before continuing.
ⓧ I'd like to double check the full code
Compare your webcam.py with this complete reference:
import argparse
import os
import time
import cv2
from dotenv import load_dotenv
import requests
load_dotenv()
def available_cameras():
available = []
for index in range(5):
capture = cv2.VideoCapture(index)
if capture.isOpened():
available.append(index)
capture.release()
return available
parser = argparse.ArgumentParser()
parser.add_argument("camera", type=int, nargs="?", default=0)
parser.add_argument("--url", default="http://127.0.0.1:5000/upload")
args = parser.parse_args()
print("Available camera indexes:", available_cameras())
camera = cv2.VideoCapture(args.camera)
if not camera.isOpened():
raise SystemExit(f"Could not open camera index {args.camera}")
try:
while True:
success, frame = camera.read()
if not success:
print("Could not read a frame")
time.sleep(2)
continue
encoded, buffer = cv2.imencode(".jpg", frame)
if not encoded:
print("Could not encode a JPEG")
time.sleep(2)
continue
try:
response = requests.post(
args.url,
data=buffer.tobytes(),
headers={
"Content-Type": "image/jpeg",
"X-Bird-Token": os.environ["BIRD_TOKEN"],
},
timeout=120,
)
print(f"Uploaded: {response.status_code}")
except requests.RequestException as error:
print(f"Upload failed: {error}")
time.sleep(2)
finally:
camera.release()
The first camera read can make macOS request camera access for Terminal. Keep that permission prompt in front of the Terminal window.
- Start the webcam sender with camera index 0 by running this command:
python webcam.py 0
What does this command do?
The command starts webcam.py with camera index 0. The script prints every camera index it can open before it begins the two-second upload loop.
- Grant camera access to Terminal when macOS asks.
You should see the available camera indexes followed by Uploaded: 200 every two seconds. The sender keeps control of this Terminal window until you press Control-C.
Camera index 0 does not open?
Use an index from the Available camera indexes: output. Run the command above again after replacing 0 with that working index.
Help me select the working camera index.
ESP32-CAM
- Seat the ESP32-CAM board firmly on the ESP32-CAM-MB base.
- Connect the ESP32-CAM-MB base to your Mac with a Micro USB data cable.
- Return to Claude Code in birdcam and send this prompt:
Write firmware/birdcam/birdcam.ino for the AI Thinker ESP32-CAM using Espressif's AI Thinker pin map. Read Wi-Fi name, Wi-Fi password, server URL and token from secrets.h. Take an SVGA JPEG every 2 seconds and POST it to /upload with Content-Type image/jpeg and the X-Bird-Token header. Print Uploaded: and the HTTP status code to serial. Add secrets.h to .gitignore. Help me copy secrets.example.h to secrets.h, find the /dev/cu.* serial port, compile for esp32:esp32:esp32cam, upload, and open the serial monitor at 115200.
What does this prompt create?
Claude Code creates firmware for the AI Thinker camera pin map. The firmware captures an SVGA JPEG and sends it through HTTP every two seconds.
Private Wi-Fi and token values stay in secrets.h. The existing .gitignore keeps that file out of version control.
Claude Code should create firmware/birdcam/birdcam.ino and firmware/birdcam/secrets.example.h.
✔️ I have the firmware files
Your ESP32-CAM firmware files are ready for private settings and compilation.
ⓧ I'd like to double check the full code
Compare firmware/birdcam/secrets.example.h with this reference:
#pragma once
const char *WIFI_SSID = "your-2.4-ghz-wifi-name";
const char *WIFI_PASSWORD = "your-wifi-password";
const char *SERVER_URL = "http://your-mac-local-ip:5000/upload";
const char *BIRD_TOKEN = "same-token-as-your-env-file";
Compare firmware/birdcam/birdcam.ino with this complete reference:
#include "esp_camera.h"
#include <HTTPClient.h>
#include <WiFi.h>
#include "secrets.h"
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
void connectWiFi() {
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Camera IP: ");
Serial.println(WiFi.localIP());
}
void startCamera() {
camera_config_t config = {};
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.ledc_timer = LEDC_TIMER_0;
config.ledc_channel = LEDC_CHANNEL_0;
config.pixel_format = PIXFORMAT_JPEG;
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
config.jpeg_buffer_size = 0;
esp_err_t result = esp_camera_init(&config);
if (result != ESP_OK) {
Serial.printf("Camera init failed: 0x%x\n", result);
while (true) {
delay(1000);
}
}
}
void uploadFrame() {
camera_fb_t *frame = esp_camera_fb_get();
if (frame == nullptr) {
Serial.println("Camera capture failed");
return;
}
WiFiClient client;
HTTPClient http;
int statusCode = -1;
if (http.begin(client, SERVER_URL)) {
http.addHeader("Content-Type", "image/jpeg");
http.addHeader("X-Bird-Token", BIRD_TOKEN);
statusCode = http.POST(frame->buf, frame->len);
http.end();
}
esp_camera_fb_return(frame);
Serial.print("Uploaded: ");
Serial.println(statusCode);
}
void setup() {
Serial.begin(115200);
delay(1000);
startCamera();
connectWiFi();
}
void loop() {
if (WiFi.status() != WL_CONNECTED) {
connectWiFi();
}
uploadFrame();
delay(2000);
}
- Follow Claude Code's instructions to copy firmware/birdcam/secrets.example.h to firmware/birdcam/secrets.h.
- Complete firmware/birdcam/secrets.h with your 2.4 GHz Wi-Fi name, Wi-Fi password, Mac local-network upload URL, and the same BIRD_TOKEN stored in .env.
- Record the serial port that Claude Code finds: your /dev/cu.* serial port.
The values in secrets.h include your Wi-Fi password and upload token. Keep this file private while you compile and flash the board.
- Compile the AI Thinker firmware by running this command from birdcam:
arduino-cli compile -b esp32:esp32:esp32cam firmware/birdcam
What does this command do?
The command compiles the sketch in firmware/birdcam for the esp32:esp32:esp32cam board definition.
You should see the compilation complete without an error.
- Upload the compiled firmware through your recorded serial port by running this command:
arduino-cli upload firmware/birdcam -p [[SERIAL_PORT="your /dev/cu.* serial port"]] -b esp32:esp32:esp32cam
What does this command do?
The command flashes the compiled sketch to the ESP32-CAM through the serial port you recorded. The FQBN keeps the upload matched to the AI Thinker board definition.
You should see the upload complete successfully before the board restarts.
- Open the serial monitor at 115200 by running this command:
arduino-cli monitor -p [[SERIAL_PORT="your /dev/cu.* serial port"]] --config 115200
What does this command do?
The serial monitor shows the ESP32-CAM's Wi-Fi connection and upload status. The 115200 setting matches the speed configured in the firmware.
You should see the camera connect to Wi-Fi and print Uploaded: 200 every two seconds.
No serial port or seeing Uploaded: 401?
A missing serial port usually points to the Micro USB cable, the ESP32-CAM-MB connection, or the required USB driver. Reseat the board before checking the port again.
An Uploaded: 401 result means the token in firmware/birdcam/secrets.h differs from the private BIRD_TOKEN in .env.
Help me diagnose my ESP32-CAM connection or upload status.
Watch the journal fill with repeated frames
Your selected sender now captures the same scene every two seconds. The Bird Journal currently treats every authenticated upload as a new visit.
Before you refresh the Bird Journal, do you expect one fresh visit or a growing stack of nearly identical visits?
- Refresh the Bird Journal while the camera sender continues uploading.
You should see repeated camera frames rapidly fill the Bird Journal with classified seen visits. Your sender keeps printing Uploaded: 200 every two seconds.
That flood is the intended result. It proves the live camera path works while exposing how unusable an unfiltered stream becomes.
No new camera cards?
Confirm the Flask server is still running on port 5000. Check that the sender continues to print Uploaded: 200.
Help me trace why the sender is not adding cards.
Your live camera connection works. Next, you will keep the successful uploads while filtering out frames where almost nothing moved.
Keep Only the Frames That Moved
Your camera sender is feeding the Bird Journal every two seconds. The repeated-photo flood proved the connection works, but useful visits are disappearing inside a wall of nearly identical cards.
A motion filter uses frame differencing to reject nearly identical images before Flask classifies or saves them.
In this step, get ready to:
- Add grayscale motion filtering to app.py with Claude Code.
- Prove still frames increase the skipped count without creating new cards.
- Trigger changed frames that become saved visits.
Add motion filtering to app.py
Comparing full camera photos would make every check more expensive than necessary. A tiny grayscale copy keeps the movement signal while discarding colour and most image detail.
- Return to the Claude Code session in your birdcam folder from earlier.
- Update app.py with the motion filter by sending this prompt to Claude Code:
In POST /upload, decode each JPEG with Pillow, convert it to grayscale, resize it to 64 by 48, and compare it with the previous frame. If under 3% of pixels changed by more than 25 levels, return a 200 skipped response without naming or saving the photo and increment Frames skipped today. Otherwise classify and save the visit. Show Frames skipped today on the journal. Keep the previous frame in memory and protect the upload path with a lock.
What does this prompt do?
- Pillow creates a 64 by 48 grayscale copy of each incoming JPEG.
- The filter measures how many pixels changed by more than 25 brightness levels.
- A changed ratio below 0.03 increments the skipped count before classification or photo storage.
- The lock prevents two uploads from changing the previous frame or journal at the same time.
Claude Code should update app.py with the motion settings, the previous-frame state, the upload lock, and the Frames skipped today display.
✔️ Awesome, I've got everything!
Great. Confirm Claude Code has finished updating app.py before restarting the server.
ⓧ I'd like to double check the full code
Compare your updated app.py with this complete version:
from collections import Counter
from datetime import datetime
from functools import wraps
from io import BytesIO
import json
import os
from pathlib import Path
import secrets
import threading
from dotenv import load_dotenv
from flask import Flask, Response, redirect, render_template_string, request, send_from_directory, session, url_for
from PIL import Image, ImageChops, UnidentifiedImageError
from namer import identify_bird
load_dotenv()
BASE_DIR = Path(__file__).resolve().parent
CAPTURES_DIR = BASE_DIR / "captures"
JOURNAL_PATH = BASE_DIR / "journal.json"
BIRD_TOKEN = os.environ["BIRD_TOKEN"]
BIRD_PASSWORD = os.environ["BIRD_PASSWORD"]
MOTION_SIZE = (64, 48)
PIXEL_THRESHOLD = 25
CHANGE_THRESHOLD = 0.03
MAX_UPLOAD_BYTES = 5 * 1024 * 1024
app = Flask(__name__)
app.secret_key = BIRD_TOKEN
CAPTURES_DIR.mkdir(exist_ok=True)
_previous_frame = None
_upload_lock = threading.Lock()
def empty_journal():
return {"entries": [], "skipped": {}}
def load_journal():
if not JOURNAL_PATH.exists():
return empty_journal()
with JOURNAL_PATH.open("r", encoding="utf-8") as file:
return json.load(file)
def save_journal(journal):
temporary = JOURNAL_PATH.with_suffix(".tmp")
with temporary.open("w", encoding="utf-8") as file:
json.dump(journal, file, indent=2)
temporary.replace(JOURNAL_PATH)
def login_required(view):
@wraps(view)
def wrapped(*args, **kwargs):
if not session.get("authenticated"):
return redirect(url_for("login"))
return view(*args, **kwargs)
return wrapped
@app.route("/login", methods=["GET", "POST"])
def login():
error = None
if request.method == "POST":
submitted = request.form.get("password", "")
if secrets.compare_digest(submitted, BIRD_PASSWORD):
session["authenticated"] = True
return redirect(url_for("index"))
error = "Incorrect password"
return render_template_string(
"""
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bird Journal Login</title>
<style>
body { font-family: system-ui; max-width: 28rem; margin: 4rem auto; padding: 1rem; background: #f4f0e6; }
form { background: white; padding: 1.5rem; border-radius: 1rem; }
input, button { box-sizing: border-box; width: 100%; padding: .8rem; margin-top: .7rem; }
.error { color: #a11; }
</style>
<form method="post">
<h1>Bird Journal</h1>
<p>Enter the journal password.</p>
{% if error %}<p class="error">{{ error }}</p>{% endif %}
<input type="password" name="password" required autofocus>
<button type="submit">Open Journal</button>
</form>
""",
error=error,
)
@app.get("/logout")
def logout():
session.clear()
return redirect(url_for("login"))
@app.get("/")
@login_required
def index():
journal = load_journal()
today = datetime.now().date().isoformat()
entries = list(reversed(journal["entries"]))
today_entries = [entry for entry in journal["entries"] if entry["date"] == today]
seen_counts = Counter(
entry["name"] for entry in today_entries if entry.get("type", "seen") == "seen"
)
heard_counts = Counter(
entry["name"] for entry in today_entries if entry.get("type") == "heard"
)
skipped = journal["skipped"].get(today, 0)
return render_template_string(
"""
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bird Journal</title>
<style>
body { font-family: system-ui; margin: 0; background: #eef3e7; color: #203020; }
header, main { max-width: 62rem; margin: auto; padding: 1rem; }
header { display: flex; align-items: center; justify-content: space-between; }
.stats, .grid { display: grid; gap: 1rem; }
.stats { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.grid { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: 1rem; }
section, article { background: white; border-radius: 1rem; padding: 1rem; box-shadow: 0 4px 16px #0001; }
img { width: 100%; border-radius: .7rem; }
table { width: 100%; border-collapse: collapse; }
td { border-top: 1px solid #ddd; padding: .4rem 0; }
.heard { border-left: .4rem solid #6a5acd; }
small { color: #596559; }
</style>
<header>
<h1>Bird Journal</h1>
<a href="{{ url_for('logout') }}">Log out</a>
</header>
<main>
<div class="stats">
<section>
<h2>Today's Tally</h2>
<h3>Seen</h3>
<table>
{% for name, count in seen_counts.items() %}<tr><td>{{ name }}</td><td>{{ count }}</td></tr>{% else %}<tr><td>No visits yet</td><td>0</td></tr>{% endfor %}
</table>
{% if heard_counts %}
<h3>Heard</h3>
<table>{% for name, count in heard_counts.items() %}<tr><td>{{ name }}</td><td>{{ count }}</td></tr>{% endfor %}</table>
{% endif %}
</section>
<section>
<h2>Motion Filter</h2>
<p><strong>{{ skipped }}</strong> frames skipped today</p>
</section>
</div>
<div class="grid">
{% for entry in entries %}
<article class="{{ 'heard' if entry.get('type') == 'heard' else '' }}">
{% if entry.get('type') == 'heard' %}
<h2>Heard: {{ entry.name }}</h2>
{% else %}
<img src="{{ url_for('capture', filename=entry.filename) }}" alt="{{ entry.name }}">
<h2>{{ entry.name }}</h2>
{% endif %}
<p>{{ (entry.score * 100)|round|int }}% confidence</p>
<small>{{ entry.timestamp }}</small>
</article>
{% else %}<p>No visits yet.</p>{% endfor %}
</div>
</main>
""",
entries=entries,
seen_counts=seen_counts,
heard_counts=heard_counts,
skipped=skipped,
)
@app.get("/captures/<path:filename>")
@login_required
def capture(filename):
return send_from_directory(CAPTURES_DIR, filename)
@app.post("/upload")
def upload():
global _previous_frame
submitted_token = request.headers.get("X-Bird-Token", "")
if not secrets.compare_digest(submitted_token, BIRD_TOKEN):
return {"error": "unauthorized"}, 401
if request.content_length and request.content_length > MAX_UPLOAD_BYTES:
return {"error": "image too large"}, 413
jpeg_bytes = request.get_data()
if not jpeg_bytes:
return {"error": "empty request body"}, 400
try:
with Image.open(BytesIO(jpeg_bytes)) as image:
image.verify()
with Image.open(BytesIO(jpeg_bytes)) as image:
motion_frame = image.convert("L").resize(MOTION_SIZE)
except (UnidentifiedImageError, OSError):
return {"error": "body is not a readable image"}, 400
with _upload_lock:
changed_ratio = 1.0
if _previous_frame is not None:
difference = ImageChops.difference(_previous_frame, motion_frame)
pixels = difference.getdata()
changed_ratio = sum(value > PIXEL_THRESHOLD for value in pixels) / (
MOTION_SIZE[0] * MOTION_SIZE[1]
)
_previous_frame = motion_frame
now = datetime.now()
today = now.date().isoformat()
journal = load_journal()
if changed_ratio < CHANGE_THRESHOLD:
journal["skipped"][today] = journal["skipped"].get(today, 0) + 1
save_journal(journal)
return {"status": "skipped", "changed": changed_ratio}, 200
filename = now.strftime("%Y%m%d-%H%M%S-%f.jpg")
(CAPTURES_DIR / filename).write_bytes(jpeg_bytes)
name, score = identify_bird(jpeg_bytes)
journal["entries"].append(
{
"type": "seen",
"filename": filename,
"timestamp": now.isoformat(timespec="seconds"),
"date": today,
"name": name,
"score": score,
}
)
save_journal(journal)
return {"status": "saved", "name": name, "score": score}, 200
- Stop the existing Flask development server by pressing Control-C in its terminal.
- Restart the Flask development server from birdcam by running this command:
flask --app app run --host=0.0.0.0 --port 5000
What does this command do?
- The --app app option loads the Flask application from app.py.
- The --host=0.0.0.0 option keeps the Bird Journal available to devices on your trusted home network.
- The --port 5000 option keeps the upload route and journal on the same port used by your camera sender.
You should see the Flask server start on port 5000 and wait for new requests.
Prove still frames are skipped
A skipped frame still returns a successful response to the sender. The shortcut happens before identify_bird() or JPEG storage, which saves model work and disk space.
Before you test the still scene, what do you expect the sender and Bird Journal to show when the server rejects a frame as unchanged?
This check takes about 45 seconds because the camera sends one frame every two seconds. A quiet wait here means the filter has enough samples to prove itself.
- Leave the selected camera pointed at a still scene until more than 20 upload intervals have passed.
- Watch the sender terminal until at least 20 more Uploaded: 200 lines appear.
- Reload the Bird Journal from earlier.
You should see Frames skipped today pass 20 while the sender continues printing Uploaded: 200.
You should see no new photo cards for the near-identical frames.
That flood is under control. The sender stays healthy while the journal keeps only meaningful movement.
Still seeing repeated photo cards?
Keep the camera and everything in its view still during the baseline. Moving shadows or a changing screen can push the changed ratio above 0.03.
Compare the motion section in app.py with the complete version above. Confirm MOTION_SIZE is (64, 48), PIXEL_THRESHOLD is 25, and CHANGE_THRESHOLD is 0.03.
Help me diagnose why still frames are being saved.
Trigger a saved visit
Movement pushes the changed ratio above the threshold. That frame follows the existing classification and storage path, so the motion filter protects the journal without changing how a real visit is recorded.
Before you move through the frame, do you think the skipped count will continue rising or pause while a new visit is saved?
- Wave a hand through the camera view for at least two seconds.
- Reload the Bird Journal after the sender prints its next successful upload.
You should see a new saved visit while the skipped counter pauses for the changed frame.
- Display a bird photo on your phone.
- Hold the phone inside the camera view long enough for the sender to capture it.
- Reload the Bird Journal after the next successful upload.
You should see a new card with a classification result and confidence percentage. The result may be a bird label or Not sure because the confidence threshold still applies.
Your Bird Journal now ignores still scenes while keeping real movement. Next up, you will aim the finished camera at the feeder and prepare it for a real bird visit.
Mount It at the Feeder
Your motion filter now keeps repeated frames out of the Bird Journal. The final job is to give your local classifier a feeder view it can use.
A technically working camera becomes a useful bird cam when its framing, glare, power, and model input match the real feeder scene.
In this step, get ready to:
- Position your selected camera safely for the feeder view.
- Aim through the window and adjust the angle using the latest Bird Journal photo.
- Keep the system ready and capture a real bird visit.
Position your camera safely
The camera needs a stable indoor position before you refine its view. Choose the instructions for the path you already set up.
$0 Webcam Path
- Position the Mac or mounted iPhone safely indoors where its camera can face the feeder through the window.
Your Mac or mounted iPhone should remain safely indoors while the selected camera sender stays active.
ESP32-CAM Path
- Place the ESP32-CAM from earlier in a small ventilated enclosure with a clear lens opening.
The enclosure should protect the board without covering the camera lens or blocking ventilation.
- Connect the ESP32-CAM to stable USB power.
The board should remain powered while its sender stays connected to the Bird Journal.
Aim and check the feeder view
A distant feeder leaves fewer useful details for classification. Reflections from the window can also obscure the bird.
- Aim the camera through the window so the feeder occupies much of the frame.
The camera should now face the feeder instead of a wide area around it.
- Place the lens close to the glass to reduce reflections.
The lens should sit close enough to the window that indoor reflections cover less of the feeder view.
- Adjust the camera angle using the latest Bird Journal photo until the feeder fills a useful part of the frame.
- Return to the browser tab with the Bird Journal from earlier.
- Refresh the page.
- Review the newest saved photo at the top of the journal.
You should see the feeder filling a useful part of the latest photo with minimal window reflections. This confirms the newest JPEG in captures has the framing you want.
Latest Photo Still Showing the Old Angle?
- Confirm the selected camera sender is still printing Uploaded: 200.
- Shift the camera angle slightly to create enough movement for a saved frame.
- Wait for the next two-second upload before refreshing the Bird Journal.
Help me check why the latest Bird Journal photo does not show my new feeder angle.
Wait for a real feeder visit
Your camera now has the view it needs. Natural movement at the feeder can trigger a saved visit while still scenes continue to be skipped.
- Leave the Flask development server from earlier running on the trusted home network at port 5000.
- Leave the selected camera sender running.
The sender should continue to print Uploaded: 200 every two seconds. The Bird Journal should remain available on your home network.
A real visit can take a while, so this waiting time sits outside the active project estimate.
Before a bird enters the frame, what do you expect the motion filter to do with a still feeder? What should change when the bird moves into view?
- Keep the camera pointed at the feeder until a real bird creates a new saved visit.
- Capture a screenshot of the Bird Journal after the real bird creates a saved visit.
- Return to the browser tab with the Bird Journal.
- Refresh the page.
- Press Shift-Command-4 on your Mac.
- Drag over the newest visit card and Today's Tally.
You should see a real bird photo with a label and confidence score. Today's Tally should include the new classified visit.
The full loop now turns motion at the feeder into a classified visit in your private journal.
Secret mission
Name Birds by Their Song
Add a second local sensing path for birds that call before they reach the feeder. Record 15 seconds of audio and add the strongest BirdNET identification to the Bird Journal as a heard visit.
Clean Up Your Resources
Clean Up Your Resources
Your Bird Journal runs on your Mac and trusted home network, so there are no ongoing cloud charges. Choose whether to keep these local resources running, pause them, or delete them.
The $0 webcam path adds no camera hardware cost. The optional ESP32-CAM kit costs about $10 to $20 before shipping, taxes, a data cable, and USB power.
Resources you used:
- The Flask development server on port 5000 and your selected two-second camera sender.
- The birdcam folder with its .venv environment, application scripts, requirements files, and optional ESP32-CAM firmware.
- The captures folder, journal.json, and bird-listen.wav containing your saved visits and microphone recording.
- Private values stored in .env and firmware/birdcam/secrets.h.
- Local model caches downloaded by Transformers and BirdNET for image and sound identification.
Keep everything running
No action needed. Choose this if you want the camera to keep recording activity in your Bird Journal.
The selected sender continues uploading every two seconds. The Bird Journal remains available on port 5000 inside your trusted home network.
Your project files and downloaded model caches remain on your Mac. Keeping them creates no ongoing cloud charges.
Pause - I'll come back to this later
Shut down the running processes to release the camera and stop local-network access. Your project files, visits, private values, and model caches remain on disk.
- Stop webcam.py by pressing Control-C in its Terminal window if you chose the webcam path.
- Disconnect USB power from the ESP32-CAM if you chose the hardware path.
- Stop the Flask development server by pressing Control-C in its Terminal window.
The camera stops sending frames. The Bird Journal becomes unavailable until you restart the sender and Flask server.
Delete - I don't want to use this again
Remove the local project resources and start fresh.
Deleting birdcam is permanent. Your private values, visit history, photos, audio, code, firmware sources, and virtual environment disappear together.
- Stop webcam.py by pressing Control-C in its Terminal window if you chose the webcam path.
- Disconnect USB power from the ESP32-CAM if you chose the hardware path.
- Stop the Flask development server by pressing Control-C in its Terminal window.
- Replace the private values in firmware/birdcam/secrets.h with the placeholders from firmware/birdcam/secrets.example.h before sharing any firmware files.
- Retain the ESP32-CAM unless you have reflashed it without your private Wi-Fi and token values.
The source file and the firmware flashed onto the ESP32-CAM are separate copies. Deleting birdcam removes the source file from your Mac.
- Delete the birdcam folder from the Terminal window where Flask was running by running:
cd .. && rm -rf birdcam && ls
What Does This Command Do?
- The cd .. command moves from birdcam to its parent folder.
- The rm -rf birdcam command permanently removes the project folder and everything inside it.
- The ls command lists the remaining items so you can verify the deletion.
You should see the parent folder contents without birdcam in the list. That confirms the project files and private source files are gone.
Still See the Project Folder?
- Confirm that you used the Terminal window whose prompt was inside birdcam before deletion.
- Use Finder to locate and delete that exact birdcam folder if the command ran from another location.
- Get help locating the folder safely.
Downloaded model caches live outside birdcam. Remove them only if you want to reclaim their disk space.
- Search your Mac in Finder for chriamue to locate the downloaded classifier cache.
- Delete only a matching cache folder that also contains bird-species-classifier.
- Search your Mac in Finder for BirdNET to locate the downloaded acoustic model cache.
- Delete only a cache folder that you can confirm belongs to acoustic model 3.0.
Your project folder is gone. Any confirmed model cache folders you removed no longer consume local storage.
Nice Work!
Nice Work!
You made it! Your password-gated Bird Journal now records classified feeder visits on your trusted home network.
You've learned how to:
- Built a password-gated Bird Journal with Flask for your trusted home network. The journal accepts token-authenticated JPEG uploads from another device.
- Added local image classification with Transformers. Each saved visit receives a species label with a confidence score.
- Connected your selected two-second camera sender and exposed a repeated-frame flood. Fixed the flood with a 64-by-48 grayscale motion filter. The Bird Journal now counts skipped frames.
- Completed the optional Secret Mission with a 15-second microphone recording. BirdNET adds the strongest result at or above 0.5 confidence as a heard visit. The Bird Journal keeps seen and heard tallies separate.
Ready to quiz yourself?