[Logo] Anarduino and HopeRF Community Forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics     [Groups] Back to home page 
[Register] Register / 
[Login] Login 
RTC considerations, alternatives, etc...  XML
Forum Index » Anarduino
Author Message
Rick



Joined: 30/05/2014 22:08:56
Messages: 93
Offline

Greetings,

The initial version of the Anarduino miniWireless uses the MCP7940N RTC, which is fairly inexpensive and works well.

What are your favorite Real Time Clock? Would you prefer to see a different one in the miniWireless design?

Thanks in advance for any comments, suggestions, or insight you might have in this area.

Best Regards,
-Rick
srueger



Joined: 04/06/2014 17:42:38
Messages: 1
Offline

Hi Rick. I love your Anarduinos. Wireless communication is crucial for a lot of applications. Your design is neat with a small footprint, and you have highly power-effective uP solutions!

There will be uP applications that don't need an RTC, and I imagine some people might prefer a "no RTC" option (to save complexity, signals, power etc).

I build clocks, so need time, but many other applications also benefit from time on the node, eg, to log events in memory of the uP node or to make decisions on the local node, eg, switched on light might not be OK at certain times but OK at others (same with heating, open windows, etc). I am a huge fan of the DS3231 RTC. It has an internal temperature controlled crystal oscillator, which makes the RTC very precise (I observe something like 1 second per month - great for synchronous actions between different nodes - but you can get it to be more precise than that, see below). The DS3231 gives you three things by default that are not normally on most uP boards: a stable frequency, temperature readings and accurate time.

A precise frequency on the uP board is good for carrying out frequency measurements and time-stamping events to a reasonably high resolution. I connect the 32k signal (actually, 32,768 Hz) of the DS3231 to the T1 pin (D5) of the ATmega328 as external clock source for the 16-bit counter TCNT1. This cycling 16-bit counter allows me to generate accurate time without interrupts. That is great for driving long LED chains (eg, WS2812). These tend to lose timer interrupts otherwise. The counter is also great for sampling signals (a cheap tiny remote rough and ready oscilloscope anyone?). The counter has a resolution of around 30 us. With that I can read remote control codes en-passant through a cheap 38 kHz IR diode (I've written a little library for Apple remotes and generic TV remotes).

The DS3231 gives you temperature readings as a bonus. These are not super precise, but I find them vvv useful for catching rising or falling temperature beyond certain limits.

For my clock applications I receive the exact time from from an Arduino node with a GPS module on it via the radio link. That allows me to adjust the aging register of the DS3231 to keep its precision well under the advertised 1 ppm (even when the time master is switched off).

So for me, the Anarduino would just be perfect with a DS3231 option (and solder bridges for connecting the 32K signal to D5 and the square wave frequency to D3).



Stefan

PS: Ahh, and the DS3231 has double buffered time registers, so you can read and write the time whenever you like. A read attempt copies the RTC time into a buffer, and happily increments the time internally so that the read command receives a consistent copy. Same with a write, where the time is first copied into a buffer. After finishing writing the time is transferred to the RTC at once (and no intermediate increments can corrupt the written time). In contrast, the data sheet of the MCP7940N version says that the time may be corrupted when writing the time during an increment - which means that this current RTC requires a bit of a workaround in software.
Rick



Joined: 30/05/2014 22:08:56
Messages: 93
Offline

Hi Stefan,
Thanks for posting, and appreciate your positive comments. We're doing our best to provide a good quality service to others.
I like your ideas, and think there may be many others who also need this kind of accuracy, so it merits hardware to support it.

I've been also evaluating another RTC, which has very interesting characteristics, and I've just designed two products to use it.
After we finish testing these products, we will announce, manufacture a batch of them, and post the product for sale.
After all this hoopla, I'll be able to step up and take action on your suggestions. Thank you.

Regards,
Rick

This message was edited 1 time. Last update was at 07/07/2014 16:27:15

obelix662000



Joined: 13/07/2014 10:46:23
Messages: 3
Offline

Great board, thanks! Purchased 2 of them, both have problem with RTC, clock gains about 1 sec per hour. It cannot be compensated with calibration register (5 times more than max). Problem fixed with load capacitors connected to crystal in accordance with 20005010F document by Microchip for MCP7940N.

srueger, DS3231 are good, but do not have RAM registers, which are very convenient for many applications. I would prefer DS 3232

This message was edited 1 time. Last update was at 13/07/2014 11:07:12

Rick



Joined: 30/05/2014 22:08:56
Messages: 93
Offline

Hi obelix662000,

Thank you for your post, I appreciate the feedback(and criticism).

1-second per hour that can't be compensated with calibration register??? In the hundreds of unit's I've deployed, I've not seen this problem, but admittedly, I've also not specifically tested for long-running accuracy against an atomic clock. The intention for this was weighted more at quality at low cost--rather than low tolerance at higher cost. Anyway, the specification states a standard crystal can be used of load capacitance of 6pf - 12pf. The one I chose for this board, is a low-cost typical 20PPM in this range. What value of extra load capacitance are you using? We could use a more expensive lower tolerance crystal for this, but it would also affect price.

Has anyone else out there seen this issue?
I'm always interested and curious to provide the best quality at best price point for our valued customers.

Newsflash: We'll be introducing a new low power series of miniWireless which features an overall <50nA (yes nano-amps) quiescent sleep mode. We currently have three designs so far which we've completed testing, and now in production. They'll be offered for sale soon. This new design uses a different RTC, and we are using one of the specific manufacturer suggested crystal for it. We're also happy to report, the accuracy of this new version is much improved.

Update: New Low Power Product Series Intro: http://forum.anarduino.com/posts/list/0/15.page#40

All the best...
-Rick

This message was edited 1 time. Last update was at 21/07/2014 20:29:36

obelix662000



Joined: 13/07/2014 10:46:23
Messages: 3
Offline

Rick,
I think there is a mistake in the board schematics, in contrast to many others inexpensive RTC MCR7940 does not have built in load capacitors. When datasheet says " 6-15 pf crystal " actually it means that this crystal should be used with corresponding load capacitors. I spent 3 days figuring this out, trying different crystals etc, until I soldered 2 extra caps ( as per document referenced in my previous post). Since then RTC works perfect. Without load capacitors RTC accuracy is not related to crystal accuracy but to self oscillating of some effective RC contour, which gives not only 1 s per hour inaccuracy but also strong dependence on temperature. The board itself is great, this 2 extra caps is not very big deal, but I would recommend to include them in next versions. Thanks for the board, it fits perfectly my needs.
Rick



Joined: 30/05/2014 22:08:56
Messages: 93
Offline

Thank you. The new generation of MiniWireless use a different RTC, but done precisely and exactly to specification. Details of which will be posted soon, along with formal announcement.
sensorhub



Joined: 06/08/2014 04:21:11
Messages: 11
Offline

Hello obelix662000,
can you provide details of change to clock circuit to fix clock inaccurracy? Are you putting load caps from X1 to GND and X2 to GND on clock chip and what size caps are you using?

As it is my (uncalibrated) miniwireless clock is losing a lot of time.

This message was edited 2 times. Last update was at 18/08/2014 00:30:24

betgear



Joined: 18/08/2014 06:38:35
Messages: 6
Offline

The document that obelix662000 refers to can be found here

http://ww1.microchip.com/downloads/en/DeviceDoc/20005010F.pdf

Page 13 details the crystal and capacitor choices.

I'm presuming a couple of capacitors need soldering from pin 1 and pin 2 of the rtc to ground. 6 - 9 pf is mentioned in the document, but I'm not sure of the exact value to use?

Cheers

Glen.
jrbenito



Joined: 28/08/2014 15:17:27
Messages: 15
Offline

Hello,

I can also confirm that RTC is not working properly on, at least some, of the miniWireless boards. I uploaded this simples sketch: ()

The results were:

RTC: 2014-08-29 11:39:30 6
Time: 2014-8-29 11:5:26
RTC: 2014-08-29 11:42:42 6
Time: 2014-8-29 11:5:32
RTC: 2014-08-29 11:45:54 6
Time: 2014-8-29 11:5:38
RTC: 2014-08-29 11:49:06 6
Time: 2014-8-29 11:5:44
RTC: 2014-08-29 11:52:18 6
Time: 2014-8-29 11:5:50

The program is supposed to print time each 5 seconds more or less, "time" from Time library shows that it is happening each 6 seconds. However, each print from RTC show a span of 3 minutes. In other words, on these 5 samples my RTC is of by +12 minutes.

I did not test on my other boards yet, will do it tomorrow. At least on this sample RTC is useless.

BR,
Benito
jrbenito



Joined: 28/08/2014 15:17:27
Messages: 15
Offline

Just for sake of the example I set time and reset the board, the samples below are from the very begin:

2014-08-29 05:31:05 6
RTC: 2014-08-29 05:34:17 6
Time: 2014-8-29 5:31:11
RTC: 2014-08-29 05:37:29 6
Time: 2014-8-29 5:31:17
RTC: 2014-08-29 05:40:41 6
Time: 2014-8-29 5:31:23
RTC: 2014-08-29 05:43:53 6
Time: 2014-8-29 5:31:29
RTC: 2014-08-29 05:47:04 6
Time: 2014-8-29 5:31:35
RTC: 2014-08-29 05:50:16 6
Time: 2014-8-29 5:31:41
RTC: 2014-08-29 05:53:28 6
Time: 2014-8-29 5:31:47


This RTC is traveling faster than Enterprise
stevech



Joined: 07/07/2014 18:07:27
Messages: 91
Offline

I just hooked up my 'scope to pin 1 on the RTC chip after running the demo program.
'Scope shows a nice sine wave at the correct frequency. That crystal may have built-in capacitors.

I'll run test software to see if I too get the wrong elapsed time.

This message was edited 1 time. Last update was at 29/08/2014 12:41:56

jrbenito



Joined: 28/08/2014 15:17:27
Messages: 15
Offline

Hi Steve,

Thanks for comment, I will do same as soon as I get to lab.

Now I tried it on other boards, same sketch, and they worked well so I tried the defective one again and now it worked:

Some minutes after a reset:
RTC: 2001-01-01 00:11:56 1
Time: 2001-1-1 0:11:56
RTC: 2001-01-01 00:12:02 1
Time: 2001-1-1 0:12:2
RTC: 2001-01-01 00:12:08 1
Time: 2001-1-1 0:12:8

and after adjusting RTC time:
RTC: 2001-01-01 00:13:26 1
Time: 2001-1-1 0:13:26
RTC: 2014-08-30 01:17:06 7
Time: 2014-8-30 1:17:6
RTC: 2014-08-30 01:17:12 7
Time: 2014-8-30 1:17:12
RTC: 2014-08-30 01:17:18 7
Time: 2014-8-30 1:17:18
RTC: 2014-08-30 01:17:24 7
Time: 2014-8-30 1:17:24

I did not modify the sketch but I did changed the power supply. So I put back the other power supply but was unable to reproduce the error. Now I have no idea what happened... I am unable to reproduce and I am even trying the sketch with other node transmitting to this one but now RTC is perfect

BTW, I forgot to post the sketch, here it is: https://github.com/jrbenito/miniWireless/tree/master/rf69_server it is basically the RadioHead RF69_Server test sketch with RTC support added to it.

BR,
Benito
stevech



Joined: 07/07/2014 18:07:27
Messages: 91
Offline


I found that Epson makes these type of crystals with your choice of 3 different built-in loading capacitors.
The website photos look similar to the ones on the miniwireless board - the MC146 series.
So I think we can assume that the crystals have the correct capacitors, internally.

https://www.schukat.com/schukat/schukat_cms_en.nsf/index/CMSDF15D356B046D53BC1256D550038A9E0?OpenDocument&wg=D9035&refDoc=CMS1F513C0F64AFF71BC125708900365538

This message was edited 2 times. Last update was at 29/08/2014 22:28:51

 
Forum Index » Anarduino
Go to:   
Powered by JForum 2.1.9 © JForum Team