Duranio Labs
Duranio Labs
  • 4
  • 21 536
Easy Real Time Clock Interrupt - How to Use the DS3231 SQW Pin
In this video, I'll be talking about the DS3231 real time clock. Specifically, I'll explain how to use the square-wave output from the real time clock as an external interrupt signal for the Arduino to refresh its date and time settings once every second.
Link to breadboard layout and Arduino sketch: github.com/DuranioMakes/DS3231_RTC_SQW_1Hz_Interrupt
มุมมอง: 13 027

วีดีโอ

Easy Way to Cut and Solder Jumper Wires
มุมมอง 8K3 ปีที่แล้ว
In this video, I demonstrate an easy way to cut and strip solid wire, especially short lengths. I also share a tip on how to simplify the placement and soldering of a jumper wire to a circuit board.
Part 2- Create Two LED Dice with Arduino
มุมมอง 2843 ปีที่แล้ว
Welcome to the second part my two part video series on designing a pair of LED dice using an Arduino! In part one I showed you how I used display multiplexing to control 14 LEDs with only 9 Arduino pins. In this video, I'll be stepping through the Arduino sketch, explaining in detail how the Arduino is programmed. A copy of this Arduino Sketch (program) can be accessed at: github.com/DuranioMak...
Part 1- Create Two LED Dice with Arduino
มุมมอง 5633 ปีที่แล้ว
Welcome to part one of my two part video series on designing a pair of LED dice using an Arduino! In this video, I'll show you how I configured the Arduino Uno to control all 14 LEDs using only 9 Arduino pins. In part two, I step through the Arduino sketch, explaining in detail how the random numbers are generated and displayed. A copy of this Arduino Sketch (program) can be accessed at: github...

ความคิดเห็น

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

    Nice work!

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

    Great tip. Now i am using this technique.

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

    Arduino se 3231 को। केसा बताऐ। ओर बेकीग। करे।

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

    Question I am working on a project using this board an I have the components but what I wanna accomplish is I'm doing a traffic light set up using a 4 way intersection an traffic lights going down at each entersection ok so at a certain time I wanna have my yellow/ amber leds on my traffic lights to go on caution at a certain time and then go back to working order after that time is over. So basically the Arduino is still working real time an then going to flash at another time. So let's say working order traffic lights 12pm - 5pm. Then go on caution at 5:05pm and back to working order at 9:00pm.

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

    Thank you 𝘿𝙪𝙧𝙖𝙣𝙞𝙤 for the instruction. Very helpful. A remark though: Your Arduino is now sitting there and waiting for the interrupt trigger and to print out the date. Wouldn't it make sense to include the 𝚍𝚒𝚜𝚙𝚕𝚊𝚢𝚃𝚒𝚖𝚎 routine in the ISR, so that the 𝚕𝚘𝚘𝚙 can take care of other things rather than being trapped in the 𝚒𝚏 (𝙴𝙳𝙶𝙴 == 𝟶) loop? If a longlasting routine would be running in the 𝚕𝚘𝚘𝚙, despite the interrupt, the time would not be updated regularly. Or do you have a specific reason, why you only change a volatile variable in the ISR?

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

      Hello value 1 - So for an interrupt service routine (ISR), the general rule is to keep them as short as possible. They should not contain parameters or routines, such as, "displayTime". It is also recommended that shared variables between the main progrm and ISR are declared as volatile. More information on interrupts can be found here: www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/ and here: gammon.com.au/interrupts

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

    Great technique, thanks for sharing!

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

    Hi, thank you for the tutorial How can i edit the sketch to run on a Mega?

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

      Hi Aubrey - This should be relatively easy. In the Arduino IDE program, you will need to go to "Tools" and then scrool down and select the Arduino Mega you have from the list of options. That should be all you need to do, unless you are using a different Mega pin to monitor the SQW output. If so, you need to change the SQWinput pin in the sketch to match the Mega pin you are using. Make sure it is an interrupt capable pin (2, 3, 18, 19, 20 or 21).

  • @mr.google1463
    @mr.google1463 ปีที่แล้ว

    Great, thank you so much for the video. Sir, my RTC is not sending interrupt while on coin cell but it worked fine on 3.3 or 5V Vcc. can you help me please.

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

      Interesting. I have not tried running the the RTC on the coin celll alone. The DS3231 datasheet mentions a 0.1uF decoupling capacitor should be placed in parallel with the coin cell if it is the primaty power source. I would need to investigate this further.

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

      It's complicated. I tried this yesterday and failed. First RTC is not powered by a coin cell, where there is power on VCC. When you disconnect that power putting it for example on arduino output pin and setting it low, it instantly triggers interrupt cause SQW/INT pin goes from high to high impedance. Then there's a chance that RTC may be powered via data pins.And when I measured current with SDA and SCL disconnect, it was 600uA, whereas with connection to Arduiono, it draws something like 90uA. It's not horrible. Also note there's a BBSQW enable bit in either config or status register (battery backed square wave).

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

    Thank you, great info, useful for my project. .I have design a cock and using pin no 2 Arduino uno for segment A can i use pin no 12 for sqw pin out for secnd showing 2 leds and other thing I do no want to use the led conected with SDA pin can i remove it .

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

      Hello Sukhbir Singh - You can remove the LED connected to the SDA pin with no problems. It is not required. If I am understanding your other question about pin 12, you should be able to drive a second LED with it as long as you use a 220 or 330 Ohm resistor. It sounds like you want to light this LED every second?

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

    Very useful information about interrupts. I believe that's the best way to use this module.

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

    hey great video!! just wondering if the transistors are depletion type or enhancement type? I'm trying to find some to use to make the project

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

      @Cedric Lessard - The transistors are N-Channel enhancement FETs, part number ZVN4206A. Have fun!

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

    Hello, can you please share a better scheme picture of the breadboard components?

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

      Hello @Denisa Muhut - I think you're looking for a Fritzing drawing showing parts placements. I attempted to draw one but the components are so close together that it's hard to see what is attached where. I will attempt to draw the wiring diagram a different way and post it when ready.

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

      @@DuranioLabs thank you for replying, I made some kind of sketch in Tinkercad and managed to understand your circuit

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

      @Denisa Muhut - Sounds good. I also created a drawing using Fritzing and placed a PNG file in GitHub, called "Dice Roll Wiring 4-17-22(2).png" and placed it in GitHub at this location: github.com/DuranioMakes/ArduinoDice

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

      Thank you for sharing!

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

    Thank you, great info, useful for my project. I do have a question though. your code mentions You are using this to enable pull-up resistor. pinMode(SQWinput, INPUT); digitalWrite (SQWinput, HIGH); Isn't it easier to do a simple pinMode(SQWinput, INPUT_PULLUP); instead?

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

      Good question! I have not tried that. It would be easy to experiment with making that change in the program to see what happens. If no errors are reported, it probably works.

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

      @@DuranioLabs Thank you, I tried it and seems to have worked. I use SQWinput to trigger the alarm, but otherwise works fine.

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

      @mihaisor Glad that worked!

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

    Interesting information shown for makers and have you been following the new JACDAC by Microsoft plug and play USB platform for makers ? See our channel for simulator examples of peripherals to simplify wiring and speed prototyping.

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

      Very intersting! I checked out your channel and also found further information on GitHub.

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

    Very good projack i made dice

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

      Great! I'm glad you found this video useful. Stay curious and keep experimenting!

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

      Hi, can you share pictures?

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

      I created a drawing using Fritzing and placed a PNG file in GitHub, called "Dice Roll Wiring 4-17-22(2).png" and placed it in GitHub at this location: github.com/DuranioMakes/ArduinoDice

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

    Useful info for my project, thanks!!

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

      Glad it was helpful!

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

    What is the DEC variable in the code for?

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

      DEC is for decimal and instructs the Arduino to print the value in decimal (base 10) format. I found that it is redundant and you could just leave it out. For example: Serial.print(now.second(), DEC); can be changed to: Serial.print(now.second()); and it will still work as expected. You can change the DEC to HEX which displays the value in hexidecimal (base 16) just to see what happens. Have Fun!

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

      @@DuranioLabs thank you so much for replying! I been trying to understand this part for a while, thank you!

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

    Thank you so much for so nice example. I have one project with the rtc and in it I have to use interruption because I need to triger Arduino UNO (my master) to read some information from slaves with period 10 seconds. The example help me a lot.

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

      @Vitaliy Reznikov - Great! I'm glad you found this video usefull. Happy programming!

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

    Thank you for sharing this information. I just want to ask you that can we make frequency less than zero like 0.0002 etc in line of code "rtc.writeSqwPinMode(DS3231_SquareWave1Hz)" so that we can have falling edge every hour?

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

      The slowest frequency setting available for the SQW pin is 1Hz but you can accomplish what you want a different way. If your project still requires a real time clock, you can test the state of minutes and seconds and change the state of an Arduino pin when minutes and seconds both equal 00. For example you can add the following lines to the Arduino sketch. 1) At the beginning of the sketch, assign an Arduino pin for the new output signal. const int PIN = 3; // Arduino pin 3 called "PIN". You can rename it if you'd like 2) Within setup, "void setup ()" add the following lines: pinMode(PIN, OUTPUT); //Set the new Arduino pin (pin 3) as an output digitalWrite(PIN, HIGH); //Set the initial output state of PIN as HIGH 3) Within "void displayTime ()" add the following: if (now.minute() == 00 && now.second() == 00){ digitalWrite(PIN, LOW); //If minutes are 00 and seconds are 00, it's the top of the hour so set PIN low } if (now.minute() == 00 && now.second() == 30){ digitalWrite(PIN, HIGH); //After 30 seconds, set PIN high } You can add an LED and 220 Ohm resistor to the output to test the changes. Good luck!

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

    Nice info sir, but can we calculate the RTC DS3231 to get the time in millisecond?

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

      *calculate = set

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

      Good question. The DS3231 does not have resolution below seconds, but a counter could be written in the software to provide counts down to the millisecond, while still being reset every 1,000msec by the 1Hz squarewave.

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

      @@DuranioLabs could u provide the tutorial or the steps? I really have no idea. This is for my final project on university:( i'll be thankful for the tutorial

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

      @DONNY ALI SANJAYA - So I think an even better way to count down to milliseconds with an Arduino is to use the millis() function. The millis() function returns the number in milliseconds since the board began running its program. A description of millis() is here: www.arduino.cc/reference/en/language/functions/time/millis/ And a detailed description of it use can be found here: th-cam.com/video/qn8SP93L3iQ/w-d-xo.html Anyway, I'm not sure if you're building a real time clock or something more like a stopwatch with Arduino. If you need time expressed down to the millisecond, then the millis() function is where you should start.

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

      @@DuranioLabs Got it! I'll try with milliseconds. Thx for the explanation sir! Really apreciate it!

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

    Thanks for your video on use of interrupt. Could you post a link to your modified sketch?

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

      Sure! I just posted the sketch on GitHub along with a copy of the breadboard layout as JPEG and Fritzing files. Here is the link: github.com/DuranioMakes/DS3231_RTC_SQW_1Hz_Interrupt Thanks for watching!