Timer For Very Long Duration (20 to 30 days) ??

Hi,

I am looking for timer which will wait for event 20 to 30 days. if it didn't received a reset command (May be Digital Out or simple 5v signal), it will switch on another circuit(i.e to switch on Led)

Constrains are :
It is battery powered (ideally it should run on coin cell battery for at-least 6 months :slight_smile: ).
and circuit must be as little as possible

Design Options are :

  1. RTC and low power micro controller

  2. using timer + interrupts in low power micro controller with deep sleep mode

  3. 555 timer + 16 bit counter

Can anyone suggest me Best Design Approach and Why ??

In My View the problem with three approaches are :
for 1 : RTC + Microcontroller is a over kill, RTC isn't really required here since we are not looking for date and time

for 3 : Power Consumption is very for 555 + timer approach. is there anyway i can achieve low power consumption ? any references to calculate the power consumption ? any design without micro controller is more preferrable

for 2: i didn't find any low power consumption boards in arduino series. any suggestions for low power micro controller and implementations are welcome.

"little as possible"
This is not acceptable design criteria.

But if you are looking for time accuracy, use an RTC.

Measure the current do a calculation based on that, and do some dry runs to prove your calculations.
Use high quality low leakage components.

Use a proper battery that has reasonable mah ratings.

Read this:

How much drift is acceptable? If you need to time this event accurately enough that it doesn't drift 6-12 hours over a year, then you need an RTC.

If it doesn't matter if the event happens at day or night, but plus-or-minus half a day is acceptable, then I would go for the Arduino solution using the watchdog timer to keep the Arduino asleep most of the time. Nick Gammon has a good page on this subject. It should run for a few years on a coin cell battery if you get it right.

The 555 solution won't work well for intervals of >15 mins , and needs to be powered at all times for this to work.
RTC gives high accuracy but don't they also have to be powered at all times?
Option 2 makes the most sense, power wise.
If you need accurate timing and have WiFi available you could use NTC instead for accurate timing. When the device thinks it's getting close to the wake-up time it may do an NTC request to correct itself. An ESP8266 should be able to do this and run off a small battery for ages.

larryd:
"little as possible"

what i am trying to say is for simple timer applications with do we need to use two controllers (i think RTC has built-in controller.. ??)?

"you are looking for time accuracy "
I am not looking for accuracy. it wont matter if it triggers late or early by 1 or 2 days.

MorganS:
if you get it right.

I think this is the part where i will hit the rock ?

is there any solutions without micro controller ?

wvmarle:
An ESP8266 should be able to do this and run off a small battery for ages.

can you please share more details about it ?

The 555 solution won't work well for intervals of >15 mins ,

we can use 555 + counter to achieve longer time

Just use a simple microcontroller running its own clock program.
A promini, or a standalone 168 or 328 design with crystal, 2 22pF caps, 10K resistor, 3-4 0.1uF caps.
Code like this, adjust the alarm code at the end

unsigned long currentMicros;
unsigned long previousMicros;
unsigned long elapsedTime;

// Initial time to start, 00:00:00 with 0 years, 0 days. 
// adjust as needed.

// Get this working, then more display code if needed

byte hundredths;
byte tenths;
byte secondsOnes = 0;
byte oldsecondsOnes;
byte secondsTens = 0;
byte secondsTOtal;    // added for alarm check, see below.
byte minutesOnes = 0;
byte minutesTens = 0;
byte minutesTotal;    // added for alarm check
byte hoursOnes= 0;
byte hoursTens = 0;
byte hoursTotal;    // added for alarm check
int days = 0; //
byte years = 0;


void setup(){

Serial.begin(115200); // make serial monitor match
Serial.println ("Setup Done");
}

void loop(){

currentMicros = micros();

// how long's it been?
elapsedTime = currentMicros - previousMicros;
if ( elapsedTime >=10000UL){  // 0.01 second passed? Update the timers
previousMicros  = previousMicros + 10000UL;
hundredths = hundredths+1;
if (hundredths == 10){
    hundredths = 0;
    tenths = tenths +1;
    if (tenths == 10){
        tenths = 0;
        secondsOnes = secondsOnes + 1;
        if (secondsOnes == 10){
            secondsOnes = 0;
            secondsTens = secondsTens +1;
            if (secondsTens == 6){ 
                secondsTens = 0;
                minutesOnes =  minutesOnes + 1;
                if (minutesOnes == 10){
                    minutesOnes = 0;
                    minutesTens = minutesTens +1;
                    if (minutesTens == 6){
                        minutesTens = 0;
                        hoursOnes = hoursOns + 1;
                          if (hoursOnes == 10){
                              hoursOnes = 0;
                              hoursTens = hoursTens +1;
                                if ( (hoursTens == 2) && (hoursOnes == 4){
                                      hoursOnes = 0;
                                      hoursTens = 0;
                                      if (days>1){
                                          days = days-1;
                                           }
                                      else {
                                         days = 365;
                                         years = years - 1;
                                         }
                                    
                                      } // 24 hr rollover check
                                   } //hoursTens rollover check
                              } // hoursOnes rollover check
                        } // minutesTens rollover check
                     } // minutesOnes rollover check
                 } // secondsTens rollover check
              } // secondsOnes rollover check
          } // tenths rollover check
       } // hundredths rollover check
} // hundredths passing check



if (oldSecondsOnes != secondsOnes){  // show the elapsed time
oldSecondsOnes = secondsOnes;
Serial.print (years);
Serial.print(":");
Serial.print(days);
Serial.print(":");
Serial.print(hoursTens);
Serial.print(hoursOnes);
Serial.print(":");
Serial.print(minutesTens);
Serial.print(minutesOnes);
Serial.print(":");
Serial.print(secondsTens);
Serial.println(secondsOnes);


} // end one second check

// add alarm check
if ( (hoursTotat == 12) && (minutesTotal == 0) && ( (secondsTotal >= 0) && (secondsTotal <=10) ){ //12:00:00 to 12:00:10
if ( (days & 0b00000001) == 1) { // 1 = odd days, 0 = even days
digitalWrite (2,  HIGH); // odd day turn on
}
else {
digitalWrite (4, HIGH); // even day turn on
}
else {
digitalWrite (2, LOW); // outside of time window turn both off
digitalWrite (4, LOW);
}


} // end loop

anilkunchalaece:
can you please share more details about it ?

http://esp8266.com/
And Google of course - I haven't built such a project but read more than enough to know it's possible. NTP code is also readily available, forgot where I got mine. The ESP is famous for very low power use in deep sleep.

Virtually any CPU in low-power deep sleep mode.
DS323x in low-power sleep mode.
Use RTC alarm as an interrupt to wake the CPU and perform the task.
Same day solution.
User interface of your choice... probably serial (no buttons or display) if you only need to adjust it every xx weeks.

Forget the 555!! Any 555 solution, even with cmos, is always active and will typically require more power than a proper rtc/microP solution

There isn't enough information to go much further.

Is this a one time use?
Does the timeout need to be adjustable?
What does it do when it times out?
Is it driving an external device? LED?
How is it reset?
Is size a factor? Smaller = better?

A CD4060 configured with a low frequency rc oscillator (<1Hz ) could give long delays - use two and you could get years.

Won't be very accurate or stable, but it could be trimmed. A 32kHz xtal would give vastly better accuracy, but you'd need 3 4060s to get years.

Power consumption a few 10's of uA.

Allan

avr_fred:
Is this a one time use?

No it will reset for every month if signal is received. signal may be digital out from controller or 5v from battery.

avr_fred:
Does the timeout need to be adjustable?

No

avr_fred:
What does it do when it times out?

switch on led.

avr_fred:
Is it driving an external device? LED?

Yes

avr_fred:
How is it reset?

digital out from uc

avr_fred:
Is size a factor? Smaller = better?

Yes

allanhurst:
Power consumption a few 10's of uA.

can you please share a reference / more details about power consumption.

if i run this for 1 year with 1Hz oscillator what is the capacity of battery i need to use ?

lastchancename:
Virtually any CPU in low-power deep sleep mode.
DS323x in low-power sleep mode.
Use RTC alarm as an interrupt to wake the CPU and perform the task.

Thanks (i think two controllers is overkill.. but this is a simpler task than other like mentioned, but i am looking for optimum solution :slight_smile: ).

Are they programmable RTC's ? I did google'd it but didn't find any.

anilkunchalaece:
can you please share a reference / more details about power consumption.

The CD4060 has application notes that will pop up if you Google it.

Like pulling hens teeth.

.

larryd:
Like pulling hens teeth.

I didn't understand what is that you are trying to say..

If you are making some joke... Please elaborate it so we can also laugh. If not need some more explanation.

It seem like we are have to pull out of you what is acceptable.
It is difficult to pull hens teeth because they don't have teeth.

When you decide to do a project, put 'everything' down in detail and present it in your request.
It is very difficult for a diverse crowd to guess what is in your mind so tell us what is actually there.

The more information you give us, the better we can help you.

.

larryd:
put 'everything' down in detail and present it in your request.

I think I already put the necessary information in #1 and #12.

If it needs more information please let me know cause I don't know what iam missing here.

Thanks for help