-
1Get the design ready
I started by creating a design for the scarecrow using Canva, which I then had printed on hardboard.
The first step was to cut out the eyes, as this is where the camera would see through. However, I later realized that I didn't need to cut them out completely; just a hole in one eye would be enough.
Next, I moved on to the hat. I carefully cut out the buckle area, as this is where the speaker would be placed.
-
2Prepare the AI module
The Grove Vision AI module is a very useful little device. It can be trained to detect all sorts of things like humans, pets, gestures, toilets (really?), and much more. Check out some of the pre trained models here: Sensecraft AI.
To begin, connect the cable to the AI module in the direction shown in the first image.
Then, connect the other side of the cable to the Raspberri pi camera like in the second image.
Now we can start uploading the model.
-
3Upload the bird detection model
Head over to Sensecraft AI models page and search for bird detection. Make sure to only use the models that are made for Grove vision AI module v2!
Although there is one named "Bird recognition", I noticed that it doesn't work very well. Instead, I suggest using the "Wild bird detection" model. I know pigeon is not a wild bird, but it still works.
Now, connect the AI module to the PC with a USB-C cable and click 'connect device'
You may be asked to choose your device by the browser. Select the right port (there should only be one) and submit.
-
4Test the model
After the model is completely uploaded, you should see the camera feed on the webpage. Beside it are some text which shows what the AI module is seeing.
I searched for pigeon on Google images and showed it to the camera (I know there are already a lot of pigeons, but just to test it, I didn't want to take the whole PC outside).
As you see in the images, the AI module has no problem recognizing them (as wild birds for some reason).
The number on top of the red square shows how confident the model is about its recognition.
-
5Solder
Solder the male headers to the Xiao esp32. This is time-consuming and difficult, but every single one needs to be carefully soldered. Make sure not to short any two pins!
Then, push the Xiao into the female headers in the AI module. Make sure the USB C port in the Xiao is facing the same direction as the one on the AI module.
Then solder one wire from D2 of the Xiao. I did it on the AI module itself, as it was easier. Also, we need to solder one wire from 5v and one from GND as well to power the amplifier.
Solder wires to the L, G, R inputs, 5v , -, and +, - of any one of the outputs on the PAM8203 audio amplifier.
Oh, and I forgot to take a picture. You might need to solder wires to the speaker as well.
-
6Program the xiao
Use the code attached below for the noise generation.
Make sure to install the Seeed Arduino SSCMA library.
The code basically checks if there are any boxes of size greater than zero in the camera feed. Those are the red boxes that appear when the AI module detects a bird. In case you only want to detect nearby birds and ignore the far away ones, you can specify the box size.
When it detects the box of size > 0, it calls the makeNoise() function. This function basically generates a random high frequency pulsating noise. I asked ChatGpt what frequencies annoys pigeons. Based on the suggestions, I updated the frequencies.
-
7Assemble
Finally, it's time to assemble all the components.
First, position the camera behind the eye hole and stick the AI module beside it with double sided tape.
Then stick the audio amplifier beside the AI module with double sided tape.
Connect the wire from D0 to the R input of the audio amplifier. (In case you are using Left output, connect it to L input)
Connect the wire from GND to G input and 5v negative terminal.
Connect the wire from 5v of Xiao to the 5v positive of the amplifier.
Finally, connect the speaker to the audio amp output.
I stuck a piece of thin black sponge behind the hat buckle and position the speaker on it.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.