So im trying to build a simple timer... ok not super simple but simple enough.

I am using a Duemilanove and RTC_DS1307 the RTC is connected to Analog pins 4-sda 5-scl and the relays are connected to digital ports 1-8 to match relay 1-8 the code that came with the RTC isnt good at all... but im not familiar enough with programing to understand much of it...

all i want to do is specify a time that the relays open and then when they close and have it repeat every day... simple right??/

/* * RTC Control v.01 * by <http://www.combustory.com> John Vaughters * Credit to: * Maurice Ribble - http://www.glacialwanderer.com/hobbyrobotics for RTC DS1307 code * * With this code you can set the date/time, retreive the date/time and use the extra memory of an RTC DS1307 chip. * The program also sets all the extra memory space to 0xff. * Serial Communication method with the Arduino that utilizes a leading CHAR for each command described below. * Commands: * T(00-59)(00-59)(00-23)(1-7)(01-31)(01-12)(00-99) - T(sec)(min)(hour)(dayOfWeek)(dayOfMonth)(month)(year) - T Sets the date of the RTC DS1307 Chip. * Example to set the time for 02-Feb-09 @ 19:57:11 for the 3 day of the week, use this command - T1157193020209 * Q(1-2) - (Q1) Memory initialization (Q2) RTC - Memory Dump */

#include "Wire.h"#define DS1307_I2C_ADDRESS 0x68 // This is the I2C address

For your relay, see if it will turn on an LED - if not, the clicking is not actually closing the contacts.

ok i just double checked and they are contacting i connected an 120v 60w lamp and it blinks on and off with the relay so i know that it will work, now how do i write a code to work with the RTC? and how can i check to see if i set the RTC correctly?Thanks

if ( (time >0800) && (time <+ 2030) ){digitalWrite (1, HIGH);} else {digitalWrite (1, LOW);}Supposing that hour had held a value of 9 and minute had held a value of 20, time should contain the value of 930. This is greater than 800 and less than 2030, so you set digital pin 1 to HIGH. Well, that just screwed up your serial communications. Digital pins 0 and 1 are the serial port on the non-Mega Arduinos, and one of 4 serial ports on the Mega. Those pins can not ALSO be used for GPIO.

Quote

Im Still Not Having Any Luck With The RTC...

There Is No Luck Required. Either You Can Read The Time From The RTC Or You Can't. wHICH iS iT?

If you can't get the time, why are you trying to use it? If you can get the time, what is the problem?

year = RTC.get(DS1307_YR,false); month = RTC.get(DS1307_MTH,false); date = RTC.get(DS1307_DATE,false); hour = RTC.get(DS1307_HR,true); minute = RTC.get(DS1307_MIN,false); second = RTC.get(DS1307_SEC,false);Get the year, month, and date from the last time those values were fetched from the clock, then fetch new values, and get the hour, minute, and second values. Makes sense. Not.

Is the time on your RTC set? You are using hour and minute, but printing only day, month, and year. Why not print the values that you actually use?

ok, so i dont need to use digital pin 1 for a relay, As for the RTC i have tried about 15 differnt codes to try and set it but there is either some problem in the code and it wont up load or the code at that is post 4 will upload and i cant set the time but if i wait and recheck the time it has kiced back to its default and im not sure why...