After a month of occasionally working on moving all the main logic to one python script and debugging I think it's ready. It's all interrupt- and timer-driven, just like the analog version. It took a little work to make sure it worked well with both op amps and comparators, especially since I did not really design the circuit to work with comparators (no feedback to reduce hysteresis) and did not include capacitors to absorb the initial blip you sometimes get with phototransistors.
In the analog version, I had the camera recording while the sensor IR LEDs were on instead of using motion detection. For this version I'm still just enabling and disabling motion detection to trigger recording.
I also optimized the status overlay for motioneye so it's more informative.
https://github.com/src1138/VMFB-MC
The code works, but is as a friend of mine described it, "janky". There is still room for improvement, but for now it's usable and appears to work consistently.
- You can enable and disable the powerbank keep-alive and timed dispense from the web interface.
- You can trigger a manual dispense event from the web interface.
- The video overlay indicates the state of PIR, deposit, dispense, feed level, sensor IR LEDs and the dispense motor.
- The video overlay also shows the count of how many times PIR, deposit, dispense, timed dispense and manual dispense were triggered that day.
- You can easily use other types of sensors or switches in place of the PIR and phototransistors if your situation calls for it.
Here is a screenshot. The numbers are the result of testing and debugging. The sensor IR LEDs are on (SIR is red). The peanut level is low and the timer is enabled.

I will share some better screenshots and a short video soon.
I found a better way to mount a camera in the enclosure so it gets a good shot of the platform without being in the way or using a side-mounted arm.
Finally I found a better solution for rodent-proofing that should allow me to make the enclosure a little smaller without making it easy for rodents to get in there and have a feast. I have not had any rodent issues since I started this project, but this is a pervasive problem with bird feeders and I want to mitigate it as much as possible.
I expect to have another complete prototype based on the VMFB-MC with the above improvements and dispensing peanuts in the shell ready in the next 3 weeks. Since the peanuts will be in the shell, pigeons will not be able to eat them, but the jackdaws, magpies and crows that come by my balcony love them. Hopefully this will keep me from running afoul of the HOA for feeding pigeons.
I think these changes, along with the event logging and dashboard, will make this a more practical solution for students and researchers wanting to experiment with behavioral conditioning and collect data automatically. The VMFB can be adapted to use with other animals like rats or mice and apply to different use cases.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.