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/...
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!
Jon Kurz Glad I could help!
How can be adjust DATE, TIME, and printed in format TIME, DATE ? Do not works correctly ?
This was so simple. Thanks for sharing.
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!
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
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.
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.
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.
Thank you
Thanks you
Love you my guy! You really helped me out!
Thanks for watching, glad it helped!
Thanks for the feedback!
Please konjam vema thngale
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.
To keep running RTC you have to provide power continuously to RTC
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.
Just wanna know how could I make a passive buzzer module go off when the RTC's time = 6:00
on line 22, you can probably get the hour as variable and just use it as will ( 6 : 00)
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/
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.
Did you get a solution to this? I am having same problem
change your serial.begin to this Serial.begin(115200)
Same issue here, and changing the baud rate didn't help but thanks for the idea
is your laptop a MAC?
I am using Esp32. It is showing the correct time/date. Check the wire connection.
How could I use this to fade on and off a N channel mosfet at certain times?
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.
How do I check the time in the sketch?
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();
can i write with this tutorial timedata on a SD-card?
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.
I need real time clock interfacing with 8085 with date ,month,seconds
Need ptogram link
Can we also do this similar thing for DS3231 RTC module?
It should work, but you would just need to use the DS3231 library instead of the DS1307.
I also had this problem, and i end up using the same library of DS1307 on DS3231 and it worked fine for me.
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.
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.
hi, nice video
please can you till me where can I get library and arduino code for rtc ds1302.
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 .
which language is this?(c++ or .....)
It is c++, although you can write sketches in c as well. It is kind of a mixture.
'tmElements_t' does not name a type
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 ".
look my video rtc , no problem
where can i find the code that was used in this vedeo
where can i find the code that was used in this video
There are links to the sketches in the description.