Arduino with timer signal output

Hi,

can someone please help me with following.

I have my arduino set up to give me signal output when I give him signal input but can I program it to give signals in right time in the day. Exp. I want it to start my motor in exactly 8 PM. How can I make this?!

If you use the Arduino's built-in clock your time will drift by several minutes a day and will be lost completely if the power is ever lost. You should add a Real-Time Clock (RTC) which will keep accurate time like a quartz watch.

johnwasser:
If you use the Arduino's built-in clock your time will drift by several minutes a day and will be lost completely if the power is ever lost. You should add a Real-Time Clock (RTC) which will keep accurate time like a quartz watch.

DS1307 Real Time Clock breakout board kit : ID 264 : $7.95 : Adafruit Industries, Unique & fun DIY electronics and kits

tnx a lot! coding the clock input into arduino should't be a problem I suppose?

boddah_cro:
tnx a lot! coding the clock input into arduino should't be a problem I suppose?

Adafruit always provides libraries and tutorials for their Arduino products. Check out the information they supply to see if the wiring is within your capabilities.

Tnx johnwasser but I'm a newbie so in adafruit library, I can only see how to setup the clock onto the display :slight_smile: And I need how to make my Arduino do something in right time. Sorry.

Something like this will turn on the motor at 8 PM.

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

boolean MotorIsRunning = false;

void setup () {
  Serial.begin(57600);
  Wire.begin();
  RTC.begin();

  if (! RTC.isrunning()) {
    Serial.println("RTC was NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }

  if (! RTC.isrunning()) {
    Serial.println("RTC wfailed to start running");
    while (true);
  }
}

void loop () {
  DateTime now = RTC.now();

  // Start the motor at 8 PM (20:00)
  if (now.hour() == 20 && !MotorIsRunning) {
    // Add code here to start the motor
    MotorIsRunning = true;
  }
}

johnwasser:
Something like this will turn on the motor at 8 PM.

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

#include <Wire.h>
#include “RTClib.h”

RTC_DS1307 RTC;

boolean MotorIsRunning = false;

void setup () {
  Serial.begin(57600);
  Wire.begin();
  RTC.begin();

if (! RTC.isrunning()) {
    Serial.println(“RTC was NOT running!”);
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(DATE, TIME));
  }

if (! RTC.isrunning()) {
    Serial.println(“RTC wfailed to start running”);
    while (true);
  }
}

void loop () {
  DateTime now = RTC.now();

// Start the motor at 8 PM (20:00)
  if (now.hour() == 20 && !MotorIsRunning) {
    // Add code here to start the motor
    MotorIsRunning = true;
  }
}

TNX a lot!