Introduction: Make an Arduino Timer

Picture of Make an Arduino Timer
Hi, so me and my pal are setting up so we can make PCB´s. We are currently making a UV exposure box (possibly another instrucable) and for this box, we needed a timer, so this is what we have done so far, and what we are going to do.

This project is based on the ardweeny from solarbotics because its cheap (10 $) and its small (28 DIP)
it counts down from 999 to 0 (seconds)
it has a 250V 10A Relay.

here is a short video of it counting down from 30 to 0:

Step 1: Parts List

Ok so here is the parts list:

as for all items these are suggestions

*one Ardweeny (or an ATmega168/328 chip with apropriate chrystal, resistor and capacitor)
    *one USB to FTDI Adapter for programming the ardweeny (if you dont already have one)
*8 NPN transistors capable of driving 30 mA each. (We used BC547 (keep the pinout in mind!)
*3 PNP transistors capable of driving 200mA each. (We used BD136 (Odd pinout here too!!)
*3 7-Segment displays (We used KINGBRIGHT SA52-11EWA common anode)
*11 resistors for the transistor bases (i used 200 ohm resistors (!!!OBS these are not on the print, see picture in step:[comming soon])
*7 resistors for the segments (150 ohms for an output of around 20 mA)
*2 10 pin header
*2 2 pin header
*1 28 DIP socket, narrow (you could solder the chip in but i would hate to have to solder it out if something gets burned!)
*1 6V relay (if you need this to switch things on and off)
    *one protective diode (We used some 1N4007 ones we had lying around)
*1 Potentiometer (We used a 4k7 because we had one around)
*Wires... lots of wires
*soldering equipment

That should be it. on to the next step

Step 2:

Picture of

ok, so we made this on perfboard (not having any PCB´s)

we have made a Print that you could use on you PCB´s

its in .fzz so you will need fritzing (a free awesome program) to open it

it has the layout,

keep in mind that on this pcb ALL transistors are layed out as Emitter Base Collector, however when using BC547 and BD136 transistors the pinouts will be different.

if you making this on a perfboard, you can use the method we did:

Step 3:

Picture of

Solder your stuff on the board, and when you are done, put in the arduino (ardweeny)

remember the resisters for the transistors (forgot those in fritzing.

i attached mine like this:

Step 4:

then, the code!

the code is on pastebin:

just copy the raw copy/paste at the bottom.

in the top part, you then setup the pins you are gonna use,

just replace the variable disp1 with the pin your first displays anode is hooked up to

as the code are right now, it just starts after 10 seconds, how ever, deleteing the line: delay(10000); will remove that delay, and further more removeing the two // infront of the lines: 

  //currentButton = deBounce(lastButton); //Using the debounce function to see if the button has been pushed
  //if (lastButton == LOW && currentButton == HIGH)

and in the end 


will enable you to use a button, with a pulldown resistor on.

hope you can use this, peace out :D



andrew.l.arth (author)2014-08-08

so im doing the oppisite from you. Im working on a model train layout, what i want is for a kid to press a button the train goes for 2 min then stops. the child does this 4 more times. after the train stops it activates a cool down clock for 10 min. it would have to work with electricity from an out lit.

astroboy907 (author)2011-07-18

Hey man- thanks 4 the code!! On my ible someone is asking for timer code and your code is a great start to it! What I needed was the x divides code, for the timer- thanks so much! Check my ible out, its the TimeDuino- very similar to yours, just a clock, not a timer :)

Snuletek (author)astroboy9072012-04-27

No problem, worked with it for hours till it hit me :P

sometimes less is more :D

About This Instructable




More by Snuletek:Make an Arduino timer
Add instructable to: