DS3231 - RTC Time Keeper

A forum where Flowcode v6 user created components can be shared, discussed and reviewed.

Moderator: Benj

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

DS3231 - RTC Time Keeper

Postby Jordy101091 » Thu Mar 20, 2014 8:05 pm

DS3231 - Component
Current Version = 1.68
Best Working Version = 1.68



Info:

I have made a DS3231 component which lets you easy use the DS3231 device and configure it. No need to have difficult calculations.
With this component you can just put in your time and date data in decimal values the component takes care of the rest. A nice thing is that you can choose what the behaviour is of the SQW output.
Via a simple pull down menu you can select what the output frequency is.
Also this device with two configurable Alarm settings, with this component it now a peace of cake to configure those as well.
This component uses just 19 component macros:

- Initialise
- DayOfWeek
- ReadDate
- ReadTime
- WriteDate
- WriteTime
- SetAlarm1
- SetAlarm2
- AlarmRate1
- AlarmRate2
- ReadTemperature
- AutoTimeAdjust
- CheckStatus
- ClearAlarms
- ReadDateINT
- ReadTimeINT
- WriteTimeHour
- WriteTimeMinutes
- WriteTimeSeconds

(A help file will be attached for those that doesn't understand the function of every macro)

Component Use:
The component can be used by copying the ".fcpx" file into the component directory of Flowcode v6.
Then component can be found under the tap inputs as DS3231 - RTC.

Future Updates

Future update will include:

...

Suggestion are accepted


Download:


DS3231.fcpx
Component version 1.67
(9.76 KiB) Downloaded 446 times


DS3231.fcpx
Component Version 1.68
(11.71 KiB) Downloaded 695 times


Log:

v1.6 - Changed the way Checkstatus works, now the Checkstatus macro checks the alarm bits and returns the value to the user. Checkstatus does not clear these bits.
------- Added a new macro ClearAlarm, this macro clears the alarm given in the "Alarm" parameter. This is necessary so that a new event can happen.
v1.65 - Now the alarm functions as well as the alarm clearing routine are working correctly thank to the help of hyperion007
v1.66 - Attempted to fix the issues with the alarm functions.
-------- Made some little changes to the component code to make a little bit better and slightly faster
-------- The RTC now switches to vbat when power is removed and the alarm flags have been cleared.
v1.67 - Added 12 Hour Mode, the user can now select if he want 24 Hr notation or 12 Hour (AM/PM)
v1.68 - Added two new macro which enabled the user to manipulate the alarm rates for both the alarms.

Changing Alarm Rate with Macro's "AlarmRate1 - 2"

AlarmRate1 - MatchCondition Valid inputs between 0 to 5

0 - Alarm once per second
1 - Alarm when seconds match
2 - Alarm when minutes and seconds match
3 - Alarm when hours, minutes and seconds match
4 - Alarm when date, hours, minutes and seconds match
5 - Alarm when day, hours, minutes and seconds match

AlarmRate2 - MatchCondition Valid inputs between 0 to 4

0 - Alarm once per minute (00 seconds of every minute)
1 - Alarm when minutes match
2 - Alarm when hours and minutes match
3 - Alarm when date, hours and minutes match
4 - Alarm when day, hours and minutes match
These users thanked the author Jordy101091 for the post (total 8):
medelec35 (Thu Mar 20, 2014 8:23 pm) • JohnCrow (Thu Mar 20, 2014 8:37 pm) • Benj (Wed Mar 26, 2014 6:02 pm) • petesmart (Thu Apr 17, 2014 8:07 pm) • hyperion007 (Fri May 09, 2014 11:41 pm) • acestu (Tue Aug 26, 2014 8:00 pm) • MJU (Fri Oct 30, 2015 6:35 pm) • George_B (Sun Feb 07, 2016 10:33 pm)
Rating: 42.11%
 
the will to learn, should not be stopped by any price

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby hyperion007 » Wed Mar 26, 2014 3:19 pm

I designed a breakout board for the DS3231 on Friday night last week and got that ordered. I also ordered some other components from Mouser this week. I'll test the component as soon as I have all components. Jordy is receiving a complete board as thanks for his efforts. I'll be using the DS3231 RTC as my go-to RTC so a component for it is very nice.
These users thanked the author hyperion007 for the post (total 2):
Jordy101091 (Wed Mar 26, 2014 4:13 pm) • Benj (Wed Mar 26, 2014 6:02 pm)
Rating: 10.53%
 

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 715 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby JohnCrow » Sun Mar 30, 2014 1:31 pm

Hi Jordy

I've just made up my DS3231 Break Out Board.
After reading the data sheet, I realised the basic functions are the same as the DS1307, so I've just tried it with your (DS1307) component, and it works fine.

DS3231.jpg
DS3231.jpg (81.52 KiB) Viewed 16801 times
These users thanked the author JohnCrow for the post (total 2):
Jordy101091 (Sun Mar 30, 2014 2:38 pm) • Benj (Thu Apr 17, 2014 2:38 pm)
Rating: 10.53%
 
1 in 10 people understand binary, the other one doesn't !

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby hyperion007 » Sun Mar 30, 2014 4:36 pm

I have not received the PCBs yet, nor all components. But here's a preview:

RTC_Preview.jpg
(94.73 KiB) Downloaded 8219 times


CR2032 battery holder on the other side of the board.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby Jordy101091 » Sun Mar 30, 2014 4:42 pm

Nice looking forward to receive one.
Is it in a fancy color, blue or yellow.

Regards jordy
the will to learn, should not be stopped by any price

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby hyperion007 » Sun Mar 30, 2014 4:47 pm

It will be purple with ENIG finish. btw, any progress on the vinculum regarding the time and date values for file creation and file modification? ;)

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby Jordy101091 » Sun Mar 30, 2014 5:13 pm

Yes I have added the option to adjust the file creation date.
If I find sometime I will update the component.
the will to learn, should not be stopped by any price

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby hyperion007 » Sun Mar 30, 2014 7:57 pm

Great! Thanks.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper (98% Done)

Postby Jordy101091 » Sun Mar 30, 2014 10:17 pm

Hyperion7,

I just did A quick test, to see if it was possible to interface to a 120GB SSD Harddrive.
And what do you know, I just works just like a normal USB flash-drive so if anybody needs mass stores for there data logging application you can use a SSD hard drive.
I will post detailed information about that, when I get the time.

Regards Jordy
These users thanked the author Jordy101091 for the post (total 2):
hyperion007 (Mon Mar 31, 2014 2:04 pm) • chipfryer27 (Sun Nov 20, 2016 5:21 pm)
Rating: 10.53%
 
the will to learn, should not be stopped by any price

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper (Waiting For Test Results)

Postby hyperion007 » Mon Apr 07, 2014 9:28 pm

I'm lagging behind but I did receive the circuit boards today. Not the best surface finish unfortunately but hey, it's only cosmetics :)

20140407_202049.jpg
(830.8 KiB) Downloaded 8166 times
These users thanked the author hyperion007 for the post:
Jordy101091 (Mon Apr 07, 2014 9:31 pm)
Rating: 5.26%
 

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper (Waiting For Test Results)

Postby Jordy101091 » Mon Apr 07, 2014 9:31 pm

Looks Good I like it.

Great Job

Regards Jordy
the will to learn, should not be stopped by any price

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper (Waiting For Test Results)

Postby hyperion007 » Thu Apr 10, 2014 5:40 pm

I finished one of the three boards today and will test it with the custom component before finishing the other two boards.

1.jpg
(330.48 KiB) Downloaded 8137 times


2.jpg
(157.3 KiB) Downloaded 8137 times
These users thanked the author hyperion007 for the post:
Jordy101091 (Thu Apr 10, 2014 5:47 pm)
Rating: 5.26%
 

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper (Waiting For Test Results)

Postby hyperion007 » Fri Apr 11, 2014 9:14 pm

I've been testing Jordy's custom component since I got home today and some issues have been discovered and sent to Jordy. These are all regarding the functions of the INT/SQW pin. I'm sure we'll get that sorted in a jiffy.

3.jpg
(285.15 KiB) Downloaded 8115 times
These users thanked the author hyperion007 for the post (total 2):
Benj (Mon Apr 14, 2014 11:18 am) • medelec35 (Sat Jun 27, 2015 8:48 am)
Rating: 10.53%
 

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby Jordy101091 » Thu Apr 17, 2014 1:54 pm

I have updated the component status from testing to released.
The component is now fully functioning.
Thanks to Hyperion007 for his breakout board which made the last bit of testing very easy, thanks to you.

I hope the rest of you enjoy this component.

Regards Jordy
These users thanked the author Jordy101091 for the post (total 2):
Benj (Thu Apr 17, 2014 2:37 pm) • hyperion007 (Thu Apr 17, 2014 5:28 pm)
Rating: 10.53%
 
the will to learn, should not be stopped by any price

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby Crenwick » Sat Apr 26, 2014 8:09 pm

Hi Jordy,

Many thanks for your work !

I have a question about 12/24h setting. In the DS1307 component we have the HoursFormat variable in WriteTime but I'm unable to to find this item in the DS3231 component.

Is there another trick to change this setting :wink:

Regards,
Last edited by Crenwick on Sun Apr 27, 2014 8:14 am, edited 1 time in total.
Bernard

Flowcode 6 / EB006-V9

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby Jordy101091 » Sat Apr 26, 2014 9:13 pm

I have not yet made this available, in the next release of the component I will make this available.
I not sure when I have some time because I'm starting with a new job.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 715 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby JohnCrow » Sun Apr 27, 2014 11:23 am

Hi Jordy
Thanks, works great.

FYI I've just tried it with a DS3232 as well on basic Time, Date and Temp functions, works on this device too.

The DS3232 is similar functionally but is not pin for pin compatible (The DS3232 has 20 pins as opposed to 14 for the DS3231)
Will have to study the data sheet closer to see what the differences are.
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 715 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby JohnCrow » Sun May 11, 2014 4:25 pm

Hi Jordy

I've just been working with your DS3231 component.
Is the alarm option finished as I can add the settings for activating the alarm but the return box stays "greyed out" and Im not able to add a return variable.
Thanks
1 in 10 people understand binary, the other one doesn't !

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby Jordy101091 » Sun May 11, 2014 5:16 pm

Hi John,

What do you mean by that, I also cannot see your problem.
As for as I know the macro for setting the alarm time does not have a return value.
Maybe you can be a a little more specific about your problem.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 715 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby JohnCrow » Sun May 11, 2014 7:37 pm

Hi Jordy

As for as I know the macro for setting the alarm time does not have a return value.

That's why its greyed out then :)

I can see how to set the time & date for the alarm in the macro settings.
But what I'm not able to see is when the alarm is activated, how do I detect it.
I want to send for example Port A0 High

Thanks
1 in 10 people understand binary, the other one doesn't !

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby Jordy101091 » Sun May 11, 2014 9:29 pm

JohnCrow wrote:Hi Jordy

As for as I know the macro for setting the alarm time does not have a return value.

That's why its greyed out then :)

I can see how to set the time & date for the alarm in the macro settings.
But what I'm not able to see is when the alarm is activated, how do I detect it.
I want to send for example Port A0 High

Thanks


If that is what you mean, its is possible to do this with the checkstatus macro, if you take a look at the tooltip you can figure out what to fill in.
But im afraid that there is a nasty bug in it, so I have to make some time to crack it, I didn't have much time this weekend birthdays and mothers day as well.
So I hope I can make some time later this week.

I hope you don't mind.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby Crenwick » Mon May 12, 2014 10:56 am

Or you can also connect the INT/SQW to an external interupt and trigger a macro to check alarm :wink:
Bernard

Flowcode 6 / EB006-V9

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby Jordy101091 » Mon May 12, 2014 11:02 am

Crenwick wrote:Or you can also connect the INT/SQW to an external interupt and trigger a macro to check alarm :wink:


If the alarm is critical or you use it to get the microcontroller out of sleep.
But if it's not that big of a deal then the option of john would also work.

Regards Jordy,
the will to learn, should not be stopped by any price

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby hyperion007 » Mon May 12, 2014 12:39 pm

If I was correct this weekend there is a bug with clearing the Alarm Interrupt Flag and instead of writing a 0 it writes the retval which is 1 if the alarm has "gone off".

But it is an interesting idea that John had. Maybe the CheckStatus macro could have a function to read back the Alarm Time registers as well as a true/false to indicate if the alarm is active or not.
Without having to write a new time into the Alarm Time registers.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 715 times
Contact:

Re: DS3231 - RTC Time Keeper

Postby JohnCrow » Fri May 16, 2014 7:45 pm

This is my version of the board.

DS3231_Board.jpg
DS3231_Board.jpg (76.61 KiB) Viewed 16435 times


TouchScreen Clock-No Alarm V1.fcfx
(34.52 KiB) Downloaded 368 times


The 3 blue terminals are SCL SDA Alarm
Small green terminals are 5V & Gnd

The main flowchart is working, just started to add the alarm macro now.
Alarm will connect to A0 (For example) and turn on the buzzer

Jordy, I've not noticed if anyone else has posted about it, but the component symbol on the desktop is labelled DS3132.All other labels seem ok.
These users thanked the author JohnCrow for the post:
medelec35 (Sat Jun 27, 2015 8:48 am)
Rating: 5.26%
 
1 in 10 people understand binary, the other one doesn't !