![Duranio Labs](/img/default-banner.jpg)
- Видео 4
- Просмотров 22 503
Duranio Labs
США
Добавлен 4 окт 2019
Welcome to Duranio Labs! A channel dedicated to creativity using the medium of electronics.
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
Link to breadboard layout and Arduino sketch: github.com/DuranioMakes/DS3231_RTC_SQW_1Hz_Interrupt
Просмотров: 13 592
Видео
Easy Way to Cut and Solder Jumper Wires
Просмотров 8 тыс.3 года назад
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
Просмотров 2933 года назад
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
Просмотров 5873 года назад
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...
Thank you. Clear as sky
You're very welcome
Nice work!
Great tip. Now i am using this technique.
Arduino se 3231 को। केसा बताऐ। ओर बेकीग। करे।
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.
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?
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
Great technique, thanks for sharing!
Hi, thank you for the tutorial How can i edit the sketch to run on a Mega?
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).
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.
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.
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).
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 .
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?
Very useful information about interrupts. I believe that's the best way to use this module.
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
@Cedric Lessard - The transistors are N-Channel enhancement FETs, part number ZVN4206A. Have fun!
Hello, can you please share a better scheme picture of the breadboard components?
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.
@@DuranioLabs thank you for replying, I made some kind of sketch in Tinkercad and managed to understand your circuit
@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
Thank you for sharing!
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?
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.
@@DuranioLabs Thank you, I tried it and seems to have worked. I use SQWinput to trigger the alarm, but otherwise works fine.
@mihaisor Glad that worked!
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.
Very intersting! I checked out your channel and also found further information on GitHub.
Very good projack i made dice
Great! I'm glad you found this video useful. Stay curious and keep experimenting!
Hi, can you share pictures?
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
Useful info for my project, thanks!!
Glad it was helpful!
What is the DEC variable in the code for?
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!
@@DuranioLabs thank you so much for replying! I been trying to understand this part for a while, thank you!
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.
@Vitaliy Reznikov - Great! I'm glad you found this video usefull. Happy programming!
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?
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!
Nice info sir, but can we calculate the RTC DS3231 to get the time in millisecond?
*calculate = set
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.
@@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
@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: ruclips.net/video/qn8SP93L3iQ/видео.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.
@@DuranioLabs Got it! I'll try with milliseconds. Thx for the explanation sir! Really apreciate it!
Thanks for your video on use of interrupt. Could you post a link to your modified sketch?
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!