Resetting solar tracker to initial position after sunset

hi there,
i just made a dual axis solar tracker using servos and arduino uno.
i want it to return to its initial position once the sun is not visible or in other words when there is no light on LDRs.
please help me with this
the source code i used for solar tracking is attached

FM8QPTGI6QD4IOC.ino (2.55 KB)

Add a switch that determines the "home" position, and after sunset, drive the motors until the home switch is closed.

Alternatively, as you are using servos, figure out the angle that represents the sunrise position and send it to that angle when the light on the LDRs falls below a threshold and stays below it for (say) 30 minutes.

...R

Robin2:
Alternatively, as you are using servos, figure out the angle that represents the sunrise position and send it to that angle when the light on the LDRs falls below a threshold and stays below it for (say) 30 minutes.

...R

nice.
but how can i set that threshold level of light?
i mean resistance is huge when LDR is in Dark.
so how do set this as a condition of resetting that when this resistance of LDRs is huge reset the motors?

shaikhhammadali:
so how do set this as a condition of resetting that when this resistance of LDRs is huge reset the motors?

I presume you are sensing the LDRs using analogRead()?

If so, what values are you getting while it is daylight and what different values are you getting when it is night time?

...R

how do set this as a condition of resetting that when this resistance of LDRs is huge reset the motors?

in loop():

if (analogRead(ldr_input) > dark_value && digitalRead(home_switch) == HIGH) step_motor_towards_home();

Don't worry about it because when the sun come up it'll track back to it automatically?

-jim lee

Can use the internal timer ?
sundown is after 8:00 PM or just have it move at midnight
waiting for some dark event is not 100% foolproof.

Maybe implement a circadian clock