help with sleep mode

I want to connect a RGB LED to an attiny45. When the you give the attiny power it must flash a green light for 10 seconds then go into a sleep mode for 10mintes then wakeup and flash a blue light then go to sleep and wakeup after 5minutes and flash a red light. Is this possible? I want to run the attiny off a 3v coin cell battery so the sleep mode must use very little power.

Yes, the timing and low power sleep mode are possible.
Running off 3V battery could be problematic - blue LEDs usually have a Vf of >3V. Attiny's Voh of 2.5V and Vol of 0.5V are not likely enough to turn a blue LED on. See Table 21-1 of Attiny45 data sheet.

Ok I could just put two coin cells in series then. My biggest issue is that how can I make the attiny sleep for so long? I was reading about the watchdog timer but it seams asif it's the wrong approach cause it only runs for a max of 8seconds

Sleep for 8 seconds x 75. You can wake, add one to a counter, and sleep again very quickly. I made something very similar a while back.

Sleep for 8 seconds at a time, wake up and update a counter.
When you get to 10 minutes worth of 8 second sleep periods (10 * 60 /8 = 75) then reset the counter to 0, flash the next light, and start doing 5 minutes worth of 8 second sleep period (37 or 38), etc.


My code I used for something that just flashes an LED every 2 seconds, for one millisecond. Play with the timings a bit and you are done!

// ATtiny85 sleep mode, wake on pin change interrupt or watchdog timer
// Author: Nick Gammon
// Date: 12 October 2013

//                  +-\/-+
// Ain0 (D 5) PB5  1|    |8  Vcc
// Ain3 (D 3) PB3  2|    |7  PB2 (D 2) Ain1
// Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//            GND  4|    |5  PB0 (D 0) pwm0
//                  +----+

#include <avr/sleep.h>    // Sleep Modes
#include <avr/power.h>    // Power management
#include <avr/wdt.h>      // Watchdog timer

const byte LED = 3;  // pin 2
// watchdog interrupt
ISR (WDT_vect) 
   wdt_disable();  // disable watchdog
}  // end of WDT_vect

void resetWatchdog ()
  // clear various "reset" flags
  MCUSR = 0;     
  // allow changes, disable reset, clear existing interrupt
  WDTCR = bit (WDCE) | bit (WDE) | bit (WDIF);
  // set interrupt mode and an interval (WDE must be changed from 1 to 0 here)
  WDTCR = bit (WDIE) | bit (WDP2) | bit (WDP1) | bit (WDP0);    // set WDIE, and 2 seconds delay
  // pat the dog
  }  // end of resetWatchdog
void setup ()
  resetWatchdog ();  // do this first in case WDT fires
  pinMode (LED, OUTPUT);
  }  // end of setup

void loop ()
  digitalWrite (LED, HIGH);
  delay (1); 
  digitalWrite (LED, LOW);
  goToSleep ();
  }  // end of loop
void goToSleep ()
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);
  ADCSRA = 0;            // turn off ADC
  power_all_disable ();  // power off ADC, Timer 0 and 1, serial interface
  noInterrupts ();       // timed sequence coming up
  resetWatchdog ();      // get watchdog ready
  sleep_enable ();       // ready to sleep
  interrupts ();         // interrupts are required now
  sleep_cpu ();          // sleep                
  sleep_disable ();      // precaution
  power_all_enable ();   // power everything back on
  }  // end of goToSleep

Thanx your code worked well. Is there anything else I can put off to save more power?

In the code you posted, where do u set how long the watchdog waits for? I want it to make it the maximum 8 seconds