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

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...

Menyimpan Data Di Sd Card

Data logger merupakan data penyimpanan ke external memory atau ke SD Card, penggunaan data logger ini biasanya untuk menganalisa/mendapatkan data dari suatu kondisi di tempat tertentu. Misal untuk perubahan suhu per satuan waktu di tempat tertentu. Selain data logger, Modul ini juga langsung ada RTC (Real Time Clock) untuk pencatat waktu.  Mancoba data logger,  Konfigurasi data logger dengan arduino menggunakan koneksi SPI, maka untuk pin di arduino UNO bisa menggunakan pin sebagai berikut : MOSI - pin 11 MISO - pin 12 CLK - pin 13 CS - pin 10 #include <SPI.h> #include <SD.h> const int chipSelect = 10; void setup() {   Serial.begin(9600);   Serial.print("Initializing SD card...");   // inisialisasi card   if (!SD.begin(chipSelect)) {     Serial.println("Card failed, or not present");     // don't do anything more:     return; ...

Fasilitas Nuklir Meledak Lagi

TOKYO-Ledakan kembali terjadi di fa­silitas nuklir Fukushima Dai-ichi di Jepang, Senin (14/3). Sebelumnya, le­dakan juga terjadi pada Jumat (14/3) pekan lalu, akibat gempa kuat dan tsu­nami di Sendai, Jumat (11/3) lalu. Tokyo Electric Power Co yang mengelola fasilitas nuklir itu menyatakan, selain tujuh orang di­nyatakan hilang, tiga pekerja lain me­ngalami luka-luka. Sekretaris Kabinet Jepang, Yukio Edano me­ngatakan, ledakan hidrogen itu terjadi pada unit 3 fasilitas nuklir. Ledakan itu mirip dengan ledakan sebelumnya di unit yang berbeda. Yu­kio Edano me­nga­ta­kan, akibat ledakan itu warga dalam ra­­dius 20 km diperintahkan untuk tetap ting­gal di dalam rumah. Sementara war­ta­wan AP merasakan ledakan itu dari ja­rak 40 kilometer. Edano menepis ke­kha­watiran terhadap risiko terhadap ling­kungan dan ma­syarakat. Sebab, balok penahan wadah kon­tain­men da­lam reaktor nuklir tersebut dalam kondisi utuh. Meski demikian lebih dari 180.000 orang diungsikan dari daerah itu dalam beber...