Тёмный

Arduino - DS1307 RTC 

misperry
Подписаться 22 тыс.
Просмотров 65 тыс.
50% 1

In this video we will be looking at how to control a Real Time Clock. RTC using the Arduino Leonardo.
Library Downoad
github.com/adafruit/RTClib
Checkout the Forum!!
themagicsmoke.proboards.com/
Follow me on Instructables
www.instructables.com/misperry
Follow me on Twitter
/ misperryee
T-Shirts
www.zazzle.com/misperry

Наука

Опубликовано:

 

29 мар 2014

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 106   
@mountainbiker1881
@mountainbiker1881 9 лет назад
Such an amazing video. Been through many others but none are as useful as yours. Got my time module working.
@linusmiranda
@linusmiranda 8 лет назад
Sir this video tutorial of yours has helped me a lot in my project. I really want to thank you. Cheers!!
@misperry
@misperry 8 лет назад
+Linus Miranda Hey there thank you very much for the wonderful comment. I am very glad that it was able to help you. It is viewers like you that keeps me inspired to keep making more videos. Thanks again for your comment.
@Ultraread
@Ultraread 9 лет назад
Very nice job. This is the simplest way i have ever seen that someone uses DS1307. I have joined this code with some other codes and i have great result. thanks
@misperry
@misperry 9 лет назад
Hey there, I am very glad to hear that this was helpful for you. Thanks for the great comment. Cheers.
@isuru7777
@isuru7777 8 лет назад
Great work misperry. Just wondering whether you can explain how to attach a LCD to this project which can display time and date. Thank you very much
@mariokiefer4592
@mariokiefer4592 7 лет назад
i am new in programming an arduino and i have a question i need a time 17:59:59 (read it) and will set an output 13 HIGH for 10sec how did i make that. endtime 18:00:09 set output pin 13 LOW
@DrequimaX
@DrequimaX 9 лет назад
Thank you. Worked wonders.
@cupbowlspoonforkknif
@cupbowlspoonforkknif 9 лет назад
I didn't find the explanation of the circuit useful because I have a data logging shield but the code walkthrough was great. Thanks!
@misperry
@misperry 9 лет назад
Hey there thank you for your comment. I am glad part of it was helpful to you.
@linusmiranda
@linusmiranda 8 лет назад
can I do this with DS1302 or DS3231
@Santosh-tq4nj
@Santosh-tq4nj 9 лет назад
Very helpful tutorial. But I have a little problem. I removed the lines with 50s and just added the lines to switch the led off after a second after its on at 30s. Now after it is off the time in the serial monitor suddenly switches to 2000/0/1 0:1:0 or something like that.
@rccanuck4473
@rccanuck4473 4 года назад
Can an rtc send a signal to an Arduino to make a pin go high once an hour? If so any clue on how to go about it ?
@viethungdang7027
@viethungdang7027 9 лет назад
It is a nice post. I really love it. Can I ask you about utilizing the rest memory of DS1307, (from 07H to 3FH)? When I set a bunch of scheduled time points, I need them be kept safe with the battery. Then what commands to write and read there? Thanks for the video and for your time, too!
@misperry
@misperry 9 лет назад
Hey there thanks for the comment. I am glad you enjoyed this video. To answer your question about the nvram on the ds1307 if you open up the RTClib.h file you will see the functions for calling the nvram. I have listed them below. This should help you access these. void readnvram(uint8_t* buf, uint8_t size, uint8_t address); void writenvram(uint8_t address, uint8_t data); void writenvram(uint8_t address, uint8_t* buf, uint8_t size);
@user-ek4gm3qt6o
@user-ek4gm3qt6o 8 лет назад
Thanks so much for this video!
@gherzel
@gherzel 7 лет назад
could you help me? there is no display in my lcd.
10 лет назад
Great tutorial, thanks!
@misperry
@misperry 10 лет назад
Hey there, Thanks for the great comment. I am glad you enjoyed the video.
@gonza0076
@gonza0076 9 лет назад
hello im new att this. i wonder if its posible to make a line that says that i like the led to start when i press a bottom and be on x time and then turn another light for a xtime maybe 72h
@misperry
@misperry 9 лет назад
yes you could. you would just use the now.minute, now.hour, and now.sec function calls I believe and just check for the hour, min, and maybe second that you are wanting to wait for and turn on/off led's accordingly.
@thienkyo
@thienkyo 9 лет назад
Thanks for amazing video. Can I ask u a question? I use RTC module DS3231, i get the time and everything is like what u showed in the video until i turn off the arduino, after 5 minutes I turn it on. In the serial port the time continues where it left off which means 5 minutes later than real time. Can u tell me where i did wrong? I think with the RTC module it is supposed to keep time without the power thanks to the battery.
@misperry
@misperry 9 лет назад
Hey there, thanks for the comment. If it is just picking up where it left off I would check your battery connections. Also I would make sure that in your code you are not saving the current time and re initializing the RTC with that time uppon boot. I did that and didn't notice it and my clock would start from the same time regardless what actual time it was and I noticed that I was putting the initial time set in every time it booted. Once you set the time, as long as you have the battery connected, it should never need to be set again, unless you need to change it for other reasons. Hope this helps.
@thienkyo
@thienkyo 9 лет назад
misperry thanks much, that's very helpful. It's working fine now. Just like u said, i did initialize the time again on every boot. I'm making a RTC switch for my dad to water his orchid garden, twice a day. thanks again.
@misperry
@misperry 9 лет назад
Cool. I am glad you got it working. An orchid garden watering system that sounds great! Have you checked out the automated sprinkler system? I have a vegetable garden and I thought this up one day while watering. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-S7TrhZua1dw.html
@umairmohammad8380
@umairmohammad8380 4 года назад
do u need the delay?
@chevytech1
@chevytech1 9 лет назад
Thanks for the video tutorial. I especially like the way you use schematics. I have used pic chips then moved up to basic stamp2 but this arduino sketch format is making me feel old. 💾
@misperry
@misperry 9 лет назад
Hey there, thanks for the comment. You can use this module with a pic micro or arm processor as well. I was thinking of making other videos using those two platforms as well to show how to make your own DS1307 library.
@RandomMusingsOfLowMelanin
@RandomMusingsOfLowMelanin 9 лет назад
actually wondeful! :)
@prakashbr8703
@prakashbr8703 7 лет назад
thanks a lot bro... its working fine....
@sanuxtreme89
@sanuxtreme89 9 лет назад
Hey Thank you for this wonderful video tutorial. I made one RTC module and its working fine. I have a doubt regarding that can I connect the RTC's SDA and SCL pin to any pins other that A4 and A5 of Arduino??
@misperry
@misperry 9 лет назад
Hey there thanks for the comment. Unfortunately no you cannot connect the RTC to any other pins than the A4 & A5. The reason is because no other pins access the I2C hardware inside the Atmel chip that the arduino uses. Thus, you have to use A4 & A5 for I2C communication.
@sanuxtreme89
@sanuxtreme89 9 лет назад
Thank you
@SashNone
@SashNone 7 лет назад
Nice!
@nikhil25811
@nikhil25811 9 лет назад
does the same library, class and functions work for any rtc???
@misperry
@misperry 9 лет назад
Only chips architecturally similar to the ds1307. Other RTC's may have different command structures and different ways of accessing them. You will have to look at the data sheet to see how they are accessed.
@yuannwang4236
@yuannwang4236 8 лет назад
I am having issues getting this to run on my serial monitor. I have copied the code exactly the way it was provided but the date and time simply won't display. I managed to narrow down the problem in this section of the code: rtc.adjust(DateTime(2015, 5, 21, 18, 0, 0)); DateTime now = rtc.now(); By commenting out this section, I can get the serial monitor to run a simple text message. But with these two lines active, nothing is displayed. Any suggestions?
@misperry
@misperry 8 лет назад
+Yuann Wang Hmm First check your hardware connections and ensure you are not using too big of a pull up resistor.
@seamusflint2986
@seamusflint2986 7 лет назад
Can you add external buttons to change time without the use of computer?
@misperry
@misperry 7 лет назад
You totally could. You would just have to add them to the code so you would be always scanning to see if one is pressed and then upon pressing one you perform the action. Or you could wait for one to be pressed for a period of time then do whatever.
@malgailany
@malgailany 10 лет назад
Very nice video. Thank you.
@misperry
@misperry 10 лет назад
Hey there, thanks for the comment. I am glad that you enjoyed the video.
@shubhamnsun
@shubhamnsun 5 лет назад
Sir what's that some ic kind of thing on the breadboard is it necessary for the circuit
@misperry
@misperry 5 лет назад
Yes that is the DS1307 RTC clock IC. That is whats keeping the time.
@shubhamnsun
@shubhamnsun 5 лет назад
@@misperry thank u sir .
@InventionTherapy
@InventionTherapy 7 лет назад
Did this project take long to build?
@misperry
@misperry 7 лет назад
No it only took as long as soldering the components and programming. The code is located on my project code link that is on my channel's home page.
@bhirani89
@bhirani89 10 лет назад
Nice video.....can you please do a video using this RTC with SURE Electronics LED 3216 matrix.. would really appreciate it.
@misperry
@misperry 10 лет назад
Hey there, Thanks for the comment and the suggestion. This looks like a good idea to me. I am glad that you enjoyed the video and keep watching I may have to check out one of those SURE Electronics 32x16 matrix screens. Thanks again.
@jonathanaeruthayan9234
@jonathanaeruthayan9234 10 лет назад
Hey! Great video! I have one problem. My serial monitor does not display anything. I have set the serial monitor to 57600 baud, but still doesn't work. Any ideas why?
@misperry
@misperry 10 лет назад
Hey there, thanks for the comment. make sure that your monitor window at the lower right corner is set to 57600 and that in your code you set the 57600 baud as well using the Serial.begin(57600)
@snow389
@snow389 7 лет назад
I have done everything right as per your video. I am facing two problems: 1. First of all, the compiler says no function of the form DateTime found, had to change the syntax i.e. i had the define the time before the date, after that was resolved , i still got garbage values in the Serial Monitor. 2. Second of all i copied your code exactly and then uploaded it but then then serial monitor stopped displaying anything! I also wanted to ask you that, Do we have to change settings in the control panel, i.e. to change the bits per second in the device manager properties from the default 9600 to 57600
@nguyenhoanhthoainguyen1135
@nguyenhoanhthoainguyen1135 6 лет назад
when the power is off, the time still running, right?
@misperry
@misperry 5 лет назад
As long as you have the coin cell 3V battery in...yes it will keep running.
@pavanich6902
@pavanich6902 4 года назад
Can we stop this rtc ds1307
@tobyran7299
@tobyran7299 5 лет назад
i want to turn the servo in specific time.it this right. pls help if (now.second () == 02) { myservo.write(100); } Serial.println(); delay(3000); }
@misperry
@misperry 5 лет назад
Well this will activate the sensor once a minute whenever the seconds equal 2. If you are wanting it to be every 2 seconds you will need to take into consideration multiples of 2. Also if you are wanting to do every 2 seconds waiting 3 seconds after performing the action will throw you off. Hope this helps.
@RoSi4You
@RoSi4You 9 лет назад
Hi, do I get this right, if I remove rtc.adjust line (just set the time once) then module should count itself (i have one with battery on) and when I remove power and connect it again it should display current date/time? Instead upon every reset/power disconnect just displaying fixed values which was set with rtc.adjust and not counting.
@misperry
@misperry 9 лет назад
Hey there, thanks for the comment. Yes you are correct. As long as you have a battery you only need to set the clock with the rtc.adjust command only once. What I usually do is put a button or something on a digital port and code the arduino to where when the button is pressed at power up it goes into the rtc.adjust and resets the clock otherwise skip the rtc.adjust and continue with the current time that has been kept. Hope this helps.
@RoSi4You
@RoSi4You 9 лет назад
Hey, thank You for the reply. That's really clever idea with the button pressed. But when I remove rtc.adjust command and remove the power or reset the arduino, I am getting strange readings, like Year 2106 :( Does that mean my battery is gone in RTC module perhaps? ATM I can't read its voltage, because battery in my multimeter is gone too :)
@misperry
@misperry 9 лет назад
RoSi4You Hey there. Yeah checking with a good fresh battery would be a good idea. However, you could, if you have one available, use a power supply and set it for 3V to simulate a coin cell battery and connect that to the BATT input. Also ensure that the polarity you are connecting the battery up to the RTC is correct as well. Trust me I have put many a battery in backwards in my life time lol. Hope this is helpful and good luck.
@RoSi4You
@RoSi4You 9 лет назад
Hm, battery on module is soldered, so bought one for my multimeter, measured it and I am reading 3.27V on it :/ So probably error is coming from somewhere else.
@misperry
@misperry 9 лет назад
RoSi4You Hmmm yeah it sounds like it. Check your connections and be sure you have connected the bat to the correct places on the chip and with the right polarity. Also if you are using a bread board be sure that the bread board sockets are not loose. I have chased problems in the past the resulted in the breadboard not making contact with a wire I plugged in because the contact inside the bread board was bent out from a large diode's lead spreading it too far. Check things like this. good luck
@dalaxdercrisper957
@dalaxdercrisper957 6 лет назад
Is there any chance for Arduino Uno to work?
@misperry
@misperry 6 лет назад
Yes that should work fine. The library, I beleive, is universal. Good question.
@althuelectronics5158
@althuelectronics5158 5 лет назад
wery naise your video am stading ths metheed sooper your video thanks sir
@wegar
@wegar 7 лет назад
there is a way to determinate the day of the week? (I mean Monday, tuesday...) Nice video, thanks for sharing ;)
@TechTribeCommunity
@TechTribeCommunity 6 лет назад
Yes, if you go to the example code once you download the library, the first example has days of week printing.
@TheAzupan
@TheAzupan 9 лет назад
das it work for ds1302?
@misperry
@misperry 9 лет назад
Andraž Zupan I am not sure since I have not tested it on that device. You can check it out.
@fikadushewitgidey1467
@fikadushewitgidey1467 8 лет назад
it was an awesome helpful video, thank you and appreciate you. can you show me how to interface with lcd
@misperry
@misperry 8 лет назад
+fikadu shewit gidey Hey there, thanks for the comment. Yeah I will have to do a video on how to use the arduino and an LCD. Good Idea.
@ManishSingh-eg8cu
@ManishSingh-eg8cu 9 лет назад
Hello Sir; First of all thank you such a clear and nice explanation. I am making a project which has multifunctions . Now I am using a bluetooth module which works at bode rate of 9600 and this Ds1307 works at bode rate of 57600.So how can I use both of this different bode rates in same programe. Thank You in advance.
@misperry
@misperry 9 лет назад
Manish Singh Check out how to configure a software UART. You will use what is called the bit-bang approach to make a virtual UART on the arduino that will have one baud rate and then you will use the hardware UART at a different baud to do the other. Hope this helps.
@PAGLAMIEXPERIMENTS
@PAGLAMIEXPERIMENTS 6 лет назад
need code
@tifaill9526
@tifaill9526 9 лет назад
Awesome work man well done. this work fine but sometimes i have a problem instead of show 09:07:05 shows something like this 9:7:5
@misperry
@misperry 9 лет назад
TIfail L Hmmm I am not sure why it is doing that. did you set 24hr clock or 12hr?
@trantrung4259
@trantrung4259 9 лет назад
how can i get day of week. ex: sunday?
@misperry
@misperry 9 лет назад
Trần Trung Hey there, I believe it is the weekday() function i.e. now.weekday(). It looks like the software library may have been updated since I made this video so you can check it out on this page: playground.arduino.cc/code/time
@trantrung4259
@trantrung4259 9 лет назад
misperry i tried. Error: 'class DateTime' has no member named 'weekday'.
@misperry
@misperry 9 лет назад
Hmm, well I was looking at the latest code for that library. You could always look at the source for the library and see if there is anything available for the week day. If not you could either see if there is an updated library at raspberrypi.org or you can check out the data sheet for the ds1307 and make your own function to read the register that has that information. I know the ds1307 hardware supports this feature. Take care
@yixingsmooaeri2178
@yixingsmooaeri2178 8 лет назад
Hi Sir, I'm having probems setting exact time using DS1307. I've watched this video and I followed your codes pattern, but I can't come out with what I'm expecting. Could please help me? At the last part of the video you said something like setting exact time, could you please send me some example codes. Thankyou so much! =) This will be a great help in my project.
@misperry
@misperry 8 лет назад
+Yixingsmoo Aeri Hey there thanks for the comment. What exact time were you needing? Are you wanting to know how to set it up to perform a task at a specific time and date?
@yixingsmooaeri2178
@yixingsmooaeri2178 8 лет назад
I needed it turn on every 7:30am and stay on for 10mins and then off and it will turn again at 4:00pm and stay on for 10mins also then off. I want to make it happen everyday. Is this possible using DS1307? If you can help me in coding, I'll appreciate it very much. Thanks. :)
@yixingsmooaeri2178
@yixingsmooaeri2178 8 лет назад
+misperry I needed it turn on every 7:30am and stay on for 10mins and then off and it will turn again at 4:00pm and stay on for 10mins also then off. I want to make it happen everyday. Is this possible using DS1307? And by the way, I just wanna ask if it is okay if we dont use LCD in this? Hope you'll response sir. Thanks! =)
@misperry
@misperry 8 лет назад
+Yixingsmoo Aeri in my example you can use the now.hour() and there is a day of the week function that will return the day of the week. There is a bunch of information in the link in the description. I have included that here. github.com/adafruit/RTClib Also I could give you some sample code but it will take a while since I am very busy. Hope this helps.
@kararsabih3910
@kararsabih3910 8 лет назад
Hi, first of all thanks for this video ...... I've download the library into arduino but i have this error ==> sketch_mar06a.ino:20:20: error: RTClib.h: no such file or directory
@misperry
@misperry 8 лет назад
+karar sabih You will have to install the RTClib.h file into your arduino directory since it is a header file. Here is the adafruit link on how to do so. learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/arduino-library
@kararsabih3910
@kararsabih3910 8 лет назад
+misperry I've installed it but i had the same problem.......!!
@misperry
@misperry 8 лет назад
+karar sabih Make sure you are calling it with quotes like "RTClib.h" and not like this check at 9:00 in vid
@lakemast
@lakemast 8 лет назад
My rtc is showing nothing, do you know what is happening ?
@misperry
@misperry 8 лет назад
check your wiring and ensure that everything is connected properly. Ensure the crystal for the clock is connected.
@FunReviews
@FunReviews 6 лет назад
Try the debugging section of this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-drU3dQa-8CE.html
@ahmedtarek537
@ahmedtarek537 10 лет назад
Thank you alot for this video ,it's really useful ,but i have a problem it says RTC not running , 2165/165/165 165:165:85 2165/165/165 165:165:85 and counting like this , i dont know whats wrong with it
@misperry
@misperry 10 лет назад
He there, thanks for your comment. I would check your hardware connections. Ensure that you are using the proper resistance value on your I2C lines. This will cause some very strange data to come out if you have the wrong resistances. Also ensure that you have the correct baud rate. I have set mine to 57600 in this example. If you need to post your sketch and I can take a look at it. Hope this helps.
@FranklinChou
@FranklinChou 9 лет назад
This may not apply to your problem. But when I connected the 3231 RTC board I accidentally reversed the SCL/SDA lines. For reference on an Arduino UNO (I'm running an R3) analog pin A5 should connect to SCL and A4 to SDA. Does that fix your problem?
@vincentliet7995
@vincentliet7995 10 лет назад
The DS1`307 RTC is a nice clock but if the temperature isn't 25 degrees celcius it is not very precise.
@misperry
@misperry 10 лет назад
Hey there, thanks for your comment. Yes but it is not due to the device since the device has a temp range fo -40C to 85C. Where the error comes in is with the crystal selection. Depending on the temp drift of the crystal and the capacitive trimming of it will effect your clock's accuracy. So if you need a wide temp range then you need to be very selective of your crystal that you will use to get the maximum precision out of the clock. For selecting the crystal you can refer to maxim's application note 58 located below. www.maximintegrated.com/app-notes/index.mvp/id/58
9 лет назад
Check out my Siemens S7-1200 Realtime function ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-jY117f6YryU.html
@cucuMobile2470
@cucuMobile2470 9 лет назад
Ds1307 can only run on 5v
@mahermarwen2488
@mahermarwen2488 9 лет назад
Very nice vidéo i really like it :) can you help me in my project based on arduino Uno ? how to use real time in my code of "the automatic spray of gardin" with preset time !! i really appreciate your attention and help :)
@misperry
@misperry 9 лет назад
Maher Marwen Hey there, sure I have a video doing exactly that it is called the automated sprinkler. Give it a look: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-S7TrhZua1dw.html
@mahermarwen2488
@mahermarwen2488 9 лет назад
misperry thank you very much i really appreciate your help but it doesn't compile at the end of the code .. PS: i use a carte of Arduino UNO
Далее
Arduino Real Time Clock - Using the Tiny RTC
31:29
Просмотров 199 тыс.
Together we are Capturing Dust! (Just Huge if True)
5:24
How do I use a Real Time Clock with Arduino?  RTC 1307
10:29
Using Inexpensive 433 MHz RF Modules with Arduino
29:50
ESP32CAM WiFi Enabled FTP Image Uploader
17:18
Просмотров 2,6 тыс.
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
iPhone, Galaxy или Pixel? 😎
0:16
Просмотров 1,2 млн
#engineering #diy #amazing #electronic #fyp
0:59
Просмотров 2 млн