How to use DS3231 RTC module to build OLED clock

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2021
  • In this video I will show you how to use DS3231 RTC module. It will explain how to connect it to I2C bus.
    Also I will show you how to display date and time readings on the OLED display.
    Hope that you will find this video useful.
    The code and a list of components can be found here:
    www.hackster.io/mdraber/tutor...
    or here
    www.hackster.io/mdraber/tutor...
    In the video I use I2C scanner code:
    playground.arduino.cc/Main/I2...
    And Library:
    github.com/jarzebski/Arduino-...
    If you like this content and you want to support me in creating similar videos go to my Patreon webpage
    / mariosideas
    Or
    www.paypal.com/cgi-bin/webscr...
    Music credits:
    ------------------------------
    Track: Highlander - Scandinavianz [Audio Library Release]
    Music provided by Audio Library Plus
    Watch: • Highlander - Scandinav...
    Free Download / Stream: alplus.io/highlander
    ------------------------------
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    This tutorial helped me a lot. Many thanks man

  • @geertborloo
    @geertborloo 2 หลายเดือนก่อน

    Very clear tutorial, explaining all necessary things to know. Thanks !!

    • @marios_ideas
      @marios_ideas  2 หลายเดือนก่อน

      Glad you liked it

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

    Thank you for share your knowledge. I follow the tutorial and it work as in your video. THANK YOU

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

    Great video. Thank you.

  • @jahirulislamshovon9256
    @jahirulislamshovon9256 3 ปีที่แล้ว

    Nice and detailed

  • @charandas6162
    @charandas6162 2 ปีที่แล้ว

    What will be the connection and code if we use Arduino maga or esp32

  • @armedbacon4169
    @armedbacon4169 3 ปีที่แล้ว

    love ur new vid
    btw can u do a dare for me?
    dare: can you make an atmega328p handheld console without getting the codes from the internet (if u cant np 😁)

  • @billferner6741
    @billferner6741 4 วันที่ผ่านมา

    I run into the memory problem as soon as I started. My solution was putting all text messages (e.g. help or failure code) into the eeprom.

  • @ArkhaanX
    @ArkhaanX 3 ปีที่แล้ว

    Thank you.

  • @agaldoo
    @agaldoo 10 หลายเดือนก่อน +2

    Use the esp32 it has 240 mhz clock and 2MB of storage. The pins are d21(sck) and d22(sda)

  • @rafteralimagno5997
    @rafteralimagno5997 2 ปีที่แล้ว

    What part of the code will the address 0x68 (for the DS32321) be used? I understand that Arduino can communicate with I2C devices thru their addresses but I only see the address for the OLED being used. I hope you can respond to this. Thank you!

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว +1

      Yes you are right. In declaring the RTC you do not quote the address. So It must be done in the library code and that would indicate that DS3231 has fixed address as opposed to OLED displays which I thinkk have 2 or 3 potentialy different addresses.

    • @rafteralimagno5997
      @rafteralimagno5997 2 ปีที่แล้ว

      @@marios_ideas Alright! I understand your explanation.
      Btw, I'm doing a project now. But I'm using an LCD instead of ng OLED display. The clock.dateFormat won't work whenever I want to print to the LCD or the serial monitor. I use these for trying to print:
      LCD: lcd.print(clock.dateFormat("H:i:s", dt));
      Serial Monitor: Serial.println(clock.dateFormat("m.d.y|H:i:s", dt));
      If you have any ideas about this, it will be very helpful! Thanks a lot!

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว

      Is it possible that it is the same memory problem that I descried for oled displays. So the rtc library plus liquid cristal library together consume too much memory. Try to remove from code lcd part and see if then serial.print works

  • @am1manTravel
    @am1manTravel 10 หลายเดือนก่อน

    Thank you. I used the code "OLED clock using DS3231 RTC module with the memory problem fix" and it worked! Is there a way I can change the temp from C to F? More importantly, it does not keep time when unplugged from power even though I have a fresh battery in the RTC. Any ideas?

    • @am1manTravel
      @am1manTravel 9 หลายเดือนก่อน

      I fixed the time issue! still looking to change C to F.

    • @marios_ideas
      @marios_ideas  9 หลายเดือนก่อน

      This should be a simple formula to be applied to a variable storing celcius value . Temperature in degrees Celsius (°C) = (Temperature in degrees Fahrenheit (°F) - 32) * 5/9.

  • @flameshine2207
    @flameshine2207 2 ปีที่แล้ว

    I want to know how to make a clock by using u8g2 library, how to set address for oled screen?

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว

      I do not know that library but I have some projects in the pipeline that will use OLED displays. If I like this library I may use it and do a small tutorial on it

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

    "Ds3231 clock redeclared as different kind of symbol" this type of message shows when tried to upload the sketch. Please help me in this regard. All libraries has been downloaded.

    • @davidcircuity6473
      @davidcircuity6473 11 หลายเดือนก่อน

      I get the same error on ESP32, this seems to be an error with a separate clock library. The compilation error "redeclared as different kind of symbol" typically occurs when you have conflicting declarations or naming issues in your code. In this case, it seems that you have a naming conflict with the symbol 'DS3231 clock'. Perhaps this is due to a separate clock library we have loaded. ...but if so which library is causing the problem?

    • @sapitron
      @sapitron 4 หลายเดือนก่อน

      this error happens because there are two different libraries with the same name, "DS3231", one by andrew wickert and the other one by Korneliusz Jarzebski. this last one is used in the present video. uninstall the other one. the author of the video seems to be unaware of this problem.

  • @am1manTravel
    @am1manTravel 9 หลายเดือนก่อน

    Can I find/call this up on WOKWI?

    • @marios_ideas
      @marios_ideas  9 หลายเดือนก่อน

      WOKWI?

    • @am1manTravel
      @am1manTravel 9 หลายเดือนก่อน

      @@marios_ideas Oh, I thought that is how you made the diagram around 7:47. WOKWI is an arduino simulator- I'm new to it.

  • @vijithcv
    @vijithcv 2 ปีที่แล้ว

    while running the library DS3231 SIMPLE code , there is no time displayed in the Serial monitor. The code shows no error but while printing the output in the serial monitor, there is an empty space. hence current date or time is not displayed.

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว

      Having you checked if the device is recognized by i2c bus. Look for the i2c scanner code and run it. It will show you if the module is visible and under which address

    • @vijithcv
      @vijithcv 2 ปีที่แล้ว

      @@marios_ideas its not the device issue. Seems some issue with the library. I am able to run the DS3231_simple code of that lib under examples and i get the date and time under Serial Monitor. But when running the DS3231_DATEFORMAT code its not giving any output and gives only blank spaces in the Serial Monitor

    • @vijithcv
      @vijithcv 2 ปีที่แล้ว

      @@marios_ideas it was a bug in the library. In the Github page updated library file is there. After downloading that the issue is resolved

  • @sapitron
    @sapitron 4 หลายเดือนก่อน

    the "redeclared as different kind of symbol" error happens because there are two different libraries with the same name, "DS3231", one by andrew wickert and the other one by Korneliusz Jarzebski. this last one is used in the present video. uninstall the other one (which is much more popular and available at the online repository). the author of the video seems to be unaware of this problem.

    • @marios_ideas
      @marios_ideas  4 หลายเดือนก่อน

      At the time of vide creation I had to install the library. So at this stage I chose which one I want to install. If you installed one before and then decide to use Jarzembski's library it is clear that you have to remove the library that has the same name as both cannot coexist. I have never run into this problem as I have never installed the other library to start with. Later I experimented with both but that was after i created this video

  • @mominkhadri8062
    @mominkhadri8062 2 ปีที่แล้ว

    you have not shared your second code, i dont have mega, will you plz send your second custon fuction code.

    • @mominkhadri8062
      @mominkhadri8062 2 ปีที่แล้ว

      first one does not run in nano or arduino

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว

      In create.arduino.cc/projecthub/mdraber/tutorial-on-how-to-use-ds3231-rtc-module-e12b38?ref=user&ref_id=1474727&offset=6 there are both codes provided

    • @mominkhadri8062
      @mominkhadri8062 2 ปีที่แล้ว +1

      @@marios_ideas thank you so much i got it !!!, what changes should i make in the 2nd code to show 12 hr format?

    • @deniker1
      @deniker1 2 ปีที่แล้ว

      @@mominkhadri8062 I want a 12 hr code I've been pulling my hair all day

    • @mominkhadri8062
      @mominkhadri8062 2 ปีที่แล้ว +1

      @@deniker1 same here bro

  • @mariuspetcu7482
    @mariuspetcu7482 2 หลายเดือนก่อน

    Hello mate , I have more than 7 weeks since I am trying to reproduce you clock example but for life of me , I can't get rid of """error: no matching function for call to 'DS3231::DS3231()' DS3231 clock; """ ...
    Can You guide me or explain in simple words (for newbies like me - LOL) where it came from / why / where should I look ? ... I've being reading / watching tones of explanations but none of them sims to work so PLEASE , do You have a solution for this ? ... Thank You for all you hard work and for sharing with us ... Bless You

    • @marios_ideas
      @marios_ideas  2 หลายเดือนก่อน

      have you intealled the library?

    • @mariuspetcu7482
      @mariuspetcu7482 2 หลายเดือนก่อน

      @@marios_ideas Thank You for the answer ...
      Yes , the one you provide it , and I put it here :
      """ C:\Program Files (x86)\Arduino\libraries """
      - could be / has to be installed in another place ? ...
      - it is possible to be in conflict with other libraries that already installed ? ...
      THANK You

    • @mariuspetcu7482
      @mariuspetcu7482 2 หลายเดือนก่อน

      oled_clock_using_ds3231_rtc_module_:11:8: error: no matching function for call to 'DS3231::DS3231()'
      DS3231 clock;
      ^~~~~
      In file included from E:\Download_NOU_Mar_2020\New folder\oled_clock_using_ds3231_rtc_module_\oled_clock_using_ds3231_rtc_module_.ino:7:0:
      C:\Program Files (x86)\Arduino\libraries\DS3231/DS3231.h:80:3: note: candidate: DS3231::DS3231(uint8_t, uint8_t)
      DS3231(uint8_t data_pin, uint8_t sclk_pin);
      ^~~~~~
      C:\Program Files (x86)\Arduino\libraries\DS3231/DS3231.h:80:3: note: candidate expects 2 arguments, 0 provided
      C:\Program Files (x86)\Arduino\libraries\DS3231/DS3231.h:77:7: note: candidate: constexpr DS3231::DS3231(const DS3231&)
      class DS3231
      ^~~~~~
      C:\Program Files (x86)\Arduino\libraries\DS3231/DS3231.h:77:7: note: candidate expects 1 argument, 0 provided
      C:\Program Files (x86)\Arduino\libraries\DS3231/DS3231.h:77:7: note: candidate: constexpr DS3231::DS3231(DS3231&&)
      C:\Program Files (x86)\Arduino\libraries\DS3231/DS3231.h:77:7: note: candidate expects 1 argument, 0 provided
      oled_clock_using_ds3231_rtc_module_:12:1: error: 'RTCDateTime' does not name a type
      RTCDateTime dt;
      ^~~~~~~~~~~
      E:\Download_NOU_Mar_2020\New folder\oled_clock_using_ds3231_rtc_module_\oled_clock_using_ds3231_rtc_module_.ino: In function 'void setup()':
      oled_clock_using_ds3231_rtc_module_:24:11: error: 'class DS3231' has no member named 'setDateTime'; did you mean 'setTime'?
      clock.setDateTime(__DATE__, __TIME__);
      ^~~~~~~~~~~
      setTime
      E:\Download_NOU_Mar_2020\New folder\oled_clock_using_ds3231_rtc_module_\oled_clock_using_ds3231_rtc_module_.ino: In function 'void loop()':
      oled_clock_using_ds3231_rtc_module_:42:3: error: 'dt' was not declared in this scope
      dt = clock.getDateTime();
      ^~
      oled_clock_using_ds3231_rtc_module_:42:14: error: 'class DS3231' has no member named 'getDateTime'; did you mean 'getTime'?
      dt = clock.getDateTime();
      ^~~~~~~~~~~
      getTime
      oled_clock_using_ds3231_rtc_module_:51:27: error: 'class DS3231' has no member named 'dateFormat'
      display.println(clock.dateFormat("l", dt));
      ^~~~~~~~~~
      oled_clock_using_ds3231_rtc_module_:56:25: error: 'class DS3231' has no member named 'dateFormat'
      display.println(clock.dateFormat("M jS Y ", dt));
      ^~~~~~~~~~
      oled_clock_using_ds3231_rtc_module_:61:27: error: 'class DS3231' has no member named 'dateFormat'
      display.println(clock.dateFormat("H:i", dt));
      ^~~~~~~~~~
      oled_clock_using_ds3231_rtc_module_:66:25: error: 'class DS3231' has no member named 'dateFormat'
      display.println(clock.dateFormat("s", dt));
      ^~~~~~~~~~
      🤣😭😥😳

    • @marios_ideas
      @marios_ideas  2 หลายเดือนก่อน

      @@mariuspetcu7482Remove the library from that folder and then install the zip file through Arduino IDE. Make sure you use the exact library from the link. There are various libraries with the same name in the net. So remove all libraries reffered to ds3231 and then install the right library again

    • @mariuspetcu7482
      @mariuspetcu7482 หลายเดือนก่อน

      @@marios_ideas Thank You for the answer mate ... I will do that and post back the result ...

  • @nikodemkarcz310
    @nikodemkarcz310 2 ปีที่แล้ว

    Are the new version now? I did exactly the same code but it doesn’t work

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว

      What exactly does not work

    • @nikodemkarcz310
      @nikodemkarcz310 2 ปีที่แล้ว

      „RTCDateTime does not name a type

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว

      Nikodem Karcz so do you have an error when compiling? Can you paste the line of code and an error

    • @marios_ideas
      @marios_ideas  2 ปีที่แล้ว

      Did you install the libraries?

    • @nikodemkarcz310
      @nikodemkarcz310 2 ปีที่แล้ว

      @@marios_ideas yup

  • @MrTutitoto
    @MrTutitoto 3 ปีที่แล้ว

    Nano Every with 6KB of sram or the MKR Zero with 32KB of sram

    • @marios_ideas
      @marios_ideas  3 ปีที่แล้ว

      Thanks. Is Nano Every recognised by Arduino IDE as Nano, How do I connect the other board to Arduino IDE

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

    everything works fine, but when I disconnect the arduino from the PC, wait a few minutes, connect it again, Time starts from the moment where I cut off the power.
    Where is the fault hardware or software?

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

      no battery or dead battery in the RTC?

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

      @@marios_ideas Seems like I have the same issue. I checked the battery and it was full.

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

      @@donzhu4996 I must be the hardware. Software is just reading the time from the RTC. The problem I had once was the time was always reset to the particular time after restart, and the solution was that there was a line in the code that was setting the particular time. But this is not the case you guys have here

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

    Me too, the link to components and code does not work.

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

      The site where I was storing the code was uprgading and it invalideated all my links. I have moved to hackster.io. Let me know if this works for you

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

    I can't find the code. The link doesn't work ⛔

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

      I will fix it soon. It is the fault of the website i store the code on. They modernised it and it invalidated some of the links

  • @PolyGameDev
    @PolyGameDev 4 หลายเดือนก่อน

    9:30 DS3231 clock not working.

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

    SImple! ESP32!!!!! 512Kb of RAM!

  • @michelforget3638
    @michelforget3638 3 ปีที่แล้ว

    esp32

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

    Clock time size is (2), seconds text size is (2)…..But they are Not displayed as the same size…where is the catch ?

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

      Ups....:) You just spotted the error in my video. I updated the link to the code in the description. There you will find the actual code that was used to achieve the result you see in this video.

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

    Not push button