Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO and RTC DS1307 Controlled Water Pump System with 12V Relay

View and Edit Project In Cirkit DesignerImage of Arduino UNO and RTC DS1307 Controlled Water Pump System with 12V Relay

Circuit Documentation

Summary

This circuit is designed to control a 12V water pump using an Arduino UNO, a 12V single-channel relay, and an RTC DS1307 module for timekeeping. The Arduino UNO reads the time from the RTC module and controls the relay to switch the water pump on and off. The circuit is powered by a 220V power source.

Component List

  1. RTC DS1307

    • Description: Real-Time Clock module for timekeeping.
    • Pins: DS, SCL, SDA, VCC, GND, SQ, BAT
  2. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  3. Water Pump 12V

    • Description: 12V water pump.
    • Pins: +, -
  4. 12V Single Channel Relay

    • Description: Relay module for switching the water pump.
    • Pins: NC, COM, NO, IN, GND, VCC
  5. Power 220V

    • Description: 220V power source.
    • Pins: hot wire, neutral wire

Wiring Details

RTC DS1307

Arduino UNO

Water Pump 12V

12V Single Channel Relay

Power 220V

Code Documentation

Arduino UNO Code

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

RTC_DS1307 rtc;

char namaHari[7][12] = {"Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"};

void setup () {
  Serial.begin(9600);
  if (! rtc.begin()) {
    Serial.println("RTC TIDAK TERBACA");
    while (1);
  }

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));//update rtc dari waktu komputer
  }
}

void loop () {
    DateTime now = rtc.now();
    Serial.print(namaHari[now.dayOfTheWeek()]);  
    Serial.print(',');    
    Serial.print(now.day(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.year(), DEC);
    Serial.print(" ");   
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
   
    delay(3000);
}

This code initializes the RTC DS1307 module and reads the current time. It then prints the day of the week, date, and time to the serial monitor every 3 seconds.