Crazy Countdown Timer

39,766

68

37

Posted in TechnologyArduino

Introduction: Crazy Countdown Timer

About: Hi There! I'm a mobile app developer (iPhone and Android) in British Columbia, Canada. I also write firmware, and enjoy dabbling with electronic circuits and micro controllers. My wife and I own a guest hous...
This is my interpretation of the stereotypical time bomb that you see in so many cheesy action movies. The hero has to figure out which line to cut to stop the timer and keep the bomb from exploding.

In this case, we have 3 wires. One wire stops the timer (yay!), another wire speeds up the timer (panic!), and a third wire sets the timer to zero (uh-oh!).

This instructable is a sequel to my basic clock instructable: https://www.instructables.com/id/Arduino-Clock-using-Standard-Clock-Display/ 
and it is basically a port of a project I did last summer for the XL_Star board from element14.com: http://www.element14.com/community/people/ntewinkel/blog/2011/08/30/the-crazy-countdown-timer-is-complete

The main difference from the basic clock is that I added 3 button inputs that are handled by some jumper wires instead of buttons, and I updated the software.

The software now counts down, check the wire status, and add the required code to do the right thing based on wires cut, as well as adding the final action when the timer hits 0.

Step 1: Parts

For this Instructable, you will need:

1 Arduino (I used an Arduino-nano)
1 LTC-617 clock display (you might need to solder male headers onto it)
many jumper wires
1 button
4 resistors: 10k or close (to prevent short between gnd and 5v on button press, and for the "crazy wires" buttons)
(optionally) Something to make an interesting action for when the clock hits zero.

For me this was a no-cost project as I already had all the parts.
The clock display was part of a grab bag I bought long ago. I imagine they should be very inexpensive and might even be salvageable from old clock radios.
Little buttons and resistors are also salvageable from old electronics (reset buttons from old computers, for example), and also very inexpensive to purchase.
The Arduino starts at around $15 on eBay, though I would expect anyone would be unlikely to ever use it for only just this one project, unless you really do use it with a large amount of explosives ;)

I used a breadboard for easy connections, but that's not necessary.

Step 2: Make the Connections

There are quite a few wires that need to be hooked up, but if you go carefully and double check each line as you hook it up, it should be pretty straightforward. If you have already built the Arduino Clock from my earlier Instructable, you just need to add the 3 crazy wires, and you need to move the button to A5. For the clock I had it on A4, but it makes sense to keep the 3 crazy wires together.

I'm assuming you already know the basics of getting your Arduino going, so I won't get into those details. If not, there are a lot of nice examples online to get you started (I like the ones at oomlout.com).

Here are the connections that need to be made. On the left is the pin of the LTC, on the right is the Arduino pin. For example, LTC pin 4 is connected to Arduino pin digital7. nc means that pin of the LTC is not connected to anything.
For more details on the LTC connections, please refer to my Arduino Clock Instructable: https://www.instructables.com/id/Arduino-Clock-using-Standard-Clock-Display/

The button is connected in the usual buttony way using a pull-down resistor which connects the pin to gnd for LOW, and the button when pressed connects it to 5v for HIGH. As a side effect, pressing the button also connects 5v to gnd, which is why we need that 10k resistor to keep it from being a short.
The Crazy Wires are connected just like the button, with a connected wire being always HIGH as if the button was pressed. I used 2 jumper wires: one m-m and one m-f so that it can be easily disconnected in the middle. The jumper wires connect the pin to 5v, and the pin is also connected with a 10k pull-down resistor to gnd to make it a proper LOW when the main jumper wire is disconnected.

LTC - Arduino
1 - nc
2 - nc
3 - nc
4 - d7
5 - d3
6 - d2
7 - d11
8 - d10
9 - d4
10 - gnd
22 - d9
23 - d5
24 - d6
25 - A0
26 - d8
27 - d12
28 - A1
29 - gnd

button:
5v - button - A5 - 10k resistor - gnd

crazy wires:
5v - red jumper wire - A4 - 10k resistor - gnd
5v - blue jumper wire - A3 - 10k resistor - gnd
5v - yellow jumper wire - A2 - 10k resistor - gnd

Action:
pin D13 is already hooked up to an LED

I didn't have space near the Arduino, so in the picture you'll see that the button is connected through a few extra jumper wires.

Note that pin 1 on the clock display is at the bottom left (the pins are under the display area), and every hole counts, even the ones that don't have any connections. On this LTC display, "pins" 11 to 21 are just holes.

Step 3: Install (upload) the Software

The final step is to download the attached software sketch, and upload it to your Arduino.

That's all there is to it - you now have your very own Crazy Countdown Timer!

You can press the button to set the time. Hold the button down to set it quickly. If you hold it for longer than 5 seconds, it will go 10 times as fast.

The centre hour:minute colon blinks for the seconds when there is more than an hour left on the countdown timer, otherwise it displays minutes:seconds and the colon remains steady.

The software has some comments to help you figure it out, but essentially it keeps track of time by checking the value of millis(), and every time 1000 millis have gone by it counts down by 1 second. Millis() returns the number of milliseconds since startup.
When in panic mode, it counts down 10 times as fast - decrementing the second indicator every 10th of a second.

As with my earlier Arduino Clock Instructable, this won't be as accurate as using a real time clock (RTC), but it's good enough for our countdown timer.

When the timer hits zero, the action right now is to turn on the LED that is already connected to D13 (you can see it light up in the video when I disconnect the red wire). Since the pin will provide 5 volts, you can actually also use it to do other actions, like turning on/off a relay or even running a little sound gadget from an old greeting card, for example. You could also modify the code to do more interesting things - for example, you could connect a speaker or buzzer and use the Arduino Pitches library to make a noise (see the Arduino's built-in Digital-Tone_Melody example).

Enjoy!

Step 4: Adding an External Action

To give an example of an external action, I connected the inside sound bits of a greeting card to the action pin.

It's actually quite easy to do - the Arduino action pin and gnd take the place of the battery, and magically it all works :)

In the video you'll see I soldered 2 header pins to the sound circuit to make it easy to connect. One pin is on the + side of the battery holder, and the other is on the -'ve side.

Connect the + side to pin D13, the action pin.
Connect the - side to gnd.

Now when pin D13 goes on (high) as the timer hits zero, it provides 5 volts to the sound gadget, and viola! Annoying sounds are the price of letting the timer hit zero!

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Woodworking Contest

      Woodworking Contest
    • Make it Move Contest

      Make it Move Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    37 Comments

    Hi. Can you help me to use LTC-637D1P-12S??

    Thanks

    Wow great projet for fun. Thaks for share. I want to change it little bit according to my requirement. Two switch. One for add the 5 min in the timer by press it every time. And other to play/pause the timer. And i will ise tm 1637 digital tube. Will u help me with it?
    Thanks

    I am working on very similar project but I am having issues with the wires not detecting when they have been pulled. I sometimes have to wiggle the wire to get it to "notice" its unplugged. Did you experience this at all? I am going to have less issues if I solder the wires directly into the board?

    I'm trying to figure out how to modify the code so that it starts after a button press- but am not having much luck...any advice? Want to be able to see the display, and adjust the time, but not have it start counting down until I want it to.

    I tried changing the state of the timer_paused variable based on an input, but that didn't do anything, at least not the way I tried to implement it!

    1 reply

    Hi Dave,

    I think you can just do that with a while loop at the top of the loop() function.

    Something like this, assuming you have added a proper start button:

    while (digitalRead(STARTBUTTON) == LOW) {

    clock_show_time(hours, minutes);
    }

    Hope that helps :)

    Cheers,
    -Nico

    I will use the crazy countdown timer but

    we will help me for make the timer with 2 set points
    one timer select by a switch 30 min and 15 min to 0

    I used mega 2560 and it works fine :)

    IMG_20150531_181523.jpg

    Perfect! just perfect my friend, thank you very much, the code works great with no problems, even when i used 4 common cathode displays! i've just changed the code a bit and added some npn transistors but still works great.

    2 replies

    Here is mine construction

    DSCN0503.JPG

    Awesome! Thanks for sharing the pic :)

    Hi, I need to do a timer with a button that start every 30 mins in one push and with other button countdown selected timer; like a coin machine but I dont know how to do

    You could. The clock display I used doesn't have any smarts built-in, so as long as the connections are the same it should all work the same. The tricky thing is that some displays are common anode, and some are common cathode. I forget what this LTC display is, but the code and connections could be changed a tiny bit to make either one work. The trick is that each digit is controlled by a single IO pin.

    Hi,

    Love this! Will do pretty much what I need! Just wondering, can this do hours too?

    1 reply

    Yes, it does hours. If I recall correctly it will show hours:minutes until hours is 0 and then it shows minutes:seconds. And I think when showing hours the dot flashes for every second.

    Nope, sorry. Just a wordy explanation of connections in step 2 ;)
    If you want to create one using Fritzing or something, please share and I'll be more than happy to look it over.