Battery backup means charging circuit, etc. Would like to avoid making it too difficult, as it's already summer, and irrigation had to be already running:) I'm storing schedule in PIC EEPROM, as it's changed very unfrequently. Configuration via serial, where ESP8266 will be connected to avoid opening the waterproof case. Or, probably, completely built on ESP8266 this time, I'm not sure. I don't like number of available IO pins there, which means difficulty to implement a small LCD display. On Fri, May 27, 2016 at 10:24 AM, James Cameron wrote: > I'm all for programming around power instability, but if you can add > battery backup to the micro, even better. ;-) > > Or, with the start and end times in flash, write something that will > depend on flash contents rather than hold schedule in RAM. Testing by > reset in the middle of a cycle. > > On Fri, May 27, 2016 at 10:00:27AM +0300, KPL wrote: >> As it's a "remote" location, power can be unstable, so it's battery-back= ed RTC. >> I was storing scheduled times as big integers, 1450 for 14:50, and >> comparing that to numbers I got from RTC, when minute had changed. >> It all seemed a bit heavy. >> >> One of the issues was - when power failed during the "ON" cycle - load >> was switched off, and the cycle lost until next event. >> >> On Fri, May 27, 2016 at 9:37 AM, James Cameron wrote: >> > I've not seen a common approach. Use the word "timer" instead of >> > "scheduler" gets me a few more useful hits. >> > >> > My two approaches have been; >> > >> > 1. keep time using the microcontroller's main oscillator, if it can >> > be kept running, and maintain countdowns for repeating events, or; >> > >> > 2. keep time using an external RTC, with a minute change detector in >> > software, and maintain countdowns from that. >> > >> > The countdowns decrement, and when they reach zero the event is >> > started and the countdown is reloaded. >> > >> > Should you wish to sleep the micro and have it woken from the RTC, the >> > prepare-to-sleep logic is a search for the smallest countdown. >> > >> > I don't like writing code for hours, minutes and seconds. ;-) >> > >> > On Fri, May 27, 2016 at 08:38:06AM +0300, KPL wrote: >> >> Hi, >> >> >> >> I'm trying to implement my own timer/scheduler, for remote garden >> >> irrigation use. I have had several earlier attempts, which had worked= , >> >> but with some issues. I'm sure there must be some common approach, as >> >> it should be quite popular thing. >> >> >> >> All I can find using my search terms, is different kind of scheduling >> >> - the one used for multitasking on CPU. Can anyone direct me to some >> >> articles/examples/discussions about simple RTC-based scheduling? Or >> >> the right search terms (I'm not a native english speaker)? >> >> >> >> -- >> >> KPL >> >> -- >> >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >> >> View/change your membership options at >> >> http://mailman.mit.edu/mailman/listinfo/piclist >> > >> > -- >> > James Cameron >> > http://quozl.netrek.org/ >> > -- >> > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >> > View/change your membership options at >> > http://mailman.mit.edu/mailman/listinfo/piclist >> >> >> >> -- >> KPL >> -- >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist > > -- > James Cameron > http://quozl.netrek.org/ > -- > 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 KPL --=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 .