Need Guidance : Arduino and Sleep modes - DIY watch design

Hello Guys,

I have been building a DIY Watch project for a while now and now have a brand new prototype to work with


HW details available here : http://www.banson.fr/wiki/doku.php?id=rawlx

This cute LED PCB-based watch is now waiting for its power saving SW to be able to run genuinely on a 3.7V 2450 cell battery.

I'm now struggling with the global SW architecture of the ATMEGA code to be able to run it as long as possible. I've been digging for a while inside the documentation and the tutorials for sleep/idle modes and i'm looking now for advices on the solution chosen.

Here is how I see it now :

By default unit sleeps. Time is stored internally inside a variable which is set at initial startup.

  • TIMER1 is the only peripheral activated when sleeping, it counts endlessly.

  • When TIMER1 overflow occurs, an ISR is trigged, ATMEGA wakes to update the Time variable according to the elapsed 65536 TIMER1 ticks, and system is put back to sleep, TIMER1 continuing its duty.

  • When button is pressed, another ISR is triggered, waking up the ATMEGA. Time variable is updated according to TIMER1 accumulator cournter, and displayed using the leds for a bried amount of time.

Is this approach reasonable? Can I use the Arduino low power library, or do you advise to do it by hand by tweaking ATMEGA registers? I'm still more at ease with Arduino IDE so as far as possible, I'd like to stick to the Arduino world as much as i can.

I'm still not completely sure I can put the whole chip to sleep except the TIMER1 counter, and if everything can be waken up the way I want to do it.

Thanks in advance for your feedback/suggestions,

Vincent

note : I have chosen not to use a RTC for visual aspect reasons, and I'm ready to use low frequency crystal as ATMEGA clock to reduce power consumtion as well. I have a few 32khz and 2Mhz crystals to mess around with.

Which sleep mode did you have in mind, and what is your target power consumption?

Thank you nick for this very complete (and didactic) documentation. I would like to put the device into the lowest consmutpion mode still fitting my needs. I'm going to read in detail your findongs and come back to you.

Thanks!

This might help you too:

With one external crystal (if you can somehow fit that in) you can get the consumption to around 1 µA.

Awesome, is it also the case for Timer1? I could wake the chip every two seconds then.

According to the datasheet, it is Timer 2 that will wake from SLEEP_MODE_PWR_SAVE.

However you could increase the time, change:

  OCR2A =  31;              // count to 32 (zero-relative)

to:

  OCR2A =  63;              // count to 64 (zero-relative)

Unless you have a crystal running a counter all the time - you do not have a timepiece.

(And even then it has to be a good crystal.)

That reminds me of the day when I was at a "watch vendor" (aka jewellery shop) and I asked about how well the various watches kept time. The salesperson looked confused at the question.

Dare I ask this: ... Female?

I don't want to get into male/female stereotypes. :stuck_out_tongue:

Let me put it this way: a lot of staff in jewellery shops are female.

Got through all of your post, made my Fuse setup and architecture, will be testing soon.

Last question, can I use the Arduino IDE to do it, using my Uno as ISP ? I need to configure the config files I guess, some more reading required.

Again, nick you totally nailed my needs with your post.

Massive Kudos,

Vince

I personally use my hex uploader:

But the Arduino (Uno) as ISP should work, and saves you having to use SD cards.

Working exactly as intended, many thanks. Here's a short video of current capabilities. Thanks again nick !

Vince

Looks nicely made. :slight_smile: