Friday, May 20, 2011

First Arduino mini project: counter & random number display

It has been about six months since i haven't done any electronics project. May be i was tired with traditional electronics workshop style. Then i brought Arduino uno with Atmega328 micro processor. During learning phase i worked with display in LED and then in 7-segment. Working with LED gave lots of fun (i worked with pranav, sulav). Then i switched to 7-segment: a counter display and a random number display. The circuit of arduino with 7-segment is as shown below:
figure: 7-segment display from arduino 

Digital pins 12,11,10,9,8,7 and 6 are taken as seven bit output pins. These output pins are connected to 7 segment display pins b,a,f,g,c,d and e respectively. Output is active low, that means output segment is on when LOW signal is given and off when HIGH signal is given. For example, in order to glow segment 'c', pin 8 should be turned LOW and other pins should be turned HIGH. Similarly, to display '1' in the 7 segment, segment 'b' and 'c' should be LOW. So pins 12 and 8 should be turned LOW and rest of the pins are turned HIGH. The supply for 7 segment is provided from arduino Vcc pin with 1k protection resistor.

We (me and sulav) have coded for counter display and random number display. Counter code displays from 0, 1, 2, ... to 9 and again back to 0 in every 1 sec. You can view source code from here.


Random number displays any random number in between 0 to 9. You can view source code from here.


Interested can download full source code from here.

1 comment:

Visualization of Electromagnetic wave in MATLAB

Wave is imaginary and mysterious thing to us. Many of them are invisible and we even don’t know their pres...