Skip to content

About

BirdNET-Pi (Nachtzuster's maintained fork for current Raspberry Pis) with the website served from Cloudflare: the Pi records and identifies, a Cloudflare Worker hosts the site.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

You may not use BirdNET-Pi to develop a commercial product!!!!

BirdNET-Pi

A realtime acoustic bird classification system for the Raspberry Pi 5, 4B, 400, 3B+, and 0W2

Cloud branch: the Pi records and identifies; the website runs on Cloudflare.

Icon made by Freepik from www.flaticon.com

About this repository

BirdNET-Pi was created by mcguirepr89, whose repository is now archived. Nachtzuster has kept that work going, keeping BirdNET-Pi running on recent Raspberry Pi hardware and Raspberry Pi OS releases (the Pi 5, Bookworm and Trixie) and adding the improvements listed below. Nachtzuster's repository is the one to install from and the place to report Pi-side issues.

This repository is a fork of Nachtzuster's. Its cloud branch was created to move BirdNET-Pi's web serving off the Pi and onto Cloudflare, using the free plan or the inexpensive Workers Paid plan ($5 a month). The Pi keeps recording and identifying birds exactly as before. A small agent pushes each detection, clip and spectrogram to a Cloudflare Worker, which stores them (D1 for detections, R2 for audio and images) and serves the website. The Pi never accepts a connection from the internet. You can see it running at birds.dorringtonbirds.com; setup is in cloud/README.md and cloud/docs/DEPLOY.md.

Why Cloudflare

Security: a BirdNET-Pi that serves its own website has to be opened to the internet, usually through a router port-forward to a small computer on your home network. With the site on Cloudflare, nothing on the Pi is reachable from outside: no open ports, and Cloudflare's network absorbs attacks and bot traffic before they get anywhere near your home. The admin pages can sit behind Cloudflare Access. Privacy: visitors talk to Cloudflare, not to your house, so your home IP address is never published, and the public API rounds the station's coordinates. Customization: the site is a set of static pages over a documented JSON API, so you can restyle it, swap in a different design (the Field Journal design ships alongside a port of the classic pages) or build your own, then publish it with one command without touching the Pi.

License: the cloud code is a derivative of BirdNET-Pi and carries the same CC BY-NC-SA 4.0 license: free to use, change and share, but not for commercial products.

Cost: the free plan covers a small station: 100,000 requests a day, 5 million database rows read and 100,000 written a day, 5 GB of database and 10 GB of audio and images. A station with years of history will want Workers Paid ($5 a month), because loading a large backlog writes far more than 100,000 rows a day, and storage beyond 10 GB costs $0.015 per GB a month. For example, the Dorrington station (about 690,000 detections and 19 GB of clips) costs the $5 plan plus about 15 cents.

Nachtzuster's improvements

Nachtzuster's work on top of mcguirepr89's original includes:

  • Backup & Restore
  • Web ui is much more responsive
  • Daily charts now include all species, not just top/bottom 10
  • Bump apprise version, so more notification types are possible
  • Swipe events on Daily Charts (by @croisez)
  • Support for 'Species range model V2.4 - V2'
  • Bookworm and Trixie support
  • Experimental support for writing transient files to tmpfs
  • Rework analysis to consolidate analysis/server/extraction. Should make analysis more robust and slightly more efficient, especially on installations with a large number of recordings
  • Bump tflite_runtime to 2.17.1, it is faster
  • Rework daily_plot.py (chart_viewer) to run as a daemon to avoid the very expensive startup
  • Lots of fixes & cleanups

!! note: see 'Migrating' on how to migrate from mcguirepr89

Introduction

BirdNET-Pi is built on the BirdNET framework by @kahst using pre-built TFLite binaries by @PINTO0309 . It is able to recognize bird sounds from a USB microphone or sound card in realtime and share its data with the rest of the world.

Check out birds from around the world

Features

  • 24/7 recording and automatic identification of bird songs, chirps, and peeps using BirdNET machine learning
  • Automatic extraction and cataloguing of bird clips from full-length recordings
  • Tools to visualize your recorded bird data and analyze trends
  • Live audio stream and spectrogram
  • Automatic disk space management that periodically purges old audio files
  • BirdWeather integration -- you can request a BirdWeather ID from BirdNET-Pi's "Tools" > "Settings" page
  • Web interface access to all data and logs provided by Caddy
  • GoTTY and GoTTY x86 Web Terminal
  • Tiny File Manager
  • FTP server included
  • SQLite3 Database
  • Adminer database maintenance
  • phpSysInfo
  • Apprise Notifications supporting 90+ notification platforms
  • Localization supported

Requirements

  • A Raspberry Pi 5, Raspberry 4B, Raspberry Pi 400, Raspberry Pi 3B+, or Raspberry Pi 0W2 (The 3B+ and 0W2 must run on RaspiOS-ARM64-Lite)
  • An SD Card with the 64-bit version of RaspiOS installed (please use Trixie) -- Lite is recommended, but the installation works on RaspiOS-ARM64-Full as well. Downloads available within the Raspberry Pi Imager.
  • A USB Microphone or Sound Card

Installation

A comprehensive installation guide is available here. This guide is slightly out of date: pick the current 64-bit Raspberry Pi OS (Trixie), and use the install command below rather than the guide's, which still points to mcguirepr89's repo.

Please note that installing BirdNET-Pi on top of other servers is not supported. If this is something that you require, please open a discussion for your idea and inquire about how to contribute to development.

Raspberry Pi 3B[+] and 0W2 installation guide available here

The system can be installed with:

curl -s https://raw.githubusercontent.com/Nachtzuster/BirdNET-Pi/main/newinstaller.sh | bash

The installer takes care of any and all necessary updates, so you can run that as the very first command upon the first boot, if you'd like.

The installation creates a log in $HOME/installation-$(date "+%F").txt.

Adding the Cloudflare website (this fork's cloud branch)

Install BirdNET-Pi as above first, and get it recording. Then deploy the Cloudflare side by following cloud/docs/DEPLOY.md, which gives you the site's address and an ingest token. On the Pi, keep this branch in its own folder so the main BirdNET-Pi install keeps updating normally from Nachtzuster:

git clone -b cloud https://github.com/Fryerchristopher/BirdNET-Pi.git ~/birdnet-cloud
bash ~/birdnet-cloud/cloud/pi/install.sh https://birds.example.com <INGEST_TOKEN>
journalctl -fu birdnet_cloud_agent   # watch the first push (and any backfill)

install.sh copies the agent into ~/BirdNET-Pi/scripts/ and installs the birdnet_cloud_agent service. BirdNET-Pi's own updates leave it in place. To update the agent later, run git -C ~/birdnet-cloud pull and the install.sh line again.

Access

The BirdNET-Pi can be accessed from any web browser on the same network:

  • http://birdnetpi.local OR your Pi's IP address
  • Default Basic Authentication Username: birdnet
  • Password is empty by default. Set one in "Tools" > "Settings" > "Advanced Settings", especially if anyone else can reach your network. With the cloud branch the public site is on Cloudflare, and the Pi's own pages stay on your local network.

mcguirepr89's wiki and discussions are archived (still readable, no longer open for posts). Current questions belong in Nachtzuster's discussions. The archive is still a good source on

Updating

Use the web interface and go to "Tools" > "System Controls" > "Update". If you encounter any issues with that, or suspect that the update did not work for some reason, please save its output and post it in an issue where we can help.

Backup and Restore

Use the web interface and go to "Tools" > "System Controls" > "Backup" or "Restore". Backup/Restore is primarily meant for migrating your data from one system to another. Since the time required to create or restore a backup depends on the size of the data set and the speed of the storage, this could take quite a while.

Alternatively, the backup script can be used directly. These examples assume the backup medium is mounted on /mnt

To backup:

./scripts/backup_data.sh -a backup -f /mnt/birds/backup-2024-07-09.tar

To restore:

./scripts/backup_data.sh -a restore -f /mnt/birds/backup-2024-07-09.tar

x86_64 support

x86_64 support is mainly there for developers or otherwise more Linux savvy people. That being said, some pointers:

  • Use Debian 12 or 13
  • The user needs passwordless sudo

For Proxmox, a user has reported adding this in their cpu-models.conf, in order for the custom TFLite build to work.

cpu-model: BirdNet
    flags +sse4.1
    reported-model host

Uninstallation

/usr/local/bin/uninstall.sh && cd ~ && rm -drf BirdNET-Pi

Migrating

Before switching, make sure your installation is fully up-to-date. Also make sure to have a backup, that is also the only way to get back to the original BirdNET-Pi. Please note that upgrading the underlying OS in place (for example from Bullseye to Bookworm or Trixie) is not going to work. To move to a newer OS, start from a fresh install and restore your backup.

Run these commands to migrate from mcguirepr89's repo to Nachtzuster's:

git remote remove origin
git remote add origin https://github.com/Nachtzuster/BirdNET-Pi.git
./scripts/update_birdnet.sh

Troubleshooting and Ideas

*Hint: A lot of weird problems can be solved by simply restarting the core services. Do this from the web interface "Tools" > "Services" > "Restart Core Services" Having trouble or have an idea? Submit an issue for trouble and a discussion for ideas. Please do not submit an issue as a discussion -- the issue tracker solicits information that is needed for anyone to help -- discussions are not for issues.

PLEASE search the repo for your issue before creating a new one. This repo has nothing to do with the validity of the detection results, so please do not start any issues around "False positives."

Sharing

Please join a Discussion!! and please join BirdWeather!! I hope that if you find BirdNET-Pi has been worth your time, you will share your setup, results, customizations, etc. HERE and will consider making your installation public, which this fork's Cloudflare site lets you do without exposing the Pi.

Home Assistant add-on

BirdNET-Pi can also be run as a Home Assistant add-on through Docker. For more information : https://github.com/alexbelgium/hassio-addons/blob/master/birdnet-pi/README.md

Docker

BirdNET-Pi can also be run as a Docker container. For more information : https://github.com/alexbelgium/hassio-addons/blob/master/birdnet-pi/README_standalone.md

Cool Links

Internationalization:

The bird names are in English by default, but other localized versions are available thanks to the wonderful efforts of @patlevin and Wikipedia. Use the web interface's "Tools" > "Settings" and select your "Database Language" to have the detections in your language.

Internationalization

Screenshots

The Pi's own web interface:

Overview Spectrogram

The Field Journal design on Cloudflare (birds.dorringtonbirds.com):

This week Today

🤔

Are you a lucky ducky with a spare Raspberry Pi? Try Folding@home!

About

BirdNET-Pi (Nachtzuster's maintained fork for current Raspberry Pis) with the website served from Cloudflare: the Pi records and identifies, a Cloudflare Worker hosts the site.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages