Real time clock using arduino

Hi guys!

I'm new at using Arduino and also not that good in programming, I would like to ask you guys if you know how to make a real time clock using arduino. my concern is that I would like to use that real time clock like an input for our project. (sorry for my english, it's my second language), me and my groupmates are trying to create a system that output certain medicine based on the date and time on the real time clock. for ex. MedicineA should be outputted at 3:00 am then MedicineB should be outputted at for example 6:00 am. so basically it all depends on the clock or is there any other way to do it even if not basing on the time in the real time clock.I know it's possible but i really dont know how to do it. please guys I really need your help , I will be waiting for your replies. thanks again!

I suggest you just use one of these.

Hi BigFatMeaniee,

The DS1307 that xolroc suggested would be fine but from experience something like the DS3231 is more accurate ChronoDot - Ultra-precise Real Time Clock [v3] : ID 255 : $17.50 : Adafruit Industries, Unique & fun DIY electronics and kits

Yes RTCs with internal TCXOs (Temperature Controlled Crystal Oscillator) like the DS3231 are much more accurate.


Rob

thanks for the replies guys, I'm just wondering, is it possible to use the date in the real time clock like as an INPUT to operate another system? for example it's june 23,2012 , when the time reaches like 3:00 am in the morning another system would consider it as an input for example to light an LED? then at 5:00pm another LED will be on?

Yes, you write code to read and compare the date/time, if there's a match you tell the other system to do something.

Without more details that's about all that can be said.


Rob

Not sure what you mean as input to other system but I have a RTC in my wordclock and I have pre-programmed dates and strings for relevant stuff like xmas, new year, birthdays, anniversary's etc. When it's one of the required dates then I scroll the relevant string every 15 minutes for the entire day.

lets consider systemA = the RTC and systemB = medicine dispenser and scheduler circuit .an input for example at date june 25,2012 at exactly 3:00am and 5pm on SystemA, this will be considered by systemB as binary 1 or an input which then enables system be to dispense a certain medicine depending on the time on the RTC. so systemB will only depend on the scheduled time on the RTC because for example systemB would not dispense any medicine even if you press the dispense button rather the dispense button will only work when systemA tells systemB that the right schedule is already met. (SORRY FOR MY ENGLISH AGAIN! xD)

Yep we get it, you can do that no problems, but if you want precise details we have to know exactly what the systems are.

For example why isn't this all done with a single Arduino, why is there a separate "system".

How far apart are these systems.

What exactly are these systems, a "medicine dispenser and scheduler circuit" doesn't tell us much. Is this an existing device or are you making that as well?

Etc etc.


Rob

We are trying to make the MSD "medicine scheduler and dispenser " . it is a system that lets the user know or reminds the user when will there medicine would be taken on certain date. it would dispense a medicine at the designated time of the day. with the use of the RTC, the MSD can operate accurately, I'm sorry for the wrong terms I used, actually it is more like a function and it's not on a separate system. the RTC and MSD are close to each other in terms of range or distance its like the RTC is connected to the MSD, I really don't know that It can possibly be done using a single arduino thats why I assumed in using 2 arduino, but thanks to you that it can be possibly be done using one.

So far I see no reason a single Arduino cannot do this, as I see it you have two simple functions, read the time/date, and control some mechanism to allow dispensing based on that reading.

An Arduino could do that while spell checking War and Peace on the side :slight_smile:


Rob

thank you so much graynomad! I guess I'll have to focus on the codes. are there any exiting program for RTC?

are there any exiting program for RTC?

Yes I think so, not sure where but try the Arduino playground pages.

It's probably best to find what libraries are around before settling on a chip.

EDIT: Check here Arduino Playground - HomePage


Rob

The DS3231 (chronodot) is the more accurate and there are libraries to operate it. If you not interested in the memory, alarm or temperature functions then even the DS1307 libraries work with it.

While this does sound like a straightforward application from a technical point of view, it might be a bit touchy legally. If this is a product to be marketed, I'd be sure to cover all the bases, including but not limited to formal code verification and of course I'd also be plenty lawyered up. If it's a one-off, that could be an even scarier scenario. Not sure if dispensing meds is considered as supporting or sustaining life, but the disclaimer on the Atmel datasheet (the very last two sentences, p. 567, and below) is fairly typical. Failure of such systems can cause quite a sensation in the media, e.g. Therac-25 - Wikipedia

Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.

Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.

Hahaha, I assume that they can be used in airplane/flight applications.

Oh I'm sorry I didnt include which type of medicines are to be used, we only included incapsulated vitamins used for maintenance depending on the persons need and we don't intend to automate critical or important meds that are to be used by the user. mainly only for maintenance of vitamins like for diabetic persons.