LowPowerLab Forum

Hardware support => Low Power Techniques => Topic started by: DootDoot on April 07, 2020, 03:21:18 PM

Title: AVR134: Real Time Clock (RTC) Using the Asynchronous Timer
Post by: DootDoot on April 07, 2020, 03:21:18 PM
This describes a way of implementing a super low power RTC using only an external 32.768kHz  crystal.

http://ww1.microchip.com/downloads/en/Appnotes/Atmel-1259-Real-Time-Clock-RTC-Using-the-Asynchronous-Timer_AP-Note_AVR134.pdf
Has anyone tried this? How accurate is the clock? It looks like it would be a useful addition to a low power design with just 1 cheap extra component.
It looks like it uses a crystal on PB6 and PB7 (TOSC1 and TOSC2) (XTAL1 XTAL2)

Isn't this where the 8mhz resonator normally connects? (CSTCE8 for example)

Interested to hear any comments on this

-Jason
Title: Re: AVR134: Real Time Clock (RTC) Using the Asynchronous Timer
Post by: ChemE on April 07, 2020, 10:46:54 PM
I did mess with this years back and was a bit crestfallen with the power and performance.  The TLP5110 that Felix sells absolutely destroys this as far as sleep current goes.  I was able to get my sleep current down to 38 *NANO*amps.  So long microamps!
Title: Re: AVR134: Real Time Clock (RTC) Using the Asynchronous Timer
Post by: DootDoot on April 15, 2020, 04:21:04 AM
Thank you, I finally found time to read the data sheet for the TPL5110 But it seems the time intervals are only approximate based on the accuracy of the resistors.

http://www.ti.com/lit/ds/symlink/tpl5110.pdf

see page 15. I think this says the time is approximate.

I want a timer to keep 2 devices with synchronised wake times. One device will transmit and the other will receive. (Possibly with an ACK.)

I found this alternative ,

https://www.microcrystal.com/en/products/real-time-clock-rtc/rv-3028-c7/
https://www.microcrystal.com/fileadmin/Media/Products/RTC/Datasheet/RV-3028-C7.pdf

it's 45nA, in a tiny 3mm x 1.5mm package. Costs between 1.50 and 3 on mouser depending on quantities. Super accurate RTC.

Another one that has interesting features was the MCP79412, for which I also found a library for on github
https://github.com/ichilton/mcp7941x_arduino


There's also the BQ32002 from TI.com but it appears to require an external oscillator
https://www.ti.com/lit/ds/symlink/bq32000.pdf
page 7

Title: Re: AVR134: Real Time Clock (RTC) Using the Asynchronous Timer
Post by: Felix on April 15, 2020, 08:21:09 AM
DootDoot,

Indeed the TPL timing is only approximate and requires external resistors. It's perfectly fine for approximate interval reporting.
The RV-3028-C7 is a great little device. But you will find that even at 1ppm it will drift eventually. You will need resync with the base station.
I get this question a LOT actually, people think that each node needs an RTC to keep accurate timing for some reason. I can see some situations where an RTC per node is absolutely necessary but IMO in most cases it's not.

I propose a different approach which requires no extra components. It has been demonstrated in practice and it works very well. Let the "RTC" be at the base station. Let the base synchronize all the nodes as they come online. The base can tell a node if it's too far off from its time slot, where that is required. This way you can orchestrate a large network of devices with extremely good precision in terms of when they wake up to send a message. Then the crystal drifting variable of the nodes is eliminated.
Title: Re: AVR134: Real Time Clock (RTC) Using the Asynchronous Timer
Post by: DootDoot on April 15, 2020, 01:55:56 PM
Hi Felix,

I do something like this already, I adjust my receivers wake up time to try to track the senders timeframe. But even with a 60 second transmit frequency I see time differences of around 1.5 seconds. 

This is using these boards.

https://www.tindie.com/products/easysensors/button-sized-rfm69-wireless-node-ver-2/
https://www.tindie.com/products/easysensors/button-sized-lora-rfm95rfm69-wireless-node-ver-3/

I think the time difference is consistent but I'm not sure. I was a bit shocked by how different the timings were and I'm not sure how temperature changes will affect things. I'm trying to design my own PCB so I wanted to check out better solutions while I can.

At the moment, if my receiver misses 10 successive signals then it listens for a full minute before giving up. Sleeping for 10 minutes before waking up and listening for a minute again. It's not the best solution I think. It runs the batteries down (rechargables)

I'd prefer if my sender could skip sending for 30+ minutes if it has nothing to alert.

I like how small the RV3028 is. And it's quite cheap in reasonable quantities.

I've ordered a couple of these modules to try it out.
https://coolcomponents.co.uk/products/rv3028-real-time-clock-rtc-breakout