Monday 27 November 2023

BirdNet-Pi: portable operation, mics & bird dogs

Its been an interesting couple of weeks.

I've experimented quite a bit with my BirdNET-Pi system and even built a second system.

Having a second system has allowed me to compare the two, while leaving the original just to run in its permanent location up in the loft, with its microphone poking out though a gap under the eaves.

This loft system uses an electret microphone via an audio/USB module. I did have a dreadful "hum" problem with this loft system. It was the usual common-mode noise issue with primarily 50Hz noise on the Pi 0Volt/common rail. This hadn't been too bad when testing the system because I was plugged into a mains socket directly on the power ring-main (...a post-WW2 UK wiring scheme to save copper).

But in the loft, the system is connected to a radial mains (single feed) circuit. This makes the hum problem much worse. The solution is to connect the 0Volt line either directly to mains earth, or via a suitable capacitor ...I'm using a 0.47uF non-polarised capacitor.

To connect a wire to the Pi 0V/common, I soldered a wire to an old USB cable metal sleeve, then plugged it into a spare Pi socket. (i.e. its just a rectangular section USB tube with all the inner bits completely removed).

microphone comparisons

I really thought that this would be an easy exercise; build two identical systems, then run them side by side with different microphones.

So I did this, except that the two mics are maybe 600mm apart. This is because my loft system is installed in the loft (...and I don't want to take it down) while the 'test' mic is hanging out of an upstairs window, less than 2 feet away.

I compared % confidence levels between the two systems for detections of the same bird at the same time, as best I could.

For all analogue mics I used a white CM108 based audio/USB module commonly available from suppliers like The PiHut and Adafruit. I used a Panasonic WM-61A electret mic as my reference.

My Dodotronic Ultramic probably sounded better, but not much difference in % confidence levels and did not seem to recognise some birds happily detected by the WM-61A. Although its supposed to be omni-direction, the Ultramic looks directional due to its construction. But as there seems to be no benefits in using this ultrasonic mic, and also the cost and size rules it out for my application, I've discounted it.

Next up were a couple or electret mics salvaged from old broken headsets about 8-9 years ago. These seemed to be pretty good, but I didn't think they were quite as good as the WM-61A.

Then I found a little bag containing 8 electret mics which were smaller than the WM-61A. These were probably as good as the WM-61A, but I have no idea what the part number is or even who made them. All I'm sure about is that they must have been cheap!

My little stumpy USB mic (available from The PiHut and just about everywhere else) seems to perform well. Once again I see this situation where bird calls are detected on one system but not the other.

I think the bottom line is probably that we shouldn't stress about microphone performance. Don't rush out and buy something expensive, just use what you have in your Man Box.

bird dogs

I had a few detections registered as ravens, each with a confidence of 70-75%. However, when played back, these recordings were clearly those of a neighbours dog! It certainly makes sense to check for obvious errors like this. But I really couldn't say whether a detection declared to be (say) a common scoter is in fact just a common duck!

As a consequence, I've now raised the BirdNetPi confidence threshold from 70 to 75%.

portable operation

My 2nd BirdNet-Pi has been very useful for mic comparison and hacking around with the software.

But I'm currently testing it as a portable system.

RaspberryPi 4 in an old hacked case + USB mic + Juice 3


With a stumpy USB mic and powered by a 10A Juice 3 power bank, I'm sure it will run for at least 8 hours.

For its first test, I did a short walk around our local reserve, RSBP Pagham Harbour. In about 30 minutes I clocked up over 100 detections, mostly widgeon, but also curlew, green-winged teal and wren.

I stored the system in the side webbing of a small rucksack so that the microphone was not too boxed in. The noise generated as I walk along will probably always be too much for the system. But as I frequently stop to use my binoculars, the system has plenty of 'quiet time' to gather recordings.

The main problem on the Pagham reserve at the weekends is the almost continuous noise from light aircraft!

As I'm using my mobile phone to display results when on the move, the only modification to the birdNetPi system is to add phone hot-spot details to wpa_supplicant.conf. Its also helpful to give the hotspot a higher priority than the home network.

Create details for hot-spot using wpa_passphrase for example:-

sudo wpa_passphrase "HOTSPOT PENGUIN" "ImGoingMobile"

...will generate an output:-

network={
    ssid="HOTSPOT PENGUIN"
    #psk="ImGoingMobile"

 psk=906ddcc1763ad15234061fb92cccf4d606410e0566cdfe4ac5695c15dd3dd78f
}

...which should be added to wpa_supplicant.conf like this:-

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="HOTSPOT PENGUIN"
    #psk="ImGoingMobile"

    psk=906ddcc1763ad15234061fb92cccf4d606410e0566cdfe4ac5695c15dd3dd78f  

    priority=10
}

network={
    ssid="BIG PENGUIN"
    #psk="ticklemepink"
    psk=15575f79ed2fe6f51308d216183a5d265f2949780d4a35e1b520674c531cd78f
    priority=5

}

...where BIG PENGUIN represents the home networks.

Giving the hotspot a higher priority (note: the higher the number, the higher the priority) gives me a bit more control over wifi access point selection; i.e. 

  • when I turn the system on away from home, with my phone hotspot enabled, the system joins the hotspot
  • if I enable the hotspot on my phone when at home, the system joins this network when [re]booted
  • if I turn off the hotspot when at home, the system rejoins the home network

When on the home network I can view system interface via a web browser using the address: http:\\birdnetpi-2.local

But when running from my phone hotspot, this won't work on the phones browser.

As I'm running [de-Googled] Android, the solution for me is to install an app from F-Droid called Network Tools Library. This shows the IP Address for the phone and by selecting the SUBNET DEVICES option, it shows the IP address for the tethered BirdNet-Pi system.

Now I simply enter this into the browser address bar, e.g. http://192.168.109.113

I guess the only other thing to do (if you stray far from home) is update the Latitude & Longitude settings for the system.

Happy Hunting!


tinkering with the code

As I don't do subtle GUIs, I felt the need to change the bar graph colours. I also wanted to see more than 10 bird species, so I took a look at the code which is mostly a mixture of PHP & Python.

 

In the end I just settled on a few changes to the daily_plot.py file located in the scripts folder.




No comments:

Post a Comment