Instructables
Picture of Arduino 7 segment countdown timer
This project is based on a Kingbright dual 7 segment display and an Arduino Diecimila.
it counts down from 20 and lights up pin 13 LED when the timer is complete.
It uses no extra hardware which is usefull for low-cost projects.
It also features multiplexing to get the job done with only 9 pins altogether for the displays.


 
Remove these adsRemove these ads by Signing Up

Step 1: Parts needed

For this project you will need the following:

COMPONENTS:
1. An Arduino (any kind will do)
2. A dual-7 segmant display or 2 seperate 7 segment displays.
3. 2 Resistors (the values depend on your display)
4. About 50cm of non-stranded wire

TOOLS:
1. A soldering iron and solder. (My display was SMD so i had to solder wires to it for connection)
2. A fume extractor. (I really reccomend buying or making one as they are very helpful to you)
3. A wire stripper, or you could just use scissors

Step 2: What is multiplexing?

Multiplexing is when you control lots of LEDs with a few IO pins.
It is based on having to or more 7 segment displays and connecting them together, an example of what they would display is 00, 11, 22, 33, 44, 55, 66, 77, 88, 99.
But what we do in this case is control each GND (-) induvidualy which turns it into a multiplexed display.
We will switch displays every 0.5ms which gives us control of each display.

It is usefull when you are building a project with lots of components and are short of IO pins.

In this example, we will be controlling 2 7 segment displays with 9 IO pins.
If we don't use multiplexing, we will need 14 IO pins to control the whole thing.
Any chance you could update the code to have 8 digits displaying hours, minutes, seconds, milliseconds and colons (:) in between each?
I have some coding experience with arduino and I'd be willing to help.

lol wouldn't that take like 5 minutes. As for the colons just use red LEDs.

spudziuvelis7 months ago

Hello! Could you make library for this? I think it'l be very usefull.

common anode or common cathode
kilofeenix2 years ago
Would you be able to put a 10 key keyboard on this project to start and stop the timer with a code? My friends and I have airsoft guns and we all played Counter Strike as a kids.
mastergabe2 years ago
hi i need to use to seven segment displays and this is great but is it possible that they could write a int or value of a sensor if so please tell me and email me the code or just post it on a comment thanks
Santos462892 years ago
""hi i have built this timer and loaded the programme into my arduino but it just lights up the 7 segment display and then jumbles through a load of numbers really quickly. then it stops and starts pulsing. does anybody know why. please be simple, im new to arduino:)""

I have the same Problem its to fast .... and its the same when i change it from delay(0,5) to delay(5) // int timer 100

Please help
baharini (author)  Santos462892 years ago
The delay() command uses milliseconds.
To make a delay of 1 second, you would use delay(1000);
So, using delay(5) would make 1/200 of a second which is VERY fast.
Make it delay(500) for half a second.
hi i have built this timer and loaded the programme into my arduino but it just lights up the 7 segment display and then jumbles through a load of numbers really quickly. then it stops and starts pulsing. does anybody know why. please be simple, im new to arduino:)
honskie4 years ago
where i can put this code???? on visual basic??
No, download the arduino ide. You will need an arduino too.

arduino ide: http://www.arduino.cc/en/Main/Software

arduino: http://www.amazon.com/Arduino-UNO-board/dp/B004CG4CN4/ref=sr_1_1?ie=UTF8&qid=1311389063&sr=8-1
Robot Lover3 years ago
I'm sure with a little effort, the code could be shortened quite a bit. I'll give it a try!
rocket_man3 years ago
Anybody know how i would do this only with simple circuit/ ics
jaragon3 years ago
Cool write-up! i used a dual common anode display. for using a c.a replace the B0 to B1 and viceversa. gonna try and add to this to count starting at 99!
FalconFour3 years ago
You've got to add more detail to this. I'm having to make a lot of wiring guesswork here. "via resistor"? What value? I assume we're plugging these into digital pins, since there is no such thing as just Arduino "pin 6", etc...? Ground doesn't need a transistor? *shrug*...
Also, nowhere in here states what segment is A-B-C-D-E-F-G... biggest bit of guesswork yet :(
Most displays start with A on the top and then go clockwise, with G in the middle, so:

A - top
B - top right
C - bottom right
D - bottom
E - bottom left
F - top left
G - middle

You will probably need to look at the datasheet for whatever 7-segment component you have to tell what pins correspond to what segment, though.
djlewis7253 years ago
Worked great for me. Nice instructable, wiring was a bit tricky though.
I would love to try this but do not have a two digit display - I only have a 4 digit one:

http://www.kingbrightusa.com/product.asp?catalog_name=LED&product_id=CA56-21GWA

Having only just really started electronics, I am not too sure how to wire up one of these displays, and even then it would take me some time to write the code. Can anyone give me a hand on how to wire it up?
Thanks for any help!!
jrigvd3 years ago
in your sketch for the countdown-timer you have made a few mistakes,

int timer = 500;
becomes
int timer = 100;

and

all the delay(0.5);

becomes

delay(5);
jrigvd4 years ago
my arduino won't read the code normal
Mr Jaderman4 years ago
You know what you could do is just copy it from the Arduino IDE and then just paste on to your page here. Would GREATLY appreciate it.
 
baharini (author)  Mr Jaderman4 years ago
I've updated the program so when you click on the icon it takes you directly to the program.
Heeth baharini4 years ago
Hi friend. This post on multiplexed Display was really very very useful but i have stuck in a problem. I want to display an temperature on the multiplexed display. I have used LM35 for temperature sensing and 7135 as ADC. Now when ADC is accessing the analog data and converting the data, my display is getting turned off. I have used timer for displaying, when the timer is overflown, its getting turned off for a while and getting turned on again. What to do friend?? Heeth
catprog Heeth4 years ago
The code for converting the data is probably taking so long that you can see the delay in the timer. (if your using the Arduino IDE) in setup() ----------- Serial.begin(9600); ------ in the main code ------------- Serial.println("CONVERT START"); //Convert Code Data Serial.println("CONVERT END"); --------- Then you can use the Ardunio IDE to monitor the serial port to see what happens in the code.
Heeth baharini4 years ago
Hi friend. This post on multiplexed Display was really very very useful but i have stuck in a problem. I want to display an temperature on the multiplexed display. I have used LM35 for temperature sensing and 7135 as ADC. Now when ADC is accessing the analog data and converting the data, my display is getting turned off. I have used timer for displaying, when the timer is overflown, its getting turned off for a while and getting turned on again. What to do friend?? Heeth
Heeth4 years ago
heyy, that was really useful for me. But i have a doubt. My multiplexed display is getting turned off for w while. I have used 7135 ADC and whenever 7135 gets data from from the source, my segments are getting turned off... What to do for that friends???
Dylan5524 years ago
 how do i know what resistors i need?
Teslaling4 years ago
You should try using PORTD instead of digitalWrite() because it will save code space and it will be faster.  Using PORTD would also fix the ghosting effect that is caused by the slower digitalWrite().
Grumpy Mike4 years ago
You have the current limiting resistor in the cathode. Doing this will alter the brightness of the number depending on how many segments are lit.

You can see this in your photograph the 1 is much brighter than the 9 and 8 would be dimmer still. You need to remove the cathode resistors and put a current limiting resistor in each segment's anode.
wopwop4 years ago
 Hi, 
Is this a Common Anode, or a Common Cathode display?
Would be great if you could post the displays model nr printed on the side.
Thanks!
baharini (author)  wopwop4 years ago
it's a common cathode display.
The model is a KINGBRIGHT KCDC04-101.
Sorry for the late response.
Mr Jaderman4 years ago
I tried it again. When I clicked it, I saved it as, let's say, Arduino.pde and then it would save it as Arduino.pde.tmp as a tmp file and i can't change the file type.
 
Mr Jaderman4 years ago
I can not open your script. I've tried everything I could think of. PLEASE help!
 
How could you not open it?
Its simply a text file, Rename it to .pde.
I will rate this higher if you do one thing, EXPAND ON THIS!
ikestarm175 years ago
can you explain a little better about what multiplexing is and maybe include a circuit diagram?
baharini (author)  ikestarm174 years ago
Sure! I will add more information about it for you.
that helped a lot, thanks!