Project in progress
Training Wild Birds to Trade Litter for Food

Training Wild Birds to Trade Litter for Food © MIT

Put wild animals to work for a fee, follow my project, hardware, software AND, how I trained the bird.

  • 154 respects

Components and supplies

Pi 3 02
Raspberry Pi 3 Model B
This is the main unit for the project, controls the mechatronics ofthe food dispenser, as well as the input/output from sensors and actuators at the bird gym
Ph a000066 iso (1) ztbmubhmho
Arduino UNO
This unit is used as a sensor and actuator interface within the 'bid-gym'
Uploads2ftmp2fd7799cc0 055d 4af9 addc 4539571639a92fscreenshot2019 09 1914 44 49 ookdxwrees
Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0

About this project

I have trained wild magpies in my garden to trade litter for food! The whole project relies on mechanical design, electronics, software and the great opportunity to create a machine with parts from my 3D-printer. I have worked with this project to and from for several years, but now in recent months the project has had an exciting development, and as I write in the title... Now the magpies work as garbage collectors, payed with food!

I work everyday with industrial applications of artificial intelligence (AI)... so the whole rig for the magpie project must be:

- Autonomous- Reliable- Flexible- Completely remote controlled- Document and log data and video.

I spent remarkably much time creating the actual food dispenser.

After testing with several Thingiverse designs of pet feeders, often based on a rotating feeder screw, I left these techniques. The dispenser must never get stuck and I want to be able to feed out individual peanuts. I looked at industrial solutions and got hooked on vibrating feeders. The base of the feeder is a fantastic vibration feeder from thingiverse.

Choose ABS or PETG for the four 'dog-bone' parts, PLA does not last long.

To this design I have added a number of extensions and funnels, I upload these as STL files. But, these are quick and dirty designs, you have to attach the parts on your own with small sheet-metal sheets, or in another way. Sorry for this, but when I build I am often experimenting and usually don't know exactly what the solution will look like... My parts to extend the vibro feeder can be found here:

One of these funnel parts has a 5mm socket for IR-LED and photodiode. with this arrangement I can run the dispenser with increasing intensity until I detect a peanut, Then stop the vibrating motor.

The vibrating motor is a simple 4.5 v DC motor. I made an unbalanced flywheel to this motor, included here as STL The BirdBox is controlled by a Raspberry Pi 4 with an add-on board. The add-on board includes a DC motor controller.

There's also two Arduinos in the design. For the raspberry, there is a python program that is controlling the logic of the feeder. I use the VNC feature together with AnyDesk to have full access to the BirdBox from 'remote'. The python code incorporates a simple GUI where I can see and log the progress and status of the BirdBox.

The bottle-caps are detected and 'accepted' with a dedicated 3D-printed metal-detector based on some Arduino code.

I have created a simple GUI for the raspberry, with this GUI, Anydesk, and a wide angle Picam attached to the Raspberry monitoring the experiments. This has been very valuable since I have had to run the experiments fully autonomous, setting up an experiment, going to work, and then follow up the result later that day.

I will describe the electronics and software later on this page... History of the project, and how I trained the magpies. The project has been running for several years. The video-clips you see on this page is the result of stubborn work and several steps. Step 1 is to make the birds interested and familiar with the feeder. I recommend anyone interested in setting up similar experiments to start with that. You need to feed the birds regularly to get your 'site' included in their 'patrol-scheme'. That is why I start to publish designs necessary for this initial phase. The feeder, and some sort of experiment site, like the general food-bowl included in the STL files.

I'd love to share this project and my experiences with everyone interested. What could come out from similar experiments when a large community get engaged?

I work intense right now to prepare my project files etc for sharing...more to come.

The next planned step step involves an attempt to get the birds to collect 'fallen-fruit' in my garden. Are apples to heavy ?

In the longer run, I think it would be possible to train for almost anything. Bottle-caps was relatively easy to 'classify' with a metal-detector. Other items, such as cigarette-butts, 'candy-paper', slugs etc will require a more general method for classifying. Fortunately I spend my days with applied AI and machine-learning.In my profession, we build smart sensors based on small & fast neural-networks such as mobile-net and YOLO. It is fully feasible to run such networks on small platforms such as the RPI 4. This could be the foundation of a general classifying method for a system like the BirdBox.

A common question is. How did you train the birds?

I try to explain that in this video:

For a more detailed description of the system, here are som videos:

Bottlecaps ?
Right now i can classify and detect bottle caps. This is done with a dedicated, arduino-powered, metaldetector. That system is described here: I parallel with this, i'm working an an Camera-based AI-powered General purpose detector. With this i plan to experiment with things such as cigarette butts, dandelions, slugs...etc.

Part two of of metal-detector

Next step?
I often get the question, whats your next step?
Well, in short term, i'm right now trying out if i can train the birds to collect soda-cans. To do this, i just have to create another version of the metal-detector and come up with a training plan that is feasible to implement.
I describe my attempts so far in these videos.


A few words about me:On my sixth birthday, my parents gave me an electric building kit. This started a lifelong passion for electronics, robotics and Artificial Intelligence (AI).

Today, I am very experienced in these areas with expertise in positioning and autonomous systems, such as 15 years of research and innovation regarding robotic lawn mowers.In an ongoing project, we use AI implemented with Deep Learning (DL), to add new customer value in an existing autonomous product. Performance in this Neural Network exceeds everything I've seen before! Deep Learning has amazing opportunities in the most diverse industries. Opportunities I want to develop further!

My lectures and speeches are appreciated. I live with my family in the outskirts of Gothenburg. In my leisure time I enjoy music, friends, tennis, downhill skiing and vintage Italian sports cars

Custom parts and enclosures

BirdBox parts
This is where i will share 3D printed parts for the BirdBox


Similar projects you might like

Petoi Bittle

Project showcase by Rongzhong Li (李荣仲)

  • 194 respects

Farmaid: Plant Disease Detection Robot

by Teamato

  • 104 respects

English Pronunciation Training Machine

Project tutorial by HomeMadeGarbage

  • 22 respects


Project in progress by Team Petoi

  • 2,190 respects

Where's my stuff?? - Find your misplaced things with Alexa!

Project in progress by Team Crakers

  • 10 respects

Intelligent Door Lock

Project in progress by Md. Khairul Alam

  • 140 respects
Add projectSign up / Login