Introduction: Save Your Pins in 7 Segment Display Project

A seven segment display is a lot useful but a bad thing about it is it utilizes a lot of pin of you microcontroller. You can use only two or three seven segment displays with micro-controllers like arduino uno, arduino nano, linkit one. But today I would be going to tell you how to use many seven segment display with a single microcontroller and hence saving your pins for other sensors and modules. I have used only two display but you can use as many as you want. Here I have used the principle of POV(persistence of vision). The first display display number for 15 microseconds and second for 15 microseconds. The switch on and off of the display is so fast that it seems all display are glowing at one time only. I think this tutorial will be a lot helpful in your future projects.

Step 1: Part List:

Here are the parts required by you for this simple tutorial:

  • Linkit one
  • 2 X 7segment display(you can use as many as you want)
  • 2 X BC547(number of transistor required by you is equal to number of displays used by you)
  • Breadboard
  • Jump cables
  • A usb cable to upload your code

Step 2: Connect the Seven Segment Display

A seven segment display has 10 pin. Seven are for the LED bars, one for the corner dot and rest two are gnd or cathode. Their is a photo attached above by which you can know which bar of led is attached to which pin. Connect pins of the first display to the corresponding pin of the second display. Do not connect the cathode as it will be connected to our transistor in the next step. Every pin is named with certain alphabet in the display. Connect the display to your board according to that:

  • g---digital pin 2
  • f---digital pin 3
  • a---digital pin 4
  • b---digital pin 5
  • e---digital pin 6
  • d---digital pin 7
  • c---digital pin 8
  • dot---digital pin 9

Step 3: Connect the Transistors

A NPN transistor has a very important role here. Whole mechanism here is based on transistor. Here you can only use a NPN transistor. A PNP transistor will not work here. The reason to use BC547transistor is that it is cheap and very easily available. You can use any NPN transistor. Here the connection of the first and second transistor:

FIRST TRANSISTOR:

  • emitter-----gnd of linkit one
  • base-----digital pin 10
  • collector-----cathode or gnd of first seven segment display

SECOND TRANSISTOR:

  • emitter-----gnd of linkit one
  • base-----digital pin 11
  • collector-----cathode or gnd of second seven segment display

Step 4: Upload the Code

Here is the code by which you can control two or more seven segment displays simultaneously without using a lot of pins. This code will display 1 and 4 on the seven segment display. Modify it according to your use. Here we go:

void setup()

{

pinMode(2,OUTPUT);

pinMode(3,OUTPUT);

pinMode(4,OUTPUT);

pinMode(5,OUTPUT);

pinMode(6,OUTPUT);

pinMode(7,OUTPUT);

pinMode(8,OUTPUT);

pinMode(9,OUTPUT);

pinMode(10,OUTPUT);

pinMode(11,OUTPUT);

}

void loop()

{

digitalWrite(3,LOW);
digitalWrite(2,LOW);

digitalWrite(5,LOW);

digitalWrite(8,LOW);

digitalWrite(10,LOW);

digitalWrite(11,LOW);

digitalWrite(5,HIGH);

digitalWrite(8,HIGH);

digitalWrite(10,HIGH);

delayMicroseconds(15);

digitalWrite(10,LOW);

digitalWrite(3,HIGH);

digitalWrite(2,HIGH);

digitalWrite(11,HIGH);

delayMicroseconds(15);

}

Step 5: The End

I think this tutorial will surely you to make your own seven segment projects. Hope you like and loved it. For any query or problem or any kind of assistance, comment below. Thank you

Make It Glow! Contest

Participated in the
Make It Glow! Contest

Tech Contest

Participated in the
Tech Contest