How to use DS1307 RTC with Arduino + LCD/OLED 12h/24h formats

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 เม.ย. 2019
  • Hello, and welcome to this tutorial where I use another RTC module, this time we have the DS1307 module, and I'm using it with an Arduino UNO board, then I'm using an OLED screen and LCD i²c screen to display multiple formats of date and time and in both 24h and 12h format. any problem leave a question in the comments.
    Consider a Subscribe to support the channel.
    Wiring and codes:
    surtrtech.com/2019/04/02/how-t...
    Arduino RTC playlist:
    bit.ly/2I7ZwFC
    How to simply use RTC DS1302 with Arduino:
    bit.ly/2YNpC6G
    How to setup RTC DS1302 with keypad and Arduino:
    bit.ly/2CLsjwb
    EASY Arduino Alarm Clock based on DS1302 RTC:
    bit.ly/2FIOvrI
    How to simply use DS3231 RTC module with Arduino + OLED display:
    bit.ly/2YGqhXD
    Arduino Modules playlist:
    bit.ly/2Dh4pJC
    Arduino Projects playlist:
    bit.ly/2Fxm2Y7
    Arduino Shields playlist:
    bit.ly/2APsndI
    Facebook: / surtrtech
    Twitter: / surtrtech
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 14

  • @anokhautomation4453
    @anokhautomation4453 ปีที่แล้ว

    Very useful tutorial 👍 thanks for sharing 🙏

  • @ManuPithiviers
    @ManuPithiviers 3 ปีที่แล้ว +1

    Thank you !

  • @leeralph7765
    @leeralph7765 5 ปีที่แล้ว +2

    Evening Yassine.
    Thank you for this great tutorial, out of all I have seen this is the best.
    One problem though, have set this up and followed your tutorial to the letter (down loading everything from your site), I have run the simple program and the rtc worked really well, have run clock file 1 and 2 for oled and it looks great (better than I have attempted so far lol). But can not get the clock files to talk the rtc? (shows 12:00am 1/1/2001). Any idea where I may be going wrong?. Using the same display and Same tiny rtc as seen in your video.
    Thank you for your time and thanks again for the tutorial.

    • @SurtrTech
      @SurtrTech  5 ปีที่แล้ว

      Thanks a lot, did you try first to set the RTC using the first example?
      Upload the "SetTime" example first while the RTC is wired.
      Then try the other codes.

    • @leeralph7765
      @leeralph7765 5 ปีที่แล้ว

      @@SurtrTech ah, there we go, all working. Thank you very much for your help and keep up the good work.

    • @leeralph7765
      @leeralph7765 5 ปีที่แล้ว

      @@SurtrTech and also a bit of fault finding found a dodgy battery fitted to the back of the rct 😣

    • @SurtrTech
      @SurtrTech  5 ปีที่แล้ว

      @@leeralph7765 Thank you very much, I'm happy it's working, normally those batteries last around 10 years, but if you could change it it would be better

  • @sergiomoranavarrete9426
    @sergiomoranavarrete9426 4 ปีที่แล้ว

    Hello, Thanks for the video, but I still can not print2digits on a ssh1106 u8glib. Is there any way to see it on an OLED?

    • @SurtrTech
      @SurtrTech  4 ปีที่แล้ว

      Did you modify the function below? Because that function is not in the library, I just made it, make sure to adapt it to your display library too

  • @rickyamri7643
    @rickyamri7643 4 ปีที่แล้ว

    hello, how to set the time?

  • @thomaswilkerson9961
    @thomaswilkerson9961 4 ปีที่แล้ว

    Print2digits wors great thnak you
    I Can not get 12hr time, else if(Hour>12){
    Hour=Hour-12; //substract 12 to bring it back to 1,2,3,...
    a=false;
    display.print(Hour);
    Please help tia

    • @SurtrTech
      @SurtrTech  4 ปีที่แล้ว

      I don't understand your problem.
      The code detect which hour and if it's 0- under12 it shows normally and with a "am", if it's 12 it shows 12 with "pm", higher than 12 it goes back to 12h format with "pm" symbol. if it's 0 (midnight) it shows 12 "am".

    • @thomaswilkerson9961
      @thomaswilkerson9961 4 ปีที่แล้ว +1

      @@SurtrTech
      Thanks for your response. Sorry but I confused my own questions with another video. Here I'm trying to get your OLED_3 sketch to put a zero in when hours, minutes, or seconds are less than 10 so there are 2 digits displayed. I tried using print2digits(tm.Second); along with
      void print2digits(int number) {
      if (number >= 0 && number < 10) {
      display.write('0');
      display.display();
      }
      display.print(number);
      display.display();
      display.println();
      }
      I give 2 digits but everything on the display after that command flickers i.e the PM,month, day, and year flash rapidly. any help is appreciated,

    • @SurtrTech
      @SurtrTech  4 ปีที่แล้ว

      Well you'll have to create another function for example" print2digits(int and here it should read the hour/minute/sec).
      Inside the function you'll test if the variable is