Magpies Trained to Exchange Litter for Food with DIY Bird Feeder

This scientist trained magpies to recycle bottle caps in exchange for food using a machine he built from scratch.
Fabienne Lang
Magpie and the bird feederHans Forsberg/YouTube

A computer scientist has trained wild magpies to bring littered bottle caps to his garden, specifically to a DIY bird feeder, in exchange for food. 

Hans Forsberg is an expert in robotics and AI and decided to put his skills to good use for our planet by creating a high-tech 'BirdBox'. Sharing detailed information about his project on Hackaday, Forsberg explains why and how he put together his 3D-printed bird feeder for magpies.


The system looks simple from the outside: a bird feeder dispenses small food pellets such as peanuts once magpies deposit discarded bottle caps into the little compartment.

However, Forsberg put some solid effort into the BirdBox, and once you take a look inside, it's not all that simple. 

Magpies Trained to Exchange Litter for Food with DIY Bird Feeder
The system inside the box. Source: Hans Forsberg/Hackaday

But before going into the specifics of the technology, you can't help but be impressed with the magpies' intelligence. They are, after all, one of the most intelligent bird species on Earth, per Britannica. So it's little surprise Forsberg chose them for his trial project.

How does the system work?

Initially, Forsberg had to tempt the birds into landing and getting used to his contraption. So he set up a timed feeder that dispensed food every few minutes, gaining the magpies' trust. 

Then, the birds were taught how to press a red button before being able to get food, and then Forsberg placed a bunch of bottle caps on the landing table, which the magpies quickly learned would give them food if they pressed one at a time down into the hole. 

Most Popular

Finally, a motor kicked in and started giving out food in exchange for bottle caps.

Magpies Trained to Exchange Litter for Food with DIY Bird Feeder
The system inside the bird box. Source: Hans Forsberg/Hackaday

All in all, it took the birds around two weeks to pick up the system, and Forsberg knew he could then move onto a more complex one. 

The main box now uses a Raspberry Pi system with a camera and detectors on the table beneath it to operate. 

Forsberg hopes to train the magpies further to bring back larger bits of litter in return for food, essentially helping keep the streets cleaner, while keeping the magpies occupied and full to their hearts' content. 

Take a look at them in action below: 

message circleSHOW COMMENT (1)chevron