Go Down

Topic: temperature compensation crystal oscillator (Read 6811 times) previous topic - next topic

bigbuck83

oh sorry the chronodot and I will be using it with my h-bridges basicly I am not sure how to hook it up with what I have hooked up already........ does it use a arduino all to its own or is it applied to what I have already.....................just not sure what to do with it........ I will need two of them unless 1 chronodot can be hooked up to 2 uno's

Jack Christensen

Just google for "real-time clock" and Arduino. The Chronodot/DS3231 connects to the I2C bus which is pins A4 and A5 on an Uno. There are libraries available to make the programming a bit easier but it's not that difficult to just use the Wire library which does general I2C communication. Another very popular but less accurate RTC is the DS1307, you'll also find a ton of information on those. Internally, the registers for the DS3231 and DS1307 are very similar, so libraries or code that works for one will often work for another. You will need one RTC for each Uno.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

bigbuck83

ok thanks very much I will do my homework If I have any questions I will definitely ask.......... I asume you have used this device before have you had any weird problems worth mentioning 

Jack Christensen


ok thanks very much I will do my homework If I have any questions I will definitely ask.......... I asume you have used this device before have you had any weird problems worth mentioning 


Yes I've used DS1307, DS3231 and DS3232. They're all good devices, well behaved, easy to use. I did write a library for the DS3232/31. Still working on finishing the documentation but it's available on github FWIW.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

bigbuck83

ok, after doing some reading it seems the chronodots work well with digital clocks or LCD screens but will it work with a analog clock as posted in the pic I dont seem to find much info on using an anolg clock with these devices

Jack Christensen


ok, after doing some reading it seems the chronodots work well with digital clocks or LCD screens but will it work with a analog clock as posted in the pic I dont seem to find much info on using an anolg clock with these devices


I imagine the Chronodot can act as a time base, but the important question is what is the interface to the analog clock? Do you intend to drive the analog clock with an Arduino? How will that work?
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

bigbuck83

I am using the arduino to run the clock yes and I need it to keep accurate time I am hoping the chronodot will act as the time base you mentioned but I am unsure how that works exactly

bigbuck83

what I have exactly is the following:

I am using a arduino uno r3 connected to a l293 H-bridge which runs a magnetic coil for the clock............... now do I simply wire up the Chronodot as I have read and implement a sketch so the arduino recognizes the RTC ...........basicly replacing the clock module that is on the arduino uno r3 currently while still allowing the arduino to run the l293................. this is what I am hoping to accomplish .....................thanks for all of your help also I am new to all of this and am unsure how to proceed

Jack Christensen

The Arduino will need to do both, but this is no problem. It needs to run the H-bridge and also communicate with the RTC.

The RTC will provide time of day and date information, but I'm not clear whether this is actually needed in this case, or if the Arduino just needs to use it as an accurate time base to drive the clock coil. Most inexpensive quartz clocks I think just pulse the coil once per second, but I'm not sure in this case. It that what is needed, or something else, a faster signal?

There are a couple options. To use the RTC just as a time base/frequency reference, it has an output pin that can provide a 1Hz (one pulse per second) signal. (There are also several other frequencies that can be selected.)

OTOH, to use the RTC to track time and date, I like the Time library, http://playground.arduino.cc/Code/Time

The Time library implements a software RTC and then synchronizes it with the hardware RTC (Chronodot) on some given schedule (every five minutes by default).

PS: The Uno does not really have a "clock module" in the sense of an RTC. It does have a ceramic resonator to provide the system clock. All microcontrollers need a system clock of some sort, and there are many ways to provide it. Note that the system clock is not a time-of-day (real-time) clock, it is simply a regular signal that the MCU uses to synchronize all its internal logic. As noted earlier, the ceramic resonator is not all that accurate for timekeeping purposes.

There are a lot of options and a lot of flexibility, so take some time to understand what is possible and figure out what the best approach for driving the clock is. For instance, the Time library can function perfectly well without an external hardware RTC, using the system clock for its timing. If the system clock were derived from a more accurate source (e.g. a crystal), this could provide decent timekeeping, but even most commonly used crystals will still be an order of magnitude less accurate than the Chronodot/DS3231. Have a look at the DS3231 datasheet so you know what you're dealing with and what its capabilities are.

Whew. HTH.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

bigbuck83

hello again do I need the pull up resistors when connecting to uno R3 I just got the chronodot and am going to see if this works

Jack Christensen


hello again do I need the pull up resistors when connecting to uno R3 I just got the chronodot and am going to see if this works


Yes. The Chronodot has locations where they can be installed, or they can be placed elsewhere on the I2C bus. Anything between 2.2K and 10K should work. Actually it may work without them, as the Wire library enables the internal AVR pullups, but they are technically a little weak for I2C, so I always use external pullups.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

retrolefty



hello again do I need the pull up resistors when connecting to uno R3 I just got the chronodot and am going to see if this works


Yes. The Chronodot has locations where they can be installed, or they can be placed elsewhere on the I2C bus. Anything between 2.2K and 10K should work. Actually it may work without them, as the Wire library enables the internal AVR pullups, but they are technically a little weak for I2C, so I always use external pullups.


Good advice. However I have tested at least three different I2C RTC chip types and all three worked fine using just the internal weak pull-ups the Wire library provides and uses. One RTC module I had used jumper clips to enable or disable on board I2C pull-up resistors mounted on the module (I forget their resistance values), and the arduino/RTC setup would work with or without the resistor jumper clips installed or not. This module was wired on to a proto-shield board so there was short runs to the two I2C signals being used, if one was wiring the RTC some longer distance between the arduino and RTC then the weak pull-ups might cause problems.

Lefty

Jack Christensen


Good advice. However I have tested at least three different I2C RTC chip types and all three worked fine using just the internal weak pull-ups the Wire library provides and uses. One RTC module I had used jumper clips to enable or disable on board I2C pull-up resistors mounted on the module (I forget their resistance values), and the arduino/RTC setup would work with or without the resistor jumper clips installed or not. This module was wired on to a proto-shield board so there was short runs to the two I2C signals being used, if one was wiring the RTC some longer distance between the arduino and RTC then the weak pull-ups might cause problems.

Lefty


Right, I don't doubt it. Just from reading around, 4.7K seems to be the rule of thumb when operating the I2C bus at 100kHz and 2.2K for 400kHz. The Arduino Wire library runs at 100kHz but can be increased to 400kHz. As always I like to err on the side of caution, take the conservative approach, so I've been sticking with 2.2K lately. Experimenting like you did is useful, it gives a level of confidence in the robustness of the design; always glad to hear those kind of experiences.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

bigbuck83

well I can say that it is working without the resistors but i will be adding them as a precaution anyway thanks for the replys and help I will explain this project when I am finished I think y'all would enjoy what I have done here..............

Jack Christensen


well I can say that it is working without the resistors but i will be adding them as a precaution anyway thanks for the replys and help I will explain this project when I am finished I think y'all would enjoy what I have done here..............


Glad to help a little bit. Looking forward to hearing about the project!
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Go Up