

I already had two digisparks lying around. The Digispark only has 6 pins to work with, and I would have had to buy a better Arduino or mess with shift registers. I had considered using some sort of RTC module at first, and doing it all time based, but I thought that would complicate the project, as I would want a way to see what the time was set at (make sure it is still accurate), which would probably need an lcd. I will keep an eye on it until I feel like I can trust it.
AUTOMATIC CHICKEN COOP DOOR OPENER PROJECT FULL
My other concern is nights with clear skies and a full moon. I believe I have the door close trigger set low enough that on dark cloudy days, it will still be open. With the value now set at 20, it closed at about 8:45 last night - which is about 15 mins after the last chicken made it inside. I had to make an adjustment to the night/door close level, as the night before last, it closed before the last chicken made it inside. I moved from daylight, to shadow, to dark rooms to try and gauge what values to use to trigger the door. I played with a photo resistor on an arduino with an lcd, so I could see the returned value. That might only be worth bothering with if you find it to be a problem in real life, though. That way, shining a flashlight on or temporarily blocking the sensor wouldn't trigger the door right away. The only functional modification I can think to add would be instead of immediately triggering the door open/close mechanism when the light level changes, you might want to add in a counter, so it has to detect, say, 10 consecutive measurements before triggering a door change.

I see a couple of places where you could use a case statement instead of sequential ifs or chained if/else statements, and I would probably make the low and high light level thresholds constants at the top rather than embedding them as magic numbers in the code. I'm totally going to steal that idea at some point.Īs for your code, it looks fine. Not sure how effective it'll actually be at keeping the elements out, but I just like it. Not bad at all! I like the idea of using a dead hard drive case for the enclosure.
