I was looking for a solution to the lock-out problem for a while now. The obvious solution is, to lock the door only when all rabbits are in the hutch. But how should a controller know? The human solution is to have a look and quickly count them. The AI variant is to mount a camera and recognize and count them, too. While this would probably work it is quite complex and computationally to complex for a MCU like the ESP32. So the main task is to find a robust, simple and inexpensive way to track occupancy of the hutch.
The door controller would then close the door only when it is the right time and everyone is in.
Thanks for your input!
I have to detail my idea. In short, the sensor just overrides the close trigger (time of the day, sunset, ..) so that no animal is locked out. When the last one enters the hutch the door will close.