Smart Cities - BirdNET-Pi Project: Difference between revisions

From Sensors in Schools
Jump to navigation Jump to search
(Blanked the page)
Tag: Blanking
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== BirdNET-Pi Course Overview == <!--T:8-->
__NOTOC__
{| class="wikitable" style="width:100%"
! One
! Two
! Three
|-
| style="width:100px;"|Lesson 1
| Installation of BirdNET-Pi on a Raspberry Pi
| [[File:Parrot and Pi.png|150px |link=Main Page |alt=Alt text |Title text]]
|-
| Lesson 2
| Maintenance of BirdNET-Pi and Registration on BirdWeather
| [[File:BirdNET Pi Species Stats.png|150px |link=Main Page |alt=Alt text |Title text]]
|-
| Lession 3
| Using APIs to extract data from BirdWeather
| style="text-align:right;"| 1.00
|-
| Lesson 4
| Saving API data as a text file and creating a Dashboard in Node-RED
| style="text-align:right;"| 1.00
|-
| Lesson 5
| Saving API data in a SQLite database and creating a Dashboard in Node-RED
| style="text-align:right;"| 1.00
|}


= Overview =
* BirdNET-Pi uses a USB microphone connected to a Raspberry Pi to record and identify bird calls.
* The system runs 24/7 and can upload data in real time to '''https://app.birdweather.com'''
* Data can also be downloaded via an API so that you can do some additional data processing using Node-RED.
[[File:Parrot and Pi.png | 900px]]
= Learning Objectives =
* Learn about the important role of vegetation in supporting small birds
* Learn how to install BirdNET-Pi on a Raspberry Pi 4
* Learn how to interpret data from a local installation of BirdNET-Pi
* Learn how to use an API to retrieve data from the BirdNET-Pi installed in Bundoora
== Small Birds ==
* Small birds need protection from thick scrubby vegetation so they can build nests and also hide from larger birds.
* Examples of small birds include:
** White-browed Scrubwrens
** Brown Thornbills
** Spotted Pardalotes
** Willy Wagtails
** Yellow Robins
** Golden Whistlers
** Eastern Spinebills
** Grey Fantails
* Government agencies, conservation groups and schools are working together to plant more shrubs and bushy vegetation to encourage small birds to come back to our local parks.
* There is also a documentary you can watch on ABC iView called '''The Secret Lives of our Urban Birds'''. Start at the 41 minute mark to see the section on Noisy Minors.
'''https://www.abc.net.au/catalyst/the-secret-lives-of-our-urban-birds/13734884'''
* Friends of Darebin Creek - Small Woodland Birds
'''http://friendsofdarebincreek.org.au/wp-content/uploads/Small-Woodland-Birds-V2.pdf'''
= Hardware requirements =
* Raspberry Pi 4 or Pi 3 B+.
* USB Microphone - (e.g. Gyvazla USB Microphone Lavalier Clip-on Omnidirectional Condenser Microphone for Computer)
https://www.amazon.com.au/Microphone-Omnidirectional-Condenser-Interviews-Recording/dp/B072Q2GH99/ref=sr_1_5?keywords=Gyvazla+USB+Microphone&qid=1655199739&sr=8-5
* Heat sink and fan for Raspberry Pi. Optional, but highly recommended because it will keep the processor temperature less than 40degC and prolong the life of your Raspberry Pi.
= Full Installation instructions =
* Installation instructions are also available from the creator of BirdNET Pi (Patrick McGuire) - Lite version (no GUI interface)
'''https://github.com/mcguirepr89/BirdNET-Pi/wiki/Installation-Guide'''
= Bird NET Pi - Adam's system =
* Most Bird NET Pi systems are available through [https://app.birdweather.com/stations/428 Bird Weather]
* Adam has also made his Bird NET Pi installation directly available on the internet [https://birdnet.bobblybook.com Online example of Raspberry Pi Bird NET Pi]
= Microphone installation for testing =
* Plug the microphone into the USB 3.0 port.
* The USB 3.0 plug is coloured, either blue or yellow.
== Microphone final installation ==
* The microphone needs to be installed on the exterior of the house to receive bird calls.
* Open a window and place the microphone in a sheltered location under and eave so that the microphone doesn't get wet.
* Use sticky tape to attach the microphone to the house.
* Close the window carefully so that the cable connected to the microphone is not damaged.
= Installing the BirdNET-Pi app =
* Open the Terminal
* Enter the following code '''curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/main/newinstaller.sh | bash'''
* The code was obtained from this site '''https://birdnetpi.com'''
* If prompted, answer Y (yes) to any questions.
* The installation will take approximately 15 minutes.
* The Raspberry Pi will reboot once the installation is complete.
[[File:Screen Shot 2022-06-14 at 9.15.50 pm.png | 900px]]
= Demonstrating BirdNET-Pi =
* In this example, the installation will be reachable at "http://birdnetpi1.local",
* Open up a Web Browser on any computer on the same local network as the Raspberry Pi running BirdNET-Pi
[[File:Screen Shot 2022-06-14 at 9.52.06 pm.png | 900px]]
* This will open up the BirdNET-Pi Home Page.
[[File:Screen Shot 2022-06-14 at 9.52.24 pm.png | 900px]]
== Checking microphone settings ==
* In the main menu select '''Tools'''
* You will be asked to enter a username and password.
** The username is '''birdnet'''
** The password is empty. You can change this later.
[[File:Screen Shot 2022-06-14 at 9.57.05 pm.png | 900px]]
* Click on '''Web Terminal'''
[[File:Screen Shot 2022-06-14 at 9.59.34 pm.png | 900px]]
* Enter alsamixer -m to enter the ALSA sound mixer.
* The -m option permits "mouse" mode.
= Swap file expansion =
[[https://pimylifeup.com/raspberry-pi-swap-file/ Expanding the swap file on the Raspberry Pi]]
== Testing a Bird Call ==
= Maintenance Requirements for BirdNET-Pi =
* General maintenance requirements are explored in this Dropbox video '''https://www.dropbox.com/s/vpv6z15gsozkqvn/video1668020945.mp4?dl=0'''
* Restart BirdNET-Pi Raspberry Pi once per week.
* Monitor temperature of Raspberry Pi to check to see if it has been throttled due to exceeding 60degC.
* Check to see if the Micro SSD card is full.
* Complete any updates.
= BirdNET-Pi API =
* BirdWeather has an API in place and the BirdWeather (web) App makes use of it in producing the results seen via the web page portal.
* Documentation is here - [https://app.birdweather.com/api/index.html] '''https://app.birdweather.com/api/index.html'''
* There is also an online query tool for testing queries here - '''https://app.birdweather.com/graphiql'''
== Example Python code ==
* This is a simple python program that will return some BirdWeather results from station 273 (my station in Bundoora, Victoria Australia)
[[File:Screen Shot 2023-02-25 at 6.27.37 am.png | 900px]]
* Here is the Python code that can be copied.
<syntaxhighlight lang="python">
import requests
import json
query = """query{
  station(id: "273")  {
    id
    location
    name
    topSpecies {
        averageProbability
        species {
            id
            commonName
            scientificName
        }
    }
  }
}"""
url = 'https://app.birdweather.com/graphql'
r = requests.post(url, json={'query': query})
#print(r.status_code)
#print(r.json())
data_json = json.dumps(r.json())
print(data_json)
</syntaxhighlight>
* The output is shown in the Python Shell.
* The data is in JSON format
[[File:Screen Shot 2023-02-25 at 6.29.51 am.png | 900px]]
* Copy this output and paste it in JSONviewer to make the data human readable '''https://jsonviewer.com'''
* The data should be similar to the screen shot below.
[[File:Screen Shot 2023-02-25 at 6.31.16 am.png | 900px]]
== BirdWeather online GraphiQL tool ==
* An online query tool for testing queries at this URL - '''https://app.birdweather.com/graphiql'''
* An example output is presented for station 273.
[[File:Screen Shot 2023-02-25 at 6.45.02 am.png | 900px]]
* Use the online documentation to modify your query '''https://app.birdweather.com/api/index.html'''.
* This will help you understand how the API work.
* In this example below the wikipediaSummary has been added to the query.
[[File:Screen Shot 2023-02-25 at 6.51.32 am.png | 900px]]
[[File:Screen Shot 2023-02-25 at 6.54.01 am.png | 900px]]

Latest revision as of 05:16, 18 March 2023