A vending machine for birds that rewards them with food when they drop something in a hole. Electronics and enclosure materials cost <100 USD/EUR. I've designed a PCB and PVC pipe enclosure and dispenser (described below). The circuit is not complex, but I think a custom PCB makes it easier for people who are not electronics hobbyists to build this. I've made a few different enclosures out of scrap for this, but will share the PVC pipe enclosure details since it's sturdy, waterproof, and the materials can all be found at the hardware store.

There were two main inspirations for me to start and  document this project

I would like to thank PCBWay for helping me get the PCB made.



The circuit is all analog, using four NE555 timers and one LM358 dual op amp. The sensors are all made using IR phototransistors and IR LEDs. The PCB has headers broken out so you can monitor and control it with a microcontroller or SBC. It runs on 5-6VDC, but be sure to use 5V if you are planning to power a USB device (like a camera) with the vending machine's USB ports. If you use a USB cable to power the vending machine, be sure it can deliver enough current. I found that some 10-year-old 2-meter USB 2.0 cables were resulting in a voltage drop from 5 to 4.5-4.8 volts on the vending machine power rail.  Cables that didn't work so well had a resistance >1Ω. Ones that did had a resistance of <0.5Ω. NE555's should get at least 4.5 and Raspberry Pis need at least 4.7V. If things are not working as expected, use a multimeter to check the rail voltage - it should be around 4.9V. Shorter cables are less lossy and take up less space inside the enclosure. 

Power consumption at 5V is as follows:

Without RPi Zero W

With RPi Zero W and wide-angle camera module

So with the Rpi and camera you could get about 2 days out of a 20,000 mAh power bank. With just the vending machine you could get about 10 days.



Kicad Files (Github): https://github.com/src1138/VMFB
Gerbers, PCB and BOM (PCBWay): https://www.pcbway.com/project/shareproject/Vending_Machine_for_Birds_11f2a4da.html

Current Version is Rev. B Ver. 1.1.


PCB Front

PCB Back

I priced the BOM for an earlier version of the board, including the PIR and motor for the vibration dispenser at Mouser and it came to 33.82 EUR. Mouser is not the cheapest source, but they have a pretty good selection of parts. 


 If you shop around just a bit you could get the BOM for ~25 EUR. If you are an electronics hobbyist you probably have most if not all the parts on-hand.


This project uses commodity components, and you can confidently use alternatives with similar specs. There are a few points to keep in mind.





Event Sequence

  1. PIR sensor sees a warm body
  2. PIR triggers IR LED 555
  3. IR LED 555 turn on sensor IR LEDs for 22 secs after last PIR trigger
  4. When something is dropped in the deposit hole, the deposit sensor sees it
  5. The deposit side of the dual op amp sends a pulse to trigger the motor 555
  6. The motor 555 turns on the vibration dispenser motor - it times out after 11 secs
  7. When something is dispensed, the dispense sensor sees it 
  8. The dispense side of the dual op amp sends a pulse to reset the motor 555
  9. The dispenser motor is stopped

When timed dispense is triggered, it sends a signal to turn on the sensor IR LEDs and triggers the motor controller to start the vibration dispenser. When something is dispensed, the motor stops.



I have been using a Raspberry Pi Zero W with a wide-angle camera module running MotionEyeOS with my vending machine just to record videos with motion detection. Now I am using the GPIO pins to monitor and log events, trigger video recording based on sensor status, show status information on a video overlay, and enable manual record/stop for vide and dispensing of a peanut via the web interface. The python and shell scripts for this are on GitHub: https://github.com/src1138/VMFB/tree/main/motioneye_scripts


Dispenser: two-layer vibration platform with offset holes made from 3mm PVC sheet and 15mm M3 brass standoffs. I used a small 24x12mm 2VDC motor attached to the dispenser with brass standoffs and 3mm PVC sheet.

The dispenser typically dispenses a peanut or two within 3 seconds. Since it is a vibration dispenser, the enclosure should be level and mounted securely to insure relaible dispensing. 

Here are some detail pics of the PVC pipe-based container and dispenser in the latest iteration of thie project. I cut away part of the coupler that holds it together to better show the assemblly.

Hopper and DispenserTop screw end cap removed
Top baffle and 5mm pipe slice removed
Lower baffle and 10mm pipe slice removed

coupling and 18mm pipe slice removed
dispenser assembly side view

A closer look at the dispenser motor.

The dispenser drops peanuts into a funnel made from the top of the PET bottle. There is about 12cm between the two, making it difficult for rodents small enough to get into the machine to get to the food. PVC is tough enough to keep larger rodents from gnawing or breaking thier way in.


The PVC enclosure contains the battery, electronics and sensors, dispenser, peanuts, and deposited items. The platform is a 35cm plastic tray for a plant pot, attached to the deposit chute with 4 90-degree brackets, four M4 bolts and two hose clamps.

I used bits of electrical or duct tape to make the PVC pipes and joints fit securely tight. This way it is easy to disassemble/modify/repair. It's a good idea to wrap upward-facing joints to prevent water ingress during heavy rains.

You can load peanuts (or whatever) by unscrewing the top cap and pouring them in. I made two baffles from 3mm PVC sheet to reduce the pressure on the vibration dispenser.

You can unload the deposited items by unscrewing  the cap on the lower half of the vending machine.

The funnel is the top of a 1.5L PET bottle. I put foam tape around the top to keep debris and food out of the bottom of the vending machine and to hold the routed wires securely. The tip is cut off and glued to a 32mm male end cut from an extra elbow joint I had. This way it can spin freely when in place and put less stress on the wires if you rotate the upper levels to aim the camera or position a solar cell

The dispense chute is 2x32mm 45° F/M elbow joints attached together. The male end goes out a 32mm hole in the enclosure. I used pieces cut from the female end of that extra 32mm joint to make braces to better secure it and position the female end in the center of the enclosure for the funnel to go into.

The enclosure shown above is 112.5 cm tall and can be broken down into 5 parts. 

From top to bottom

Hopper and Dispenser

Hopper and dispenser
Dispenser assenbly
Baffle assenbly

There is more detail about the dispenser assembly above.

Camera Mount

If you don't plan to mount a camera on this vending machine, you can replace this and the 88mm long pipe segment from the Hopper and Dispenser with one 20-25mm piece of 110mm PVC pipe. 

Camera mount assembly
Camera enclosure

Dispense Chute and PCB/Battery Enclosure

Dispenser chute 
and PCB enclosure assembly

Dispenser chute assembly
PCB enclosure assembly

Platform and Deposit Chute

Platform and deposit chute assembly
Lower deposit chute assembly
Cord intake assembly
Deposit sensor mount

Deposit chute assembly minus platform

Platform assembly

Deposit Collector

Deposit collector assembly


I used peanuts in the shell to attract birds to the area and shelled peanuts in the vending machine. If you live in an area with lots of pigeons, using peanuts in the shell will not attract them as much since they can't eat them (can't get the shell off) and you have a better chance of attracting corvids. Shelled peanuts are easier to dispense reliably - peanuts in the shell are less dense, more irregular in shape, and jam easily. Dry cat and dog food also works.


Along with learning and having some fun, the goal is to get a birds to bring something, drop it in a hole, and get a reward. Birds need some conditioning for this, so there are a few phases to progress though to help them figure this out.

Conditioning Stages
0 - Put food in the area you plan to mount the vending machine to start attracting birds
(1-2 weeks)
1 - Food Provided, Timed Dispense, Deposit Provided
(2-3 weeks)
2 - No Food Provided, Timed Dispense, Deposit Provided
(1-2 months)
3 - No Food Provided, No Timed Dispense, Deposit Provided
(4-6 months)
4 - No Food Provided, No Timed Dispense, No Deposit Provided

Time estimates are based on my own experience over the past year or so, but Phase 3 duration is a guess. As of July 2023 I have not yet seen a bird deposit an item I didn't provide. Unfortunately I had to take my machine down in May due to some new HOA regulations prohibiting feeding the birds in my neighborhood. I plan to redeploy it when I find another suitable location.