Sep 212014
I got myself a cheap 4 digits 7-led display and I thought I would spend a few mns playing with it and documenting it.
12 pins : 8 for the segments (including the dots), 4 for each digit
Top row : 1, a, f, 2, 3, b
Bottomw row: e, d, dp, c, g, 4
I decided to use the Sevseg arduino library.
More about this library here.
The wiring is then as is :
Arduino pins -> 4digits display pins
2->1
6->a
11->f
3->2
4->3
7->b
10->e
9->d
13->dp
8->c
12->g
5->4
Below the schema
Note that this is a lot of digital IO’s used. A future article could focus on reducing the number of IO’s needed.
Below the arduino sketch (from the example provided with the sevseg library)
/*Written by Dean Reading, 2012. deanreading@hotmail.com This example is a centi-second counter to demonstrate the use of my SevSeg library. */ #include "SevSeg.h" //Create an instance of the object. SevSeg sevseg; //Create global variables unsigned long timer; int CentSec=0; void setup() { //I am using a common anode display, with the digit pins connected //from 2-5 and the segment pins connected from 6-13 sevseg.Begin(1,2,3,4,5,6,7,8,9,10,11,12,13); //Set the desired brightness (0 to 100); sevseg.Brightness(50); timer=millis(); } void loop() { //Produce an output on the display sevseg.PrintOutput(); //Check if 10ms has elapsed unsigned long mils=millis(); if (mils-timer>=10) { timer=mils; CentSec++; if (CentSec==10000) { // Reset to 0 after counting for 100 seconds. CentSec=0; } //Update the number to be displayed, with a decimal //place in the correct position. sevseg.NewNum(CentSec,(byte) 2); } }
Hi !!!
Be so kind to explain how to reduce the number of I / O pins?
Greetings and thanks in advance.
I am planning on using a shift register (74hc595) as used in that article.
OK
Thanks for the reply, when you have it, Could you post how to do?
Regards and thanks again.
will do !
I would love to use the SevSeg Library with a shift register for the 7 segments plus decimal point. I think you would have to modify SevSeg.cpp
Any luck?
I dont understand : the example already provide an example with with a dot ?
//Update the number to be displayed, with a decimal
//place in the correct position.
sevseg.NewNum(CentSec,(byte) 2);
Yes it has a decimal. But what about using a Shift Register with the SevSeg Library and 7 segment display.
I think you would have to modify SevSeg.cpp
In the code we can see that you use common anode display. I found that with common anode the resistor should be on the cathode. Can you explain/justify why you put resistors on anode. How did you calculate resistor value (330ohms) ?
You are probably right about the anode and to be fair i did not calculate the resistor value but just put one in to be safe.
I know…i Know… not very clean 🙂