Skip to content
tnier01 edited this page Jan 25, 2022 · 17 revisions

What you need:

  • Raspberry Pi (we used Raspbery Pi 4 with 2 and 4 GB, but the more the better)
  • Raspberry Pi camera (works with Camera Module V2 and Raspberry Pi High Quality Camera)
  • Micro SD Card (at least 16 GB, again: the more the better)
  • Power supply

The Hardware can be ordered directly under the following link: https://www.berrybase.de/loadBasket/Nznik0e3CPq

Basic setup of Raspberry Pi can be done like described here If you don't have screen and keyboard available to use your Pi you can also use VNC like described here . With this you benefit from the remote access to your Raspberry Pi from anywhere.

Camera

Get packages and files from an existing repository by using the following commands:

sudo apt-get update
sudo apt-get upgrade
git clone https://github.com/jsten07/countYourBirds /home/pi/countYourBirds
cd countYourBirds

Create virtual environment:

sudo pip3 install virtualenv
python3 -m venv bird-env

This virtual environment has to be started every time you want to use it by:

source bird-env/bin/activate

Install all needed packages via execute the get_pi_requirements.sh script. (This takes a while)

bash get_pi_requirements.sh

Just for test purposes you now should be able to run an object detection video with the following commands (a window should appear which shows what your camera observes)

python3 TFLite_detection_webcam.py --modeldir=models/Sample_TF_Lite_Model

Motion:

Motion is used to detect if something in front of your camera is moving. You can install it like this:

sudo apt-get install motion

To detect the motion correctly (e.g. to not save to many pictures or to miss some) you can set the several parameters in your motion.conf file. Therefore just use a IDE or text editor of your choice to edit the file and set all the parameters that are explained here. From command line and if you have installed geany (normally that is default on your Pi) you can also use this from command line to start editing:

geany motion.conf

Your configurations:

First: We would really suggest that you create a OpenSenseMap account and a senseBox corresponding to your Raspberry Pi. With this the counts of your birds can easily be shared on the openSenseMap and used by others. In the config.yaml file you can adjust the settings to your preferences, for example:

  • set your openSenseMap account
  • do you want to receive E-Mails? --> set sender and receiver E-Mail
    • sender E-Mail has to be a Google mail
    • Create a new Google account.
    • Turn Allow less secure apps to ON for the sender E-Mail. Be aware that this makes it easier for others to gain access to your account.
  • in which intervall should the count of birds be send to the openSenseMap
  • ...

To do so you need to copy the config_template.yaml from the folder private to the top directory, rename it to config.yaml and adjust the parameters in it (therefore you can use any text editor).

Finish your setup by running the prepared setup.py by just typing (when you are in the corresponding folder and have activated the environment):

python setup.py

If you've run the setup once and want to change the time period in which the value is send to the openSenseMap you have to adjust the correspoding crontab by:

crontab -e

If you want to use other TensorflowLite models you have to set them in the TFLite_classify_birds.py (interpreter = ...) for another classification model or in the motion.conf (on_event_end ...).

countYourBirds

Now you should be able to run the countYourBirds scripts with

motion motion.conf

And with this your Raspberry Pi is running and should send you an E-Mail when he detects a bird in front of the camera!

Clone this wiki locally