How to use Arduino Real Time Clock module with DS1302 chip

Ғылым және технология

In this video, I'm going through the basics of how you can connect and interface a Real-Time Clock (RTC) module based on the DS1302 IC with Arduino.
A Real-Time Clock, or RTC for short, is an integrated circuit that keeps track of time. It uses a backup battery to maintain time in the event that the main power source is removed.
Additionally, I go over the principle of operation of this chip and why it is required in certain types of projects where time tracking is vital.
The code used in this example can be found in the Instructable for the project:
www.instructables.com/Real-Ti...
The library used in the example is Rtc By Makuna
www.arduino.cc/reference/en/l...
Tools and materials used in this video:
NodeMCU Development Board - s.click.aliexpress.com/e/_mOv...
DS1302 RTC Module - s.click.aliexpress.com/e/_9vbjPg
Mini Breadboards - s.click.aliexpress.com/e/_9vg9cK
Jumper Wires - s.click.aliexpress.com/e/_AZwpjC
CR2032 Battery - s.click.aliexpress.com/e/_9fZL2e
Alternate links on Banggood:
NodeMCU Development Board - s.click.aliexpress.com/e/_mOv...
DS1302 RTC Module - www.banggood.com/custlink/KKD...
Mini Breadboards - s.click.aliexpress.com/e/_ol4...
Jumper Wires - www.banggood.com/custlink/KG3...
CR2032 Battery - s.click.aliexpress.com/e/_9fZL2e
Support my work on Patreon so I can continue producing free content and tutorials!
/ taste_the_code
My recording gear:
GT10 Pro 5G Android Phone - s.click.aliexpress.com/e/_oDn...
Dragon Touch 4K Action Camera - s.click.aliexpress.com/e/_mrc...
USB Condenser Microphone - s.click.aliexpress.com/e/_mq5...
Tripod - s.click.aliexpress.com/e/_ooa...
Phone tripod mount - s.click.aliexpress.com/e/_s9WaiJ
How to use Arduino Real Time Clock module with DS1302 chip
#arduino #rtc #realTimeClock #electronics #tastethecode
Main Site and blog: www.tastethecode.com
Facebook: / tastethecode
Instagram: / taste_the_code
Twitter: / taste_the_code
Get exclusive Taste The Code t-shirts and merch at
teespring.com/taste-the-code
Click on the link below to get two months of free premium access to Skillshare and start learning today!
skl.sh/37LnRua
Get $50 off your order on hosting for all of your website needs and learning projects on Dreamhost!
www.dreamhost.com/r.cgi?24057...

Пікірлер: 45

  • @anokhautomation4453
    @anokhautomation44532 жыл бұрын

    👍nice useful tutorial. Please create more projects with rtc module. 👌

  • @TasteTheCode

    @TasteTheCode

    2 жыл бұрын

    Thanks! Will do definitely!

  • @GoodVibesToUsAll
    @GoodVibesToUsAll3 жыл бұрын

    Great information and nice work. New subscriber

  • @TasteTheCode

    @TasteTheCode

    3 жыл бұрын

    Thanks and welcome 👍👍👍

  • @AminahAbdi1
    @AminahAbdi1 Жыл бұрын

    this one help me creat a real time clock module using RTC thank you

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    👍👍👍

  • @akk5830
    @akk58303 жыл бұрын

    Thanks a lot

  • @TasteTheCode

    @TasteTheCode

    3 жыл бұрын

    You are welcomed!

  • @krisr5497
    @krisr54976 ай бұрын

    This is very well explained, thank you. But I am wondering - you said the battery is being (trickle)charged (0:45). The battery you are using is not rechargeable. Could that be a problem?

  • @TasteTheCode

    @TasteTheCode

    6 ай бұрын

    These batteries are all based on lithium so I guess some small current does not harm them. So far I haven't had a problem at all.

  • @Equalizer-ZA
    @Equalizer-ZA3 жыл бұрын

    Hello Bill .....im from South Africa and my sons do online racing I am interested in developing a gearshift device which they can use as a gear shifter on either side of their steering wheels. They currently use ordinary switches but the more complex wheels use Hall Sensors. How can i get more in touch with you to possibly help me to change the switches out for Hall sensors .......

  • @TasteTheCode

    @TasteTheCode

    3 жыл бұрын

    Hey Robert, I don't usually do personal help on projects but my I would suggest that you mount a magnet on the lever of the shifter and then, behind it you can mount the hall effect sensor. You will need one that detects presence of a magnetic field and not the ones that work as on/off switches (detect magnetic polarity). Feel free to contact me through my Facebook page.

  • @m0kcun
    @m0kcun Жыл бұрын

    I hve problem. I first upload the code using cable. Then i unplug it and using battery 9v to it. Btw mine use arduino uno. It doesnt updatind new time. Example i run on 9.00 (10/6/2023) and when i unplug and connect the battery at 10.00 the same day it just show the 9.00am one not the updating

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    I had that once happening to me as well but with a low-voltage battery on the module. I replaced it with a new battery and it never happened again.

  • @m0kcun

    @m0kcun

    Жыл бұрын

    @@TasteTheCode okay i wil try use new battery. THANKSSSS

  • @agilalfarizal
    @agilalfarizal Жыл бұрын

    Apakah RTC 1302 bisa terhubung dengan esp 32 cam untuk penjadwalan pengambilan photo dan dikirimkan ke telegram jika bisa menggunakan pin yang mana mohon bantuannya

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    Yes it can but that is not something that is simply executed.

  • @dwikiadityairfan6339
    @dwikiadityairfan63393 жыл бұрын

    Tambahan program untuk lcdnya bagaimana ya bg?

  • @TasteTheCode

    @TasteTheCode

    3 жыл бұрын

    Check my other videos. I already published one for the LCD.

  • @jonathanmitchell2070
    @jonathanmitchell2070 Жыл бұрын

    At 10:03, in the serial monitor, a load of junk appears on line 3. What and why is that?

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    It happens when the reset button is pressed on the NodeMCU but I'm not really sure why. You can see it happening at 11:02 I guess it has to do with the processor starting up and maybe using different baud rate at start. I've seen this with many microcontrollers but I've never really paid any attention to it.

  • @jonathanmitchell2070

    @jonathanmitchell2070

    Жыл бұрын

    @@TasteTheCode Thank you, I am learning, your reply is appreciated.

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    You are welcome!

  • @Francesco-bu1hh
    @Francesco-bu1hh2 жыл бұрын

    Hi, is there a way to get the day of the week?

  • @TasteTheCode

    @TasteTheCode

    2 жыл бұрын

    There is a function on the library called DayOfWeek() that returns 0-6, where 0 is Sunday, 1 is Monday, etc.

  • @Francesco-bu1hh

    @Francesco-bu1hh

    2 жыл бұрын

    @@TasteTheCode Thank you. I have been viewing your channel recently. It is very interesting.

  • @TasteTheCode

    @TasteTheCode

    2 жыл бұрын

    Thank you! I'm glad that you like it!

  • @Filo-qn8pj
    @Filo-qn8pj Жыл бұрын

    Is there a way to use a battery instead of cable to power source?

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    Yes you can. You will either need to provide 5V on the Vin pin or 3.3V regulated on any of the 3V3 pins. I have another project where I'm using power bank ICs to make a project power supply for this purpose. You can check it here: kzread.info/dash/bejne/jJltrNWcc9uyqJs.html

  • @Filo-qn8pj

    @Filo-qn8pj

    Жыл бұрын

    @@TasteTheCode Thank you, i'm doing this for a school project and they gave me an arduino board and a 9V Battery Snap DC Cable. However, I found your video and ordered the DS1302 and the NodeMCU and I just wanted to ask, does the 9V battery snap work with the NodeMCU?

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    Arduinos, work on 5V, and the Uno especially have a mich larger voltage regulator to handle higher voltage range. NodeMCU works on 3.3V, and I think the max you can provide on the Vin pin is 5V. However, if tou have the Arduino, the same code should work on it as it works on the NodeMCU so you can basically just swap them.

  • @Filo-qn8pj

    @Filo-qn8pj

    Жыл бұрын

    @@TasteTheCode Could you please send me a link or the name of a battery and/or battery holder that would work on this. Sorry I am completely new to this and I am struggling.

  • @TasteTheCode

    @TasteTheCode

    Жыл бұрын

    @@Filo-qn8pj I'm not sure what you need. Arduino Uno will work on a 9V battery and you can still use the RTC module on it in exactly the same way as on the NodeMCU.

  • @Thebasicmaker
    @Thebasicmaker2 жыл бұрын

    ci sono siti che danno data ora e minuti

  • @TasteTheCode

    @TasteTheCode

    2 жыл бұрын

    Yes, but this is handy if the project is not connected on the internet.

  • @Thebasicmaker

    @Thebasicmaker

    2 жыл бұрын

    @@TasteTheCode sure but since it has a wi-fi module I thought...

  • @TasteTheCode

    @TasteTheCode

    2 жыл бұрын

    I often use NodeMCUs as just demonstration, basically using them instead of an Arduino Nano or Uno.

  • @chrisleon7312
    @chrisleon73124 ай бұрын

    Complete gibberish!

  • @TasteTheCode

    @TasteTheCode

    4 ай бұрын

    😱😱😱

  • @Gold007-
    @Gold007-2 жыл бұрын

    I tried this with my ds 1302. It returns 19/80/2091 44:127:1 + RTC lost confidence in the DateTime! data read (20) = "⸮G Do you know why this happens?

  • @TasteTheCode

    @TasteTheCode

    2 жыл бұрын

    Did you set the time initially? Check that the battery is OK and that it is making a good connection. I had a bad battery making weird issues once.

  • @Gold007-

    @Gold007-

    2 жыл бұрын

    ​@@TasteTheCode The compiled time is set. The battery has 3 Volts and I think it has a good connection. I also tried changing the battery. That didn't work either. Could my ds 1302 be broken?

  • @TasteTheCode

    @TasteTheCode

    2 жыл бұрын

    I've never seen one to fail but it's not impossible. Do you have another one to try?

Келесі