Automatic door....?

Hey guys,

I am planning on building a door that opens and closes once a day based roughly on day and night cycles.

Initially I had planned on using an LDR to monitor light levels but issues have popped up concerning ambient light levels at the sensor as well as low light levels caused by the weather and cloud cover.

I need one version that opens in the morning and closes at night at fairly precise times....and a second version that opens in the morning and stays open for a few minutes and then closes until the next day.

I got pretty close to the second version using the LDR because the timing was not so critical....but couldn't figure out how to get it to stay closed after a couple of minutes without it trying to re-open because the sensor is still telling it that it is daylight outside.

I know about RTC's but some of these units will be used in very remote locations and if I am not mistaken RTC's need some kind of serial reference to stay accurate over time.

So my question is what are my other options?

Thanks
Al

RTC is set once, stays on-time for years. until the battery dies

option is to use the longitude and latitude and determine the sunrise every day.
you can then know the time based on sun sets and sun rises.

al_duino_nano:
I need .... a second version that opens in the morning and stays open for a few minutes and then closes until the next day.

I got pretty close to the second version using the LDR because the timing was not so critical....but couldn't figure out how to get it to stay closed after a couple of minutes without it trying to re-open because the sensor is still telling it that it is daylight outside.

Thanks
Al

if ( 'time since last light' is more than 12 hours )
then, look for light
if ( light > dark )
open door
set 'time since last light' = 0 // it will take 12 hours before it can open again

if ( time since last light > "couple of minutes"
then close the door.

============

if you are familiar with the concept of Blink Without Delay, this is simple.

Yes , a DS3231 will keep very accurate time but will not give you “dawn” “ dusk” type operation if that is what you want otherwise my choice. Have a look at mounting your light sensor in a tube or some such device to reduce ambient light problems

al_duino_nano:
Hey guys,

I am planning on building a door that opens and closes once a day based roughly on day and night cycles.

Initially I had planned on using an LDR to monitor light levels but issues have popped up concerning ambient light levels at the sensor as well as low light levels caused by the weather and cloud cover.

I need one version that opens in the morning and closes at night at fairly precise times....and a second version that opens in the morning and stays open for a few minutes and then closes until the next day.

I got pretty close to the second version using the LDR because the timing was not so critical....but couldn't figure out how to get it to stay closed after a couple of minutes without it trying to re-open because the sensor is still telling it that it is daylight outside.

I know about RTC's but some of these units will be used in very remote locations and if I am not mistaken RTC's need some kind of serial reference to stay accurate over time.

So my question is what are my other options?

Thanks
Al

Seems to be a logic problem, not an LDR problem.

You can use millis and compute about 22 hours after you close your second door and not allow it to open until the hours have expired.

Same sort of logic with the first door. You know about how many hours must pass before dusk, so don't allow the door to close until after that time has passed.

Paul

I've seen quite a few threads about "chicken coop" doors. Do a search for that term - sounds very much like your problem.