Basically, would there be any issues using the system_sleep() function in place of ALL delay() calls?
The examples set the watchdog timer duration during the setup, so it would have to use the same sleep time each time it is called, but it would be nicer if a different time could be used (for example: half second in between LED blinks, and 8 seconds inside of a loop 5 times for a 30 second delay). Is that possible?
I was also wondering about any/all other tips for maximizing battery life. I see I can call power_adc_disable(), power_timer0_disable(), power_timer1_disable(), and power_usi_disable(). I can disable ADC during sleep and re-enable after. What about the timers and the USI? Can I disable the USI completely in the setup, or would that prevent me from flashing another program onto it??? I'm worried about that! And do I need timer0 and timer1? It is unclear to me exactly what those are needed for. If I disable them before a sleep call, would it turn off the watchdog timer and not wakeup?
So many questions, but I am learning quickly. Thank you all for your help!
Timer0 generates the interrupt which increments millis(),
/* For various reasons, Timer 1 is a better choice for the millis timer on the '85 processor.*/#define TIMER_TO_USE_FOR_MILLIS 1
QuoteTimer0 generates the interrupt which increments millis(),Are you sure ?From the core_build_options.hQuote/* For various reasons, Timer 1 is a better choice for the millis timer on the '85 processor.*/#define TIMER_TO_USE_FOR_MILLIS 1
I am wondering if I can use that to put it to sleep/wake up during the light blinking process.
What about the timers and the USI?
Timer0 generates the interrupt which increments millis(), you might need that. Timer1 normally isn't needed (it's used for PWM generation if you do analogWrite()).
I suggest you program the fuses to use the 128kHz internal oscillator instead of the 8MHz one, and program the clock prescaler register to run the processor at the lowest clock frequency that you can manage with. This way, you can get the current consumption of the chip down to a fraction of a millamp while it is awake.If you do this, then I doubt that it's worth having the device sleep while blinking the IR LED, since the ATtiny current consumption will be tiny compared to the IR LED.
Nice. I have seen some about programming the fuses with avrdude commands. Can anyone provide the correct command to make these recommended settings changes?
How will running it at 128kHz affect my timing? For example, if in my test program I am using a delay(1000) on the Arduino itself to wait 1 second, what does that get translated to on the ATTiny85v running at 128kHz?
Will that change the watchdog timing as well? If I have the watchdog set to wait 8 seconds, will it still be 8 seconds at the slower frequency? Thanks!
Just out of curiosity (in case I want to make one of these) how are you planning to read the temperature accurately, in a way that is resistant to fluctuating supply (battery) voltage?
Quote from: jrburke99 on Mar 15, 2013, 02:50 pmNice. I have seen some about programming the fuses with avrdude commands. Can anyone provide the correct command to make these recommended settings changes?See http://www.engbedded.com/fusecalc/ to get the correct fuse values and the avrdude docs for the corresponding commands.