Skip to main content

RTC Dengan Arduino

Selamat sore teman teman howrudi, setelah kita membahas pembuatan jam digital menggunakan sevent segment, sore ini kita bahas tentang ic untuk jam digital, pendukung jam digital. Modul  RTC (Real Time Clock) menggunakan IC DS1307 mencatat Tanggal dan waktu (jam). RTC ini dapat digunakan pada Arduino atau ATMEGA 8/16/32 melalui komunikasi I2C.
Kita akan mencoba merancang Arduino dengan RTC. Lihat Schematic dibawah ini :
Source code
// Program: Date and time with RTC DS1302 module 
/  www.howrudi.com
// Load the virtuabotixRTC library 

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

RTC_DS1307 RTC;

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

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

void loop () {
    DateTime now = RTC.now();
    
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    
    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");
    
    // calculate a date which is 7 days and 30 seconds into the future
    DateTime future (now.unixtime() + 7 * 86400L + 30);
    
    Serial.print(" now + 7d + 30s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();
    
    Serial.println();
    delay(3000);
} 

Comments

Popular posts from this blog

74hc595 Shift Register

IC  74HC595   Arduino. penghematan pin arduino 74HC595  adalah IC ( integrated circuit , sirkuit elektronika terpadu) dari keluarga TTL seri 74 xx yang berfungsi sebagai  Shift Register . Kami menjual IC ini dalam 2 pilihan kemasan / packaging: versi DIP-16 ( Dual In-line Package  16 pin, 4 IC per paket) dan versi SMD ( Surface Mounted Device , 74HC595D, 5 IC per paket). Komponen elektronika ini memiliki register (kumpulan  flip-flop ) sepanjang 8-bit yang menerima masukan secara serial dan keluaran paralel dalam 8-pin keluaran. Data masukan disimpan pada register penyimpanan tipe-D sepanjang satu byte (8 bit D-type  storage register ). Gambar IC  74HC595   Gambar Schematic  74HC595   Di bawah ini adalah contoh rangkaiannya

Android 12 Developer Preview: Requirements, How to put in and more

  Hi-Jetniaga.com | Google has launched the primary Android 12 Developer Preview.  Here’s the whole lot you want to recognise approximately it, together with steps on the way to deployation it in your phone. oogle these days introduced its next-gen Android 12 running gadget, as a way to be released later this year.  The new running gadget will include numerous new functions, which intention to enhance the general overall performance and consumer experience.  Apart from the layout components, the agency is likewise introducing more than a few of  recent privateness functions, as a way to permit customers to govern how they’re tracked throughout sites.  You can test out the listing of the pinnacle five Android 12 functions right here.  Also Read – Twitter checking out Spaces for Android; in advance of March launch. The first developer preview for Android 12 is now available.  However, because of it being the primary developer preview take be aware t...

Arduino dan LCD

LCD (Liquid Crystal Display) adalah suatu jenis media tampilan yang menggunakan kristal cair sebagai penampil utama. LCD sudah digunakan di berbagai bidang, misalnya dalam alat-alat elektronik, seperti televisi, kalkulator ataupun layar komputer. Pada Percobaan kali ini adalah dengan menggunakan LCD 16x2 yang artinya LCD tersebut terdiri dari 16 kolom dan 2 baris karakter (tulisan). yang perlu di persiapkan adalah sebagai berikut LCD 16x2  Arduino UNO (Type Lain)  Kabel dan Konektor Berikut adalah pin dari LCD 16 X 2 No Kaki/Pin Nama Keterangan 1 VCC +5V 2 GND 0V 3 VEE Tegangan Kontras LCD 4 RS Register Select 5 R/W 1 = Read, 0 = Write 6 E Enable Clock LCD 7 D0 Data Bus 0 8 D1 Data Bus 1 9 D2 Data Bus 2 10 D3 Data Bus 3 11 D4 Data B...