Em 18/06/2014 21:12, Byron Jeff escreveu: > On Wed, Jun 18, 2014 at 04:44:49PM -0700, John Gardner wrote: >> BAJ's approach is the way I'd do it. If accuracy is wanted, >> >> have a look at the DS3231 & variants. > I don't know if it's the right solution because the application of the > sensor is unknown. > > Detecting light and dark is one thing. Detecting dawn and dusk is somethi= ng > completely different. > > BAJ Use your RC clock as a timebase and a photodetector inside a tube to synchronize the clock. You don't need to resynchronize on an every day basis, so a cloudy day will not be a big issue. Simply reject a light/dark condition too far away from the expected cycle. The 10000 Year Clock () uses a similar solution, but completely mechanical. For instance, if you use an RC oscillator with 1% accuracy, it will have at most 14 minutes 24 seconds drift in a day. Suppose you set your sensor to detect noon. So when your sensor sees the sun in the next day within 20 minutes before or after your internal clocks's noon, you synchronize it. You can measure the duration of the detection and use its center. If you cannot synchronize in certain a day, increase your tolerance by 20 minutes for the next day. When you synchronize, reset the tolerance back to 20 minutes. Isaac --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .