How to use DS3231 RTC module to build OLED clock

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ม.ค. 2025

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

  • @yogenrai5651
    @yogenrai5651 7 หลายเดือนก่อน +2

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

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

    This must be the best video on clock to oled I have seen to date, thanks!!!!

  • @geertborloo
    @geertborloo 11 หลายเดือนก่อน +1

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

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

      Glad you liked it

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

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

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

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

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

    This tutorial helped me a lot. Many thanks man

  • @sibaramdatta5625
    @sibaramdatta5625 2 ปีที่แล้ว +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 ปีที่แล้ว +1

      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 3 หลายเดือนก่อน

    Mario, old friend, I made this about a year ago and just fired it up again the other day. Still keeping good time! So I decided to tweak the sketch so it would show in Fahrenheit. No problem. Then I need to slightly move some of the digits, etc. Thought I'd better update my Libraries too. Did that and then troubles! Getting error msgs when I tried to validate the sketch. Had to change "clock" to "clock1" and then got other errors about RTC, etc. So now the OLED looks ok but every time I plug it in it just goes back to the same time and date every time. Tried many different tweaks in the sketch but no go. I think something happened when I updated my Libraries. Checked the battery in the DS3231 and it is fine.
    Perhaps , if you would be so kind, you could go back and update it. Would be most appreciated.
    By the way, I don't remember when I got the "OLED clock using DS3231 RTC module with the memory problem fix" mentioned in an earlier comment a year ago.

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

      Paste the setup function from the code you are trying to load

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

      @@marios_ideas Is this what you want? Also getting error: 'RTCDateTime' does not name a type; did you mean 'DateTime'?
      void setup() {
      Serial.begin(9600);
      Clock1.begin();
      // Set sketch compiling time
      Clock1.setDateTime(__DATE__, __TIME__);
      // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
      if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
      Serial.println(F("SSD1306 allocation failed"));
      for (;;); // Don't proceed, loop forever
      }
      display.display(); // Display initial Adafruit logo
      delay(2000);
      // Clear the buffer
      display.clearDisplay();
      display.display();
      }

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

      @@am1manTravel You said you loaded the code after you upgraded library and the clock does not work. But now you say you get compile error so you couldn't load the code with error in code. Also the library I was using in this code is an old library which is not further developed so where did you get the update. There are other libraries written by other people with the same name so maybe you installed different library

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

      @@marios_ideas Well, I think I fixed the multiple DS3231 libraries and got the one you recommended, the latest version, in there. Still the same problem with the time.

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

      Sorry for all the msgs. Think I fixed it with ChatGPT help.
      Uncomment the clock1.setDateTime(__DATE__, __TIME__); line.
      Upload the sketch to set the time to the current compilation time.
      Comment out the clock1.setDateTime(__DATE__, __TIME__); line again.
      Re-upload the sketch so it doesn't reset the time every time it powers on.

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

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

    Great video. Thank you.

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

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

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

      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

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

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

    • @marios_ideas
      @marios_ideas  7 หลายเดือนก่อน +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

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

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

    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.

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

    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  3 ปีที่แล้ว +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 3 ปีที่แล้ว

      @@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  3 ปีที่แล้ว

      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

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

    Nice and detailed

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

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

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

    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  3 ปีที่แล้ว

      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 3 ปีที่แล้ว

      @@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 3 ปีที่แล้ว

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

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

    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  10 หลายเดือนก่อน

      have you intealled the library?

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

      @@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 10 หลายเดือนก่อน

      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  10 หลายเดือนก่อน

      @@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 9 หลายเดือนก่อน

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

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

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

    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  ปีที่แล้ว +1

      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

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

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

    Thank you.

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

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

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

  • @leohamelinck3524
    @leohamelinck3524 22 วันที่ผ่านมา

    'DS3231 clock' redeclared as different kind of symbol Please help me: This is the error I get

    • @marios_ideas
      @marios_ideas  22 วันที่ผ่านมา

      Have you nstalled the proper library. There are few libraries you can download with the same name. It has to be this particular one

    • @leohamelinck3524
      @leohamelinck3524 17 วันที่ผ่านมา

      @@marios_ideas How do I recognize the right library?
      And how do I find the wrong libraries
      Greetings Leo

    • @marios_ideas
      @marios_ideas  17 วันที่ผ่านมา

      @@leohamelinck3524 in my video there is screen where you see the author of this library. Use it when you google it

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

      @@marios_ideas Hello Mario, I have that library in my folder. I also deleted all DS3231 libraries. and downloaded the correct library and copied it into the library file. Unfortunately that doesn't help. The "error" unfortunately keeps coming back. I don't understand it!

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

      Try DS3231 rtcClock; // Use rtcClock instead of clock

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

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

    esp32

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

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