loading
While fooling around with my arduino, I was inspired to make a ticking time bomb like one in movies and cartoons. When a switch is flipped, it counts down from ten on a LED display, beeps at an increasing pace, and lights an electrical igniter or incandescent light when it reaches zero.

This device is intended for theatrical and entertainment purposes only! Do NOT use this for evil.

Step 1: Materials

You will need:

-A two digit LED display
-8 220 ohm resistors
-1 68 ohm resistor
-1 100 ohm resistor
-2N3906 transistor
-TIP31 transistor
-20 male pin headers(optional)
-SPDT toggle switch
-Bolts & nuts/banana jacks/binding posts(you decide, I'll discuss this later)
-A tone buzzer
-A low voltage electrical igniter(optional)
-Perf board
-5 x 2.5 x 2 project box(optional)
-An Arduino
-Power supply for Arduino
-22 gauge hookup wire

The total cost comes to around $8 or $13, depending on whether or not you use the project box.

Also, this design is only capable of lighting a very low power electrical igniter or light. If you want anything that uses more power, you will have to use an external power supply.

Step 2: Testing

If you have ordered the LED display that I did, it should have the same pinout. C1 is the common anode pin for the left digit, and C2 is the common anode pin for the right digit. When positive is connected to pin C1 and negative to pin 1, LED 1 on the LED display would light up. You should make sure that each pin lights the correct LED before proceeding. When testing the device, remember that this display is designed to use 2.2 volts. I used a two AA batteries and a 68 ohm resistor for testing.

Step 3: Build the Circuit

Before soldering the circuit on perf board, you should test it on a breadboard to ensure that everything is connected properly. The code for the Arduino is on the next step.

Cut your perfboard with a dremel or hacksaw so that it fits inside your project box. Begin soldering the circuit onto perfboard once you have tested it on a breadboard. I chose to add male headers to my perfboard so I can plug the board into the Arduino rather than plugging the wires into the Arduino. I think it makes a much neater project in general. The layout of the circuit is left up to you, but I have left a few pictures of my layout if you need some inspiration. Also, if you do choose to use male headers, ensure that the components don't block the Arduino from plugging into your circuit. If you are unsure about this, or anything else, refer to the pictures.

The breadboard test:



A test of the soldered circuit:


Step 4: Build the Enclosure

I used a 5" x 2.5" x 2" project box for my enclosure. I drilled three holes on one of the sides - two for the bolts that held the incandescent light, and one to power the Arduino. Please note that there is no need to use bolts for the light - you could use binding posts, banana jacks, or anything else that you think would work well. I drilled a hole for the switch on the top, and I cut a rectangle out for the LED display with my dremel. You will have to select the drill bit sizes based on what components you use.

I used hot glue to secure the LED display, and used the nut that came with the switch to secure it to the top. I also tightened the bolts on to the side of the enclosure. When I finished, I plugged a power supply into the Arduino, and plugged the circuit board into the Arduino. Once all four screws were in, I was finished with the build.

Step 5: Code

This is the code that you will have to upload to your Arduino. Before you upload, make sure to disconnect all wires from the Arduino's digital pins 0 and 1. The Arduino uses these pins for communication with the computer, and if they are connected to anything, your upload will fail.

Code:

int oneLed = 0; //pin for the leftmost LEDs
int led1 = 1;   //pin numbers for LEDs on the righthand display
int led2 = 2;
int led3 = 3;
int led4 = 4;
int led5 = 5;
int led6 = 6;
int led7 = 7;
int light = 19; //pin for the light/electrical igniter 
int beep = 16; //pin for buzzer
int switchPin = 14; //pin for switch input
int switchState = 0; //variable for storing the state of the switch

void setup( ) {
 
  pinMode(light, OUTPUT);
  pinMode(oneLed, OUTPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(light, OUTPUT);
  pinMode(beep, OUTPUT);
  pinMode(switchPin, INPUT);
}

void loop( ) {
 
switchState = digitalRead(switchPin); //read the state of the switch

//if the switch is on, go

if (switchState == HIGH) {

//write LEDs to display the number 10
 
digitalWrite(light, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
digitalWrite(led7, LOW);
digitalWrite(oneLed, LOW);
digitalWrite(beep, LOW);

//beep on for 500 ms and off for 500 ms

delay(500);

digitalWrite(beep, HIGH);

delay(500);

//write LEDs to display the number 9

digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, LOW);
digitalWrite(oneLed, HIGH);

//beep for 250 ms, off for 250 ms, repeat twice

for(int i = 0; i < 3; i++) {
  digitalWrite(beep, LOW);
  delay(250);
  digitalWrite(beep, HIGH);
  delay(250);
}

//write LEDs to display the number 8

digitalWrite(led4, LOW);
digitalWrite(led5, LOW);

//beep for 167 ms, off for 167 ms, repeat three times

for(int i = 0; i < 4; i++){
  digitalWrite(beep, LOW);
  delay(167);
  digitalWrite(beep, HIGH);
  delay(167);
}

//write LEDs to display the number 7

digitalWrite(led1, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);

//beep for 125 ms, off for 125 ms, repeat four times

for(int i = 0; i < 5; i++){
  digitalWrite(beep, LOW);
  delay(125);
  digitalWrite(beep, HIGH);
  delay(125);
}

//write LEDs to display the number 6

digitalWrite(led1, LOW);
digitalWrite(led3, HIGH);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);

//beep for 100 ms, off for 100 ms, repeat five times

for(int i = 0; i < 6; i++){
  digitalWrite(beep, LOW);
  delay(100);
  digitalWrite(beep, HIGH);
  delay(100);
}

//write LEDs to display the number 5

digitalWrite(led4, HIGH);
digitalWrite(led7, LOW);

//beep for 83 ms, off for 83 ms, repeat six times

for(int i = 0; i < 7; i++){
  digitalWrite(beep, LOW);
  delay(83);
  digitalWrite(beep, HIGH);
  delay(83);
}

//write LEDs to display the number 4

digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);
digitalWrite(led5, HIGH);

//beep for 62 ms, off for 62 ms, repeat eight times

for(int i = 0; i < 9; i++){
  digitalWrite(beep, LOW);
  delay(62);
  digitalWrite(beep, HIGH);
  delay(62);
}

//write LEDs to display the number 3

digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led5, LOW);

//beep for 50 ms, off for 50 ms, repeat ten times

for(int i = 0; i < 11; i++){
  digitalWrite(beep, LOW);
  delay(50);
  digitalWrite(beep, HIGH);
  delay(50);
}

//write LEDs to display the number 2

digitalWrite(led4, LOW);
digitalWrite(led7, HIGH);

//beep for 42 ms, off for 42 ms, repeat 12 times

for(int i = 0; i < 13; i++){
  digitalWrite(beep, LOW);
  delay(42);
  digitalWrite(beep, HIGH);
  delay(42);
}

//write LEDs to display the number 1

digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);

//beep for 33 ms, off for 33 ms, repeat 14 times

for(int i = 0; i < 16; i++){
  digitalWrite(beep, LOW);
  delay(33);
  digitalWrite(beep, HIGH);
  delay(33);
}

//write LEDs to display the number 0, turn the buzzer and light/electrical igniter on

digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led5, LOW);
digitalWrite(led7, LOW);
digitalWrite(beep, LOW);
digitalWrite(light, LOW);

delay(1000);

//turn the buzzer and light/electrical igniter off

digitalWrite(beep, HIGH);
digitalWrite(light, HIGH);

delay(9000);
} else {

//if the switch isn't on, turn everything off
 
digitalWrite(light, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
digitalWrite(oneLed, HIGH);
digitalWrite(beep, HIGH);
}
}

Step 6: Use It!

You Ticking Time Bomb is ready for use. I built this for use as a prop, but it can be used in many other ways. Those ways do not include violence or evil. Please use this responsibly.
I'm new to this so I definitely would.
<p>Hi,</p><p>Sorry it took me so long, I accidentally missed your reply. This code reads a momentary switch, counts down from five by blinking a led, and then turns on a green light and a solenoid for a second, and then resets. It is only the loop portion, so the setup and beginning will still need to be changed.</p><p>If you have a basic knowledge of Arduino, or an hour of time to learn, you should be able to fill in the rest. Otherwise, just reply and I should be able to help you out.</p><div> <br><div> <br><div> <br><div> <br><div> <br><div> <br><div> <br><div> <br><div> <br><div> <br><div> <br><div><br>void loop( ) { <br><div><br>digitalWrite(countdownLED, LOW);<br>switchState = digitalRead(switchPin);<br><br>if (switchState == HIGH) {<br><br><div>for (int i = 0; i &lt; 6; i++) {<br><br>digitalWrite(countdownLed, HIGH);<br>delay(500);<br>digitalWrite(countdownLed, LOW);<br>delay(500);<br><br>} <br>digitalWrite(greenLed, HIGH);<br>digitalWrite(solenoid, HIGH);<br>delay(1000);<br>digitalWrite(greenLed, LOW);<br>digitalWrite(solenoid, LOW);<br>} else { <br>delay(10);<br>digitalWrite(greenLed, LOW);<br><p>digitalWrite(solenoid, LOW);</p> }<br><br>}</div></div></div></div></div></div></div></div></div></div></div></div></div></div>
Full code please
I am trying to make a C4 prop like the one from Counterstrike: Global Offensive and was wondering how I could replace the switch with a keypad and have a code to start the timer as well as replace the count down display with a blinking LED please help me figure out how I could do this and what code I would have to change. Note that i am incredibly inexperienced in arduino and would probably need to be spoon fed the code. Thanks
I love this design and need a little help tweaking it. I have a pinewood derby track setup and I'm wanting to use a solenoid to start the race. Here's what I was thinking. Momentary switch to start timer, at 0 green led and solenoid would start race and hold for a short time and reset automatically till momentary is hit again to start next race. Is this possible with your design? Thanks
Yeah, it is certainly possible. Would you need any help writing the code?
Cool project! I am in the process to make one of these, too. <br> <br>Once the timer is counted down to 0, the time bomb starts over again after a couple of seconds. I wonder how you could make the time looping stop, so that the timer does not start off from itself again. It would be awesome if the timer runs once when the time bomb is switched on. <br> <br>I am thankful for any hints! <br> <br>
The easiest way would be to change this line of code at the end of the loop, &quot;delay(9000);&quot;, in to this:<br> <br> if (1==1) { delay(10000); }<br> <br> This will delay forever, and you will need to unplug the arduino in order to break the delay, unless you add some code. Of course, this will leave the display on and displaying 0. If you want to shut it off, you should turn off all leds and then delay forever. To turn all leds off, use this code:<br> <br> digitalWrite(light, HIGH);<br> digitalWrite(led1, HIGH);<br> digitalWrite(led2, HIGH);<br> digitalWrite(led3, HIGH);<br> digitalWrite(led4, HIGH);<br> digitalWrite(led5, HIGH);<br> digitalWrite(led6, HIGH);<br> digitalWrite(led7, HIGH);<br> digitalWrite(oneLed, HIGH);<br> digitalWrite(beep, HIGH);
Thanks seraine! <br> <br>What would be the hard way? I mean, is there a way to stop the infinite delay (for instance this... if (1==1) { delay(10000); } ... ) by using a &gt;switch&lt; ? I would love to have it running the timer over again every time I turn it on with the switch. <br> <br> <br>
It should actually be pretty simple. All you should have to do is replace the infinity delay with this code:<br> <br> if (switchState == HIGH) { switchState = digitalRead(switchPin); }<br> <br> This line of code should work.<br>
Anyway I could get you to make one of these for me. I have all the stuff but I am new at all of this. If not do you have more pictures or video on hooking up the arduino to the right places. Thanks. Sanders87@hotmail.com
Instead of making a step by step video of the connections, I recommend that you learn to read schematics. It is a skill that you will frequently require when working with electronics, and you really should learn to do it. Without this skill, you will be severely limited in what you can construct. There are many guides on learning to read schematics, such as this one: https://learn.sparkfun.com/tutorials/how-to-read-a-schematic/overview If there are any If there are any specific connections you are confused about, feel free to ask. However, I will not give a complete, step by step guide to every connection that must be made.
2 questions: 1 what happens if you press the button a second time? 2 any way you could tie in a keypad that would allow an input to deactivate the countdown, and activate a second circuit to play a .midi or .wav file and throw confetti in the air? lol<br/>I am not good with circuitry, but your instructible is very informative and looks very cool!
The program ignores all input while it is doing the action (beeping, changing numbers). The program begins taking input again nine seconds after the sequence finishes. To tie in a keypad, you would have to attach to your Arduino to a keypad as other Instructables have shown, and change a lot of the code. Right now, the code delays for 10-500 milliseconds while running, based on how fast it is beeping. While it is delaying, it cannot accept input, and the code would have to change to check for input about every ten milliseconds. <br> <br>Throwing confetti or playing a .midi file would be much easier. In the very last number change, when the light/electronic igniter is lit, you would just have to send a signal to your confetti thrower. The hard part would be making a confetti thrower. As far as changing code/wiring goes, you would only need to add two wires and about four lines of code.
Airsoft battle

About This Instructable

12,378views

24favorites

License:

Bio: I am 14 years old, and I'm interested in many different things - electronics, chemistry, robotics, basketball, chess and much, much more.
More by seraine:Arduino Ticking Time Bomb Motion Activated Servo Low Voltage Electrical Igniters 
Add instructable to: