Real Time Clock: Setting the Date/Time with Arduino

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Using the Adafruit RTC library to set the date and time on a DS1307 real time clock chip with Arduino.
    Links To Sketches:
    RTC_Set - bitbucket.org/...
    RTC_Check - bitbucket.org/...

Комментарии • 50

  • @JonKurz
    @JonKurz 7 лет назад

    Thank you! I can't tell you how long I have been looking for just those few lines of code to sync the datetime. I could not find this on any of the Arduino forums. This works great. Thanks again!

  • @mrstanlez
    @mrstanlez 4 года назад +1

    How can be adjust DATE, TIME, and printed in format TIME, DATE ? Do not works correctly ?

  • @ziggymondus8753
    @ziggymondus8753 4 года назад

    This was so simple. Thanks for sharing.

  • @flyingmonkey3822
    @flyingmonkey3822 4 года назад

    Error "RTC_DS1307' does not name a type; did you mean "ds1307"?... not sure if this is defined in the library RTClib.h or why it's not working. Help please!

    • @electricks6149
      @electricks6149  4 года назад +1

      This may be caused by another library with the same name on your computer. Take a look at this Arduino forum link and see it helps fix your problem: forum.arduino.cc/index.php?topic=586330.0

  • @Hercules159
    @Hercules159 3 года назад

    How do you get the time from the local server and set it. Consider using Blynk server to sync my DS3231 every once in week.

  • @josephreyes1743
    @josephreyes1743 3 года назад

    Sir, Im encountering some sort of a problem. EI have connected this arduino along with the data logger to an lcd sheild. The time and date is perfectly fine but everytime I unplug, the time seems to stop running. When I plug it back on, the time seems to stay with the time that OI unplug it. I hope you can help me.

    • @electricks6149
      @electricks6149  3 года назад

      Did you check to make sure the battery in the shield is good (and it's installed in the correct orientation)? I know one of the shields I purchased came with a dead battery.

  • @DorifutoRabbit
    @DorifutoRabbit 2 года назад

    Thank you

  • @Muhlisweb
    @Muhlisweb 5 месяцев назад

    Thanks you

  • @thankyoutoo1995
    @thankyoutoo1995 6 лет назад +1

    Love you my guy! You really helped me out!

  • @tobotdolce9556
    @tobotdolce9556 5 лет назад +1

    sir why if disconnect my arduino in my pc the rtc time it become late for example i upload the code at 8:30 am then i disconnect it at 8:35 then i connect again in the pc at 8:40 the time will start at 8:35 what is cause of this.

    • @shivaharitathe2105
      @shivaharitathe2105 5 лет назад

      To keep running RTC you have to provide power continuously to RTC

    • @electricks6149
      @electricks6149  5 лет назад

      As Shivahari Tathe mentions, you have to provide continuous power. This is usually done with a backup battery, similar to the one on the data logging shield used in the video. The DS1307 chip has a pin that you can connect the external battery to.

  • @FryedBac0n
    @FryedBac0n 6 лет назад +1

    Just wanna know how could I make a passive buzzer module go off when the RTC's time = 6:00

    • @gustavonavarro4205
      @gustavonavarro4205 4 года назад

      on line 22, you can probably get the hour as variable and just use it as will ( 6 : 00)

  • @user-tr6co8mw4j
    @user-tr6co8mw4j 4 года назад

    can we use the datetime library to set the time in DS3231 AT24C32 IIC Precision RTC Real Time Clock so we can keep the time correct even if the Arduino is reset.?
    this library I mean playground.arduino.cc/Code/DateTime/

  • @jiabipanold8722
    @jiabipanold8722 6 лет назад +2

    I don't know why the output of the code is always "Date/Time: 165:165:85 165/165/216", and it doesn't change.I am using ESP32.

    • @regancooper9364
      @regancooper9364 6 лет назад

      Did you get a solution to this? I am having same problem

    • @ricaldogracia
      @ricaldogracia 6 лет назад

      change your serial.begin to this Serial.begin(115200)

    • @andykeech
      @andykeech 6 лет назад

      Same issue here, and changing the baud rate didn't help but thanks for the idea

    • @joaobaptista2475
      @joaobaptista2475 5 лет назад

      is your laptop a MAC?

    • @saralsaha7938
      @saralsaha7938 4 года назад

      I am using Esp32. It is showing the correct time/date. Check the wire connection.

  • @nickope498
    @nickope498 7 лет назад

    How could I use this to fade on and off a N channel mosfet at certain times?

    • @electricks6149
      @electricks6149  7 лет назад

      You would just have an arduino pin connected to the mosfet gate that would normally be LOW. In the sketch loop you would check for the current hour and minute. You would then set the pin to HIGH if a certain hour and minute (or minute range) is read, otherwise keep the pin set to LOW.

    • @nickope498
      @nickope498 7 лет назад

      How do I check the time in the sketch?

    • @electricks6149
      @electricks6149  7 лет назад

      I posted links to both the "set time" and "check time" sketches in the description. The line that actually gets the current date and time is:
      DateTime now = rtc.now();

  • @amusementnl
    @amusementnl 4 года назад

    can i write with this tutorial timedata on a SD-card?

    • @electricks6149
      @electricks6149  4 года назад

      I have another video that shows how to write to an SD card: ruclips.net/video/tTp43eLqytA/видео.html . I am using the time.h library in that video instead of the Adafruit library.

  • @SakthiVel-ot6me
    @SakthiVel-ot6me 4 года назад

    I need real time clock interfacing with 8085 with date ,month,seconds

  • @pallavijichkar5163
    @pallavijichkar5163 7 лет назад

    Can we also do this similar thing for DS3231 RTC module?

    • @electricks6149
      @electricks6149  7 лет назад +1

      It should work, but you would just need to use the DS3231 library instead of the DS1307.

    • @luissoule
      @luissoule 5 лет назад

      I also had this problem, and i end up using the same library of DS1307 on DS3231 and it worked fine for me.

  • @paowlful
    @paowlful 7 лет назад

    nice video,i'd like to know whic education you went through to do this stuff,and wheter computer engineering degree is suited to do this stuff as well,thank you.

    • @electricks6149
      @electricks6149  7 лет назад

      I have B.S. degree in an engineering discipline (neither electrical nor computer), and an M.S. degree in computer science. A computer engineering degree would certainly give you a great background in this type of programming.

  • @user-ge4wt3se1u
    @user-ge4wt3se1u 7 лет назад

    hi, nice video
    please can you till me where can I get library and arduino code for rtc ds1302.

    • @electricks6149
      @electricks6149  7 лет назад

      You can get my code that was used in the video from the links in the description. You can find the RTC library code at learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/arduino-library .

  • @muhammadzia2411
    @muhammadzia2411 7 лет назад

    which language is this?(c++ or .....)

    • @electricks6149
      @electricks6149  7 лет назад

      It is c++, although you can write sketches in c as well. It is kind of a mixture.

  • @sand2734
    @sand2734 6 лет назад

    'tmElements_t' does not name a type

    • @electricks6149
      @electricks6149  6 лет назад

      Are you getting this error with one of my sketches in the description? I am not using tmElements_t so I don't get this error. In your sketch, you might want to try adding " #include ".

  • @hanafiahgunawan1137
    @hanafiahgunawan1137 6 лет назад

    look my video rtc , no problem

  • @joshuamwaula4905
    @joshuamwaula4905 7 лет назад

    where can i find the code that was used in this vedeo

    • @joshuamwaula4905
      @joshuamwaula4905 7 лет назад

      where can i find the code that was used in this video

    • @electricks6149
      @electricks6149  7 лет назад

      There are links to the sketches in the description.