Uses a mini servo to open/close the trap door and through beam photo sensor to trigger the trap door opening.
I cut out a piece of 1/4" plywood to fit over the bucket. Trace out the enclosure on this and cut that out. Glue the trap door to the enclosure. Mount the enclosure to the plywood. Mount the thru beam sensors to the enclosure. Mount the servo to the servo mount. Connect the closing arm to the servo. Mount the servo to the plywood. Wire the servo to the arduino. Wire the photo sensor to the arduino. I screwed a large washer to bottom of the trap door and glued a rare earth magnet from an old harddrive to the plywood to keep the trap door closed. Need to play around with magnet position, needs to hold the trap door closed but not so strongly that the servo can't pull it open. Tie a piece of string to the closing arm and attach other end to the trap door. Adjust length as need.
Program the arduino, spread some peanut butter on the far end of the trap enclosure and give it a test.
Wiring schematic included. Arduino program provide upon request.
Parts used: ( all available from amazon.com)
Arduino Nano screw terminal adaptor
Adafruit Accessories IR Break Beam Sensor - 3mm
Wallwart 9v 2000ma
5 gallon bucket
rare earth magnet
miscellaneous screws, bolts, nuts