Introduction: Crazy Countdown Timer
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
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
5v - button - A5 - 10k resistor - gnd
5v - red jumper wire - A4 - 10k resistor - gnd
5v - blue jumper wire - A3 - 10k resistor - gnd
5v - yellow jumper wire - A2 - 10k resistor - gnd
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).
Step 4: Adding an External Action
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!