How to use DS3231 RTC module to build OLED clock

Поделиться
HTML-код
  • Опубликовано: 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
    ------------------------------
  • НаукаНаука

Комментарии • 81

  • @yogenrai5651
    @yogenrai5651 Месяц назад

    Thank you so much sir for showing little details and explaining because of mentors like you the world is a better place

  • @mywschool8910
    @mywschool8910 2 года назад

    This tutorial helped me a lot. Many thanks man

  • @geertborloo
    @geertborloo 5 месяцев назад

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

  • @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

  • @PekaVuite
    @PekaVuite 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 😁)

  • @agaldoo
    @agaldoo Год назад +2

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

  • @ArkhaanX
    @ArkhaanX 3 года назад

    Thank you.

  • @billferner6741
    @billferner6741 2 месяца назад

    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.

  • @charandas6162
    @charandas6162 2 года назад

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

  • @am1manTravel
    @am1manTravel Год назад

    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 Год назад

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

    • @marios_ideas
      @marios_ideas  Год назад

      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.

  • @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

  • @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

  • @sapitron
    @sapitron 6 месяцев назад

    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  6 месяцев назад

      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

  • @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 Год назад

      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 6 месяцев назад

      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.

  • @watosmate8935
    @watosmate8935 25 дней назад

    Use quite a bit of memory to add an alarm and to manually change it wouldn't it?

    • @marios_ideas
      @marios_ideas  24 дня назад +1

      Well the majority memory is used for OLED display buffer. With very little memory nano has to offer any library consuming slightly more memory can cause the bottleneck

  • @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

  • @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

  • @am1manTravel
    @am1manTravel Год назад

    Can I find/call this up on WOKWI?

    • @marios_ideas
      @marios_ideas  Год назад

      WOKWI?

    • @am1manTravel
      @am1manTravel Год назад

      @@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.

  • @priyaop5040
    @priyaop5040 2 года назад

    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  2 года назад

      no battery or dead battery in the RTC?

    • @donzhu4996
      @donzhu4996 2 года назад

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

    • @marios_ideas
      @marios_ideas  2 года назад

      @@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

  • @mominkhadri8062
    @mominkhadri8062 3 года назад

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

    • @mominkhadri8062
      @mominkhadri8062 3 года назад

      first one does not run in nano or arduino

    • @marios_ideas
      @marios_ideas  3 года назад

      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 3 года назад +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 3 года назад

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

    • @mominkhadri8062
      @mominkhadri8062 3 года назад +1

      @@deniker1 same here bro

  • @nikodemkarcz310
    @nikodemkarcz310 3 года назад

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

    • @marios_ideas
      @marios_ideas  3 года назад

      What exactly does not work

    • @nikodemkarcz310
      @nikodemkarcz310 3 года назад

      „RTCDateTime does not name a type

    • @marios_ideas
      @marios_ideas  3 года назад

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

    • @marios_ideas
      @marios_ideas  3 года назад

      Did you install the libraries?

    • @nikodemkarcz310
      @nikodemkarcz310 3 года назад

      @@marios_ideas yup

  • @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

  • @michelforget3638
    @michelforget3638 3 года назад

    esp32

  • @mariuspetcu7482
    @mariuspetcu7482 4 месяца назад

    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  4 месяца назад

      have you intealled the library?

    • @mariuspetcu7482
      @mariuspetcu7482 4 месяца назад

      @@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 4 месяца назад

      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  4 месяца назад

      @@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 3 месяца назад

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

  • @PolyGameDev
    @PolyGameDev 6 месяцев назад

    9:30 DS3231 clock not working.

  • @DuduHN2009
    @DuduHN2009 Год назад

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

  • @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