There is already such sensor it's called crepuscular sensor. You have to use a large viewing angle to catch the sunrise and the sunset in a correct way. If you have an RTCC in your system you will know which is sunrise and which is sunset, no more fancy averaging, recording and so on. However, there are an infinity of solutions... On Thu, Jun 19, 2014 at 1:25 AM, James Cameron wrote: > How would you detect the day night cycle in a wireless sensor node > that runs from an RC oscillator? > > I'm not good at signal analysis. > > The method I'm considering is: > > 1. maintain an average of light level over three days, > > 2. maintain an average of light level over past hour, > > 3. record the level of the darkest and lightest hour in the past day, > > 4. detect sunrise as first hour that is brighter than the three day > average, and brighter than the previous hour, > > 5. average the sunrise time over several days, > > Sensor will be analog; photocell, photodiode, or capacitance of > reverse LED. > > The deployment is local; latitude 31 degrees south, so there's no need > to design for very short days or nights. > > There is risk of short pulses of bright light; lightning, vehicles, > torches. > > I've no plans for a nearby supernova. > > -- > James Cameron > http://quozl.linux.org.au/ > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=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 .