BirdNet Pi install

BirdNET Pi is software developed at the Cornel Lab of Ornithology and the Chemnitz University of Technology that turns a Raspberry Pi single board computer into a bird song recognizer. I've set one up to listen in my backyard and to go camping with me (mounted in a trailer). One extra feature that I wanted was GPS logging, so that when the trailer moves, the locations of the bird recognitions move as well. Here are some notes on the project...

Actually getting a Raspberry Pi is tricky these days because of high demand and limited supply. Adafruit tends to get stock in reasonably often. Otherwise, rpilocator is a good resource.

Installing BirdNET Pi is fairly easy on the software side: Installation Guide, but there are some gotchas on the hardware side. It turns out that the USB audio source is pretty important for getting good recordings. I tried a few different devices before I found one that I like: Ugreen USB to 3.5mm Audio Jack USB A Sound Card Adapter.

I looked around for weatherproof microphones, and found this one for CCTV systems. The big downside is that it wants 12V power. My trailer has 12V power, but it's a hassle to run the extra wire, so for now, I'm trying a lavalier lapel mic and putting it in a protected place: Rode Go mic. There are multiple kinds of 1/8" audio plugs. That mic is a TRS, but the Ugreen jack expects TRRS, I also got an adapter. The price on that has gone up since I ordered that, so maybe find a cheaper one.

Another thing to know is that the constant machine learning model evaluations are a significant workload for the Pi, so it can get hot and throttle the processor. I've used the large heatsink top from this Armor Case and it seems to be helping. There's one with fans, but because I wanted to put a HAT on the Pi, the fans weren't as useful.

To enclose the Pi with the hat on, I got a HighPi case. Yes, the top part of the Armor case fits well within the HighPi case. The HighPi case takes a 3007 fan (30mm square, 7mm deep), but the one I got with it is pretty loud. I'm going to try no fan for a while, and if that doesn't work, I'll try other fans that size.

The Adafruit Ultimate GPS HAT provides the GPS source for my setup. It has a great step-by-step tutorial

I ended up finding a GPS data logger that I liked and forking it to add some extra code for writing out tracklogs and telling BirdNET-Pi the current location (with an hourly cron job)

Notifications

I wanted to be notified when the system detected a bird, but didn't want to get an email or SMS or something, so I set up the Apprise notifications to send a message via MQTT to my HomeAssistant installation:

mqtt://my.mqtt.broker/birdnet/sightings
I set the title of the notification to empty and the body to a quick and dirt JSON representation of the event:

{"ts":"$dateT$time","lat":"$latitude","lon":"$longitude","sci":"$sciname","cmn":"$comname","cnf":$confidence,"img":"$flickrimage"}

On the HomeAssitant side, I set up an automation:

alias: Birdnet MQTT
description: "Send a notification to the app when a Bird is heard"
trigger:
  - platform: mqtt
    topic: birdnet/sightings
condition: []
action:
  - device_id: MY_PHONE_DEVICE ID
    domain: mobile_app
    type: notify
    message: >-
      {{ trigger.payload_json.cmn }} ({{ trigger.payload_json.sci }}) {{
      trigger.payload_json.cnf * 100 }}% 
    title: Bird Heard
mode: single
Or using the visual editor:
Triggers
  When an MQTT message has been received
    Topic: birdnet/sightings
Actions
  Send a notification
    Device: My Phone
    Action: Send a notification
    Message: {{ trigger.payload_json.cmn }} ({{ trigger.payload_json.sci }}) {{ trigger.payload_json.cnf * 100 }}% 
    Title: Bird Heard