Smart Bird AI
I created a project called Smart Bird AI, which is designed to ease the hobby of bird watching. Many bird watchers often complain about the immense amount of time they spend waiting for birds to be present in their area. Therefore, Smart Bird AI will detect when birds are in an area that the user is interested in and will detect the presence of birds using AI, specifically using a convolutional neural network (CNN). When it detects a bird is present, it will send a GMAIL notification to their phone - in real time - alerting the user to slowly approach the bird! This way, the bird watchers can spend most of their time on other tasks, and when a bird comes, they can excitedly observe and take notes on it!
Additionally, the project uses a Raspberry Pi 5 connected to a Camera Module 3 with a Wide lens providing a 120-degree view. It also incorporates a 26 TOPS AI Hat Module to allow a real-time analysis.
At the end of every day, this project will also provide a graph displaying the number of birds that were present during every hour. Since the patterns of birds are quite consistent, bird watchers can refer to this graph and identify the best timings to view birds when there is the highest frequency.
Motivation in Creating Smart Bird AI
Bird watchers often get annoyed by the huge time they need to wait for a bird to appear. Moreover, the newer generation isn't as involved in the hobby, and after taking interviews and truly understanding the main reason, I learned that they simply didn't want to wait hours for birds to be in my range of sight. Therefore, I built this solution to make the hobby more efficient and engaging to a larger audience. This project also has a wireless adjustable camera, which lets users control the camera to view birds when present without disturbing them!
Supplies
Raspberry Pi 5 8GB AI Basic Kit - UK Plug (26 TOPS), this contains everything from the Raspberry Pi to the AI Module, to the right power supply
Raspberry Pi Camera Module 3 Wide
Monitor (with power cable), or a small touch screen (3.5'' or 7'' works great)
3D Printer, or access to one. I used a FlashForge Adventurer 5M Pro
Flashing the MicroSD Card With Raspberry Pi OS
- To install Raspberry Pi OS, insert your microSD card into a USB adapter and connect it to your computer.
- Download and install the Raspberry Pi Imager software from the official Raspberry Pi website.
- Open Imager, and configure it to the settings provided in the image
- Write to flash the OS. This will take around 30 minutes.
- Once the process is complete, remove the microSD card, insert it into the microSD slot of your Raspberry Pi, and power it on — your Raspberry Pi will boot into the OS.
Raspberry Pi Setup
A Raspberry Pi is essentially a computer with lower specs, but it still functions the same way as a computer. It still requires a monitor/screen and input commands (keyboard & mouse).
To configure this properly, connect both the keyboard and mouse to the Raspberry Pi via USB 3.0 (blue-colored ports). Afterward, insert the Micro-HDMI cable into the Raspberry Pi and the HDMI side into your monitor. Power on the Raspberry Pi, wait for a couple of seconds, and you will arrive at the setup page.
On this page, you will be prompted to enter admin information such as your Raspberry Pi username and password, your Wi-Fi SSID and password, as well as location and language preferences — fill in this information!
Wiring the Camera and Mounting the AI Hat Module Onto the Raspberry Pi 5
To set up the Raspberry Pi 5 with the camera and AI Hat, start by connecting the camera. Gently lift the black plastic part on the camera port, then insert the small end of the camera cable with the shiny contacts facing the right way. Push the black part back down to lock it in place.
It’s better to connect the camera first because it gives you more space and makes things easier. After that, place the AI Hat on top of the Raspberry Pi, ensuring the connectors align.
Use the short screws at the bottom of the Raspberry Pi and the long screws on top to hold the AI Hat. Once the AI Hat is attached, it becomes more difficult to remove or adjust the camera without first removing the Hat.
Ensure that you also wire the servo motor into the Raspberry Pi via the GPIO pins. Please follow the wiring:
- Brown Wire → GND
- Red Wire → 5V
- Yellow Wire → GPIO 17
3D Render of Casing
I created this CAD using Autodesk Fusion 360. The first image is a render, but the second can help you understand the specific tools I used. I have also used Autodesk to understand the strengths of this model to ensure the production would be sufficient.
To view the 3D render of the casing, please view the above casing. This can also help in visualizing possible changes for your project.
Downloads
Safety in 3D Printing
When you are removing your 3D print from the bed post printing, PLEASE ensure that you wait for 5 minutes, allowing the plate to cool down. This will prevent any possible hazards, such as burns.
3D Printing the Casing
Please download all of the .STL files that I added in the Supporting Files section and place them into your slicer tool, such as Orca or FlashPrint. For this, I would recommend Orca because you can customize the infill of the file, meaning you can set it to 100% in regions around the screw areas and lower elsewhere. I would not recommend setting it to 100% everywhere since this makes the module extremely heavy.
Check out the image where I configured this in Orca.
After the print is completed, remember to remove any supports.
Gluing
Glue the parts together using UHU adhesive glue. First, start by gluing the top to the bottom of the case. If you have clamps, this would be a good time to use them; otherwise, clips also work great.
Next, glue the casing to the mount using the same adhesive. I didn’t use clamps here, but there was a very large surface area for the glue to set firmly. UHU starts to set after 30 minutes, but I left it overnight to ensure it would be strong.
Installation
The installation of the module is extremely simple; just place the components in an outdoor environment that is near the field of view!
Setting Up VNC and Ensuring Camera Works
Currently, when you connect to your Raspberry Pi, you need to set up your monitor, keyboard, and mouse, which is a huge hassle. Although there are simpler alternatives, such as using a tool called VNC. This allows you to access your Raspberry Pi without a monitor, keyboard, or mouse — all you need is power.
To set this up, click on the Raspberry Pi logo, go into Raspberry Pi Configuration, go to Interfaces, and toggle the VNC tab on. After doing this, go to your computer and install RealVNC.
After enabling VNC, you need to find out the IP address of your Raspberry Pi. To do this, you can either look through the Raspberry Pi UI or use an IP scanner. To find it using the UI, move the cursor over the Wi-Fi logo, and the IP address will show. Simply enter those numbers into RealVNC on your computer and type in your username and password. Then you will have complete control through a headless setup. If you wish to use an IP scanner, search for IPs and enter that number into RealVNC.
Testing Data With Code
Now for the fun part - code. First, we need to collect the videos that we want to analyse. I recommend around 5 hours of footage for this. Feel free to use the code below that helps to collect data and store it in a local folder called 'videos'.
The videos that you would be filming for this step would just be the outdoor area that you are interested in viewing.
If you would like to find the code that will send a notification to your email when a bird is detected, please use the following code. Note, you need to replace the vairables with the relevent email address and passwords.
If you would like to use the code that also provides an interesting graph of the number of birds present at specific times, please use the following code:
Running the Program
To run the code, simply write 'python3 file-name', where file-name is the name of your file. In my case, main.py. The analysis you see should be similar to the image attached.
Main aspects to note:
- 0.XY - This value, where XY is an integer, is the percentage of confidence that the model has in detecting a person.
Please note that this script will also save the data into a CSV file, which we will use in the post-data collection step.
Post Data Collection and Analytics
If you used the last example code, you’ll get a graph showing the time of day against the number of birds detected. This is especially valuable for bird watchers, since many species follow predictable flocking patterns. By studying the graph, watchers can return to the same area at similar times the next day with a strong chance of spotting the same birds again.
Next Steps
As of now, my project detects when a bird is present, but I am planning to increase its precision in detecting the type of bird. For example, if the user wants to only be notified when a pigeon comes by, my model should ignore any other types of birds.