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

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.
 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
  //Set the desired brightness (0 to 100);


void loop() {
  //Produce an output on the display

  //Check if 10ms has elapsed
  unsigned long mils=millis();
  if (mils-timer>=10) {
    if (CentSec==10000) { // Reset to 0 after counting for 100 seconds.
    //Update the number to be displayed, with a decimal
    //place in the correct position.
    sevseg.NewNum(CentSec,(byte) 2);
 Posted by at 18 h 08 min

  9 Responses to “Arduino : 4 digits 7-led display”

  1. Hi !!!

    Be so kind to explain how to reduce the number of I / O pins?

    Greetings and thanks in advance.

  2. 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

  3. 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 🙂

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.