im floored that this works as expected. I have been bouncing between so many videos and tutorials lately that are garbage. This works perfectly and right away. Thank you for your effort.
This is a masterclass 😎. You explain everything, which is very useful for a beginner like me, your explanations are clear, your code is clear etc... It's the best tutorial on RU-vid to do this project, and I'm really happy to have found it : ) (I had spent one hour to try to understand other tutorials ...) Thank you so much : )
great project for board games by time, one question is the display of the segments is common anode or cathode? .Another question, is it possible to change pins 16 and 17 to pins 0 and 1 of an arduino and change pin 15 speaker to an analog pin ?, if we change it in the code? I want to make a timer for board games that need some time to perform the goal and use an arduino nano, thanks friend
I answer myself because I just tested it, the first question was common anode, and if you can change the pins so that it runs on arduino uno, you can use the analog inputs and make them outputs. Put the buzzer pin on pin1 that was free, button 3 on pin 0 and button 4 on A5. You have to declare it (int button4 = A5;) in the void setup (pinMode (A4, OUTPUT); so you can use the A0 A1 A2 A3 A4 and A5 of the arduino uno as outputs.
@@55dj55nava Thanks Antonio for testing this out! I am sure that it will be helpful for others. Sorry - I did not look into this page for some time and missed your question
@@55dj55nava Hi Antonio, I think you mentioned that you developed a 3d printed case that may work for this project. I can certainly add a link to it at the project site.
thanks for this, now i created my version of this instead of start reset up down button ..i made the start/stop ..anytime you want to stop the count it will stay the same number and thats the only time you can reset the counter... if the counter running no button will function aside from the start/stop button...
in 10:41 i'm also getting the same digits in multiple positions, in my case, it's 3. I wasn't able to understand how that works, like what does he mean by turning digit 1,2,3 and 4 on and off? pls help
Not sure if you are still keeping up with this. I wanted to add 30 sec while the timer is counting down when I push the button, will this code work close to what I need? Would greatly appreciated your help.
Hi Dmytro, i stumbled upon this tutorial as this is the sort of project that i am looking for as a begginer. One thing i may ask is how to add a code to Pause the timer with the Start button (or essentialy making it a Start/Pause button)? Looking forward to your reply. Thank you.
Awesome build ! is it possible to make it Up and Down counter ? ( you set your time ( ex 60 secs), press UP button or Down button then START it will count from 0 to 60 or 60 to 0 )
For me the digital display goes crazy and the Arduino no longer functions after only a little while of using it. Resistors didn't work. The only solution I think might work is to unplug the Arduino from the USB connection with the PC. Is this a common issue with Arduino, to have to unplug it?
hey i wonder if you are able to do the same but without the reset button , instead of buzzer there is LED diode and instead of 4 digit with 1 and all of that on Arduino UNO i just need to know a few tips about the code
When I turn it on and i try to up the time it just shows a line on every digit and i cant control anything, it wont start or show any numbers. any idea on what i should try fixing?
hey liked. But is it possible to do it like minute/second? i mean if wanna countdown from 25min how will i do it? (btw i know i can convert minutes to second but thats hard way)
I am currently using an Arduino DUE board and I have issues with your code for some reason, whenever I run the code, all the segments of the lights turns on making it hard to see the number whenever I upload the code into the board.
Is there a difference in brightness between the digits that are supposed to be lit and those that are not supposed to be lit? There were multiple reports that some light "bleeds" to other segments, but that seemed to be a hardware issue.
@@dsavchuk1 they all bright up but some of the segments is slightly brighter than some of the other segments. It is very hard to see the numbers or it might be like you said the hardware.
@@AeyZeiNS I'm sorry - I'm afraid that this not about the code, but about hardware, unfortunately. I'd try to check all the connections, but I assume that you've done this already.
@@AeyZeiNS if u still want it, on top change define DIGIT_ON LOW to HIGH and DIGIT_OFF HIGH to LOW and then in every case from 0-10 change SEGMENT_OFF to ON and OFF to ON its working for me
Thanks! Everything can be done - but the code has to be modified significantly, of course. The one in the project deals with the physical buttons. But several functions can be used.
@@dsavchuk1 I want to dose a manual coffee grinder by timing. In fact, I want to do Single espresso with a button, for example 4 sec. Double espresso, for example 8 seconds, with a button. however, since these times vary according to the size of the coffee bean, the moisture content in it, and the temperature of the gears of the mill, I have to intervene in the time. so I want to be able to change these times easily with a smart device android phone. This is actually what I'm trying to do.
@@dsavchuk1 You are absolutely right. Bluetooth is a great way to streamline the user interface in automation systems. Wireless is definitely important. I look forward to it with great impatience.
I am not sure if this setup can be done with 13 pins. There are more connections to be made in the scheme with the selected hardware. However, you can try to use TM1637 display that only needs 4 pins (see, for example, create.arduino.cc/projecthub/ryanchan/tm1637-digit-display-arduino-quick-tutorial-ca8a93). But then you will need to modify the code significantly too.
For some reason mine will just start counting down instantly and clicking reset will make it just go back to 60 and start counting again. Pressing + and - do nothing. Can someone help me?
Aside math.h, no other library is needed. And there is a way to go around math.h if needed as described in another comment. It also should work on Arduino Uno as well, but you may need to change the pins as the number of digital pins in UNO is one less than I used in this project in MEGA. You may try to use analog pins instead. If it will not work for the buttons, you can probably use them for segments to free up some digital pins. One of them is analog anyway, so it should work, I guess. For example, you can assign "int segF = A1;" and use digital pin 7 for the reset button. If this does not work, you can simply use pin 6 that currently corresponds to the first digit of the display. Then the countdown will be limited to 999, but still gives you something. Then you would need to change the first line of SwitchDigit function to "for (int i=1; i
hello...is there any way to make the start as both start and stop button? looking forward for your reply and highly appreciated it...thanks...more power
lightNumber (dig.digit [j]); I am blocked at this level I have an error: sketch_apr17a: 277: 3: error: expected declaration before '}' token } ^ exit status 1 'struct struct_digits' has no member named 'Digit'
Thank you very much for this very interesting project. I used an Arduino uno so I had to make some little changes, but now it works fine all except the fact that the first digit always shows the value of the forth although in a dimmer way. I also had to define digit_on High and segment_on LOW. To use the countdown for minutes instead of seconds I have changed the line 215 in: void PrintNumber(int n, unsigned int time) { unsigned int allowes values from 0 up to 65535 so it's possible to set the countdown_time in the loop to the value 59968 you suggested in a reply to a question. So, could you please help me with my problem of the digits? Thank you in advance
@@tanggooo I had to change some pins as you can see from the ide I used: drive.google.com/file/d/1BbM65IB5-t7GQVdbI71rUYhrAz3Cfh5p/view?usp=sharing I also had to change: #define DIGIT_ON LOW // per un display con catodo in comune (for a display with common cathode) #define DIGIT_OFF HIGH in: #define DIGIT_ON HIGH // per un display con anodo in comune (for a display with common anode) #define DIGIT_OFF LOW Moreover, to use the countdown for minutes instead of seconds, I changed the PrintNumber this way: void PrintNumber(int n, unsigned int time) { and in the loop: while (!Countdown(countdown_time, 59002)) { // instead of the 59962 suggested
Hi guys. I'm a complete nuffie and looking for some help to build something similar - a countdown timer which can be manually pre-set with a specific time (H:MM:SS best case, otherwise need a minimum display of :SS) to countdown to 0. No alarm attachment is required, simply flash 0 a few times, then auto power off. I am looking to set up MULTIPLE (probably 3) SEPARATE displays simultaneously counting down the timer with a separate control board (set, reset, power or up/down etc) to be control from one central location (different area to where timer displays will be set up. These displays will be embedded into a table surface. Can someone help me put this together?
Maybe something like this will work for you: create.arduino.cc/projecthub/mattywausb/one-kitchen-timer-to-cook-it-all-1afdab?ref=search&ref_id=countdown%20timer&offset=10
i been at your situation but i tried to managed the issue I just transfer the start button at other pin because i think the pin 13 is also the pin use for the LED built in the arduino board, i transfer it and i changed at the set up instead of INPUT_PULLUP I changed it to just INPUT but the wiring also changed from Positive to button and button to the pin location...but i put a resistor from the pin to ground to prevent unnecessary noise....hope it will help...
I want to add a relay on position when the countdown is started and relay will off when countdown is finished, so what I have to do will you tell me . And thanks for your project .👍👍👍🇧🇩
@@bomboba6191 Yes, There was a small bug in the code..I had fixed that but forgot what I fixed. Thats was about 7 segment.I used common anode display..For that .... #define DIGIT_ON HIGH #define DIGIT_OFF LOW #define SEGMENT_ON LOW #define SEGMENT_OFF HIGH This will work...For common cathod you have to change High to Low. Now 2nd one... For relay take a variable int LEDPin =3;(You can take any pin and variable you want like Relaypin) at void setup pinMode (LEDPin,output); Now don't copy everything...I have changed many things..Just look where I used digital write LEDPin.. bool Countdown(int n, int del){ for (int q=n; q>0; q--){ PrintNumber(q,del); digitalWrite(LEDPin, HIGH); if (digitalRead(button2)==LOW) { return false; } } digitalWrite(LEDPin, LOW); PrintNumber(0,0); playTone(150,350); return true; } void reset() { int m, zeros, d, pressed3 = 0, pressed4 = 0; m=countdown_time; struct struct_digits dig; dig = IntToDigits(countdown_time); digitalWrite(LEDPin, LOW); while (digitalRead(button1)==HIGH) { for (int j=0; j 20) { if (countdown_time > 0) { countdown_time -= 1 ; } dig = IntToDigits(countdown_time); } pressed4 += 1; } else if (digitalRead(button3)==LOW) { if (pressed3 == 0 || pressed3 > 20) { if (countdown_time
I did not install it manually and "#include " was enough for me. What chip do you have? There are some limitations according to www.arduino.cc/en/math/h They also have a reference to avr-libc library that probably can be installed if math.h is not found automatically. I only use that library for a function pow to compute 10^i, which may be an overkill. If installing a library does not work, you can add the following function: int pow10(int n) { int x=1; for(int i=0; i
@@mantamang6452 It looks like this is a problem you have to solve on your side: support.arduino.cc/hc/en-us/articles/360020843439-Error-2-UNKNOWN-no-FQBN-provided
In line 289 of the code replace 962 by 59,968 and check if you get exactly minutes. You may need to adjust this number a bit to be more accurate. For example, after you do this modification, measure how long does it actually take for the timer to go down from 10 to 0. If it's a bit less than 10 minutes, increase that number a bit.
@@dsavchuk1 first off, awesome project! I'm trying to implement the changes you described to make it go by minutes, but the max value allowed in that function is "32000". 33,000 - thus 59,969 - automatically set off the buzzer. Any ideas or something else I need to change?
Well, this is because it takes roughly 38 milliseconds for arduino to complete the rest of the code per cycle. This, of course, can be done better for better accuracy, but I believe it will make the code more complicated. So this is kind of a compromise.