Protect your trashcan from squirrels and raccoons with a Raspberry Pi.
Step 1: Parts List
1 – Raspberry Pi 3 (Raspberry Pi 2 also compatible)
1 – Rechargeable USB battery
1 – USB to micro USB cable
1 – MCP3008 (analog to digital converter)
1 – Passive buzzer
2 – 1MΩ resistor
1 – 330Ω resistor
1 – Rocker switch
1 – LED
1 – Waterproof Speaker with audio cable and power cable (not Bluetooth speaker)
1 – Waterproof plastic box
1 – Piezo vibration sensor (with mass)
some – Jumper wires
1 – long 2 wire cable (1 meter)
1 – Breadboard
some – DualLock, Velcro (or equivalent)
Step 2: Build the Circuit
Charge your battery while you are working on the following.
Build the circuit shown in the diagram as follows:
We made our one meter cable out of a telephone wire.
Connect the speaker to the Raspberry Pi headphone port.
Connect your MCP3008 to the Raspberry Pi.
Then connect the Piezo vibration sensor (with mass) using the LONG cable. Connect across the 2 1MΩ resistors to the MCP3008.
Next connect the passive buzzer, the LED, and the 330Ω resistor to the Raspberry Pi.
Step 3: Sound Files for Animal Scaring
Find some sounds on the internet and turn them into wav files.
We used a dog barking, an eagle screeching, a hawk chirping, and a falcon cawing.
You can find sounds on Youtube or related websites
We used Audacity
Step 4: Coding
The python code is in the attached txt file.
Step 5: Launch on Startup
Set up the raspberry pi to launch the program on startup so that you don't have to have a screen, mouse and keyboard outside on your trashcan.
Use this page as a guide.
Step 6: Get Scaring
Attach the portable battery to the Raspberry Pi.
Place your Raspberry Pi, battery, and breadboard (with circuit) in the plastic box (and lid).
Secure them with your DualLock, Velcro (or equivalent).
Cut holes in your box so that the speaker cord, switch, and the long cable (vibration sensor attached) can be outside.
Make sure that the long cable with the vibration sensor is outside of the container.
Secure the plastic box and the speaker to your trashcan using more DualLock/Velcro/thing. Make sure the plastic box is easily accessible and will not interfere with any normal uses of the trash can (e.g. it won't be hit by lid).
Duct tape the vibration sensor to the bottom center of your trash can lid.
Attach the switch to an easily accessible place on the plastic box.
Whenever necessary, recharge the portable battery.