Hi,
for my project I am using standalone ATMega clocked from internal RC oscillator and using Timer2 clocked asynchronously from a watch crystal. I noticed many advanced MCUs have some circuits to notice loss of main clock signal and switch to backup clock. Also some RTCs have a bit which indicates the crystal oscillator was stopped and so the time is unreliable. OTOH most Arduinos use crystal or resonator and I never heard about one failing due to a crystal fault. Now I don't know - how reliable a crystal is? Is failure of a timing crystal rare and not worth trying to backup it (unless it is used for a critical application)? Or is crystal failure "quite common"? For example during near brownout conditions, high or low temperature or RF noise source nearby? How do you handle this?
My application: 2AA battery powered device living outside collecting data and sending them via nRF for collection.
The cheapest crystals on Arduino clones are bad quality. They might break when an Arduino board is dropped on concrete. They stop working below 0 °C. If you put many Arduino boards in the freezer, all the cheap ones will stop working.
When the voltage is low, they probably will keep on working. The circuit inside the ATmega for the crystal can be set to normal and "full swing". The normal mode should be good enough.
Since they are encapsulated in a metal box, I think that RF noise is not a problem for the crystal.
I plan to use very low power and since I expect winter will kill the batteries anyway I will use alkaline batteries. According to wiki 2AAs means voltage from 3.2V when fresh to 2V when dead. Perfect for ATmega and nRF. Fresh 3AAs will have 4.8V killing nRF and I will get nothing from that extra voltage - only need to add a regulator and consuming one more cell.
I will be using the low power low frequency oscillator because I will drive the (32kHz) crystal by Timer2 asynchronous feature - there is no option to choose "better" oscillator. If you think the cold is worst risk I will try to put it into a freezer and see what will happen. It is "expensive" crystal from our local shop - but I think they shop on eBay too.
The internal oscillator is the best for cold temperatures for a cpu clock. It is not accurate and that can disturb any used baudrate, even the baudrate for the bootloader. If you use a programmer to upload the sketch and use SPI for the transceiver, then it is no problem.
The "full swing" is only available for the 16 MHz (or lower) cpu clock crystal. Not for the 32 kHz time mode.
I have made a Freezing Sketch not long ago. To check if the crystal stops working. All the explanation is in the sketch (I hope). It is only for the 16 MHz crystal of an Arduino Uno.
Clock / Time, 32 kHz
To keep your clock/time running you do need that 32 kHz crystal.
When you buy a crystal from a large seller (Farnell, Digikey, Mouser) you can select the temperature range. At Mouser, the cheapest 32 kHz crystal is still for -10°C, and the most expensive one for -40°C.
I didn't think about crystal reliability being affected by temperature. I was careful to get capacitors rated for -40°C but I did not look at the crystal. If I have the right datasheet it is rated for -10°C only. Will try it and see. At worst case I can replace it. But I just realized the nRF is also using a crystal! If it stops working at low temperature I am in real trouble.
Last year I built a temperature compensated oscillator for a tiny 85, using this 8 MHz crystal and a pair of 22pF ceramic capacitors. During calibration, I cooled it to -30C. It continued working, but slowed down by 5.5ppm. The frequency of the crystal varied linearly with the temperature from -30 to 95C, at which point the curve started to flatten out.
The nRF was put to power down (with oscillator stopped) and then restarted again so it restarted even this cold. In there freezer is more cold than outside in winter. I did only short test to not stress the circuit (batteries mostly) more than needed. It may not prove anything but I hope it means there is a good chance it will work. I will put it in real life conditions and see results. Thank you for inputs.
The cheapest crystals on Arduino clones are bad quality. They might break when an Arduino board is dropped on concrete. They stop working below 0 °C. If you put many Arduino boards in the freezer, all the cheap ones will stop working.
When the voltage is low, they probably will keep on working. The circuit inside the ATmega for the crystal can be set to normal and "full swing". The normal mode should be good enough.
Since they are encapsulated in a metal box, I think that RF noise is not a problem for the crystal.
Arduino boards (real ones and clones) use RESONATORS, not crystals. In fact the first three things I do to a new Arduino board are:
Replace the resonator with an SMD crystal.
Burn a new bootloader (my own code without all the junk that the stock one has).
Set the LFUSE to run the crystal full swing instead of low power mode (solves all the flakey oscillator problems).
Smajdalf:
The nRF was put to power down (with oscillator stopped) and then restarted again so it restarted even this cold. In there freezer is more cold than outside in winter. I did only short test to not stress the circuit (batteries mostly) more than needed. It may not prove anything but I hope it means there is a good chance it will work. I will put it in real life conditions and see results. Thank you for inputs.
Try the Energizer Lithium cells. They have a new cell voltage of around 1.8 volts, they weigh 1/2 as much as alkalines, they last a good 5 times longer than alkalines, cold doesn't bother them one bit and they have a 20 year shelf life.
Once you try them, you'll never buy alkaline again.