Introduction: How to Deal With 4 Digit 7 Segment Display

This is a basic 4 digit 7 segment display. this display have two types(common anode and common cathode). In this instructable I'm going to tell how to display charactors in this disply. I'm not using any other IC or controler circuit fro this project (Only Arduino UNO Bpard).

Step 1: Conecting Pins to Arduino UNO

You can identify pins in your display using this image.

Step 2: Making PCB

Simply I design little PCB fro connect display pins to UNO board. These are the pins you want to connect with arduino board. Use above image to determine pins.

a=13

b=8

c=6

d=5

e=4

f=3

g=9

D1= 2

D2=11

D3=12

D4=10

Step 3: Soldering Componets Togather

Please refer the images.

Step 4: Conecting Components

You can simply connect you created circuit board to arduino board.

Step 5: Arduino Sketch

/*
CREATED BY ERANGA GAMAGEDARA IN SRI LANKA EMAIL: developer.eranga@gmail.com */ int a=13; int b=8; int c=6; int d=5; int e=4; int f=3; int g=9;

int D1= 2; int D2=11; int D3=12; int D4=10;

int def[]={1,1,1,1,1,1,1};

int letter[8]={};

int n1[]={0,0,1,1,1,1,1}; int n2[]={0,1,0,0,1,0,0}; int n3[]={0,0,0,1,1,0,0}; int n4[]={0,0,1,1,0,1,0}; int n5[]={1,0,0,1,0,0,0}; int n6[]={1,0,0,0,0,0,0}; int n7[]={0,0,1,1,0,0,1}; int n8[]={0,0,0,0,0,0,0}; int n9[]={0,0,0,1,0,0,0}; int n0[]={0,0,0,0,0,0,1};

int LA[]={0,0,1,0,0,0,0}; int LB[]={0,0,0,0,0,0,0}; int LC[]={1,1,0,0,0,0,1}; int LD[]={0,0,0,0,1,1,0}; int LE[]={1,1,0,0,0,0,0}; int LF[]={1,1,1,0,0,0,0}; int LG[]={0,0,0,1,0,0,0}; int LH[]={1,0,1,0,0,0,0}; int LI[]={1,1,1,0,0,1,1}; int LJ[]={0,0,0,1,1,1,1}; int LK[]={0,0,1,0,0,1,0}; int LL[]={1,1,0,0,0,1,1}; int LM[]={1,0,1,0,1,1,0}; int LN[]={1,0,1,0,1,1,0}; int LO[]={1,0,0,0,1,1,0}; int LP[]={0,1,1,0,0,0,0}; int LQ[]={0,0,1,1,0,0,0}; int LR[]={0,0,1,0,0,0,0 }; int LS[]={1,0,0,1,0,0,0}; int LT[]={1,1,1,0,0,0,1}; int LU[]={0,0,0,0,0,1,1}; int LV[]={0,0,0,0,0,1,1}; int LW[]={0,0,0,0,0,1,1}; int LX[]={1,0,1,0,0,0,0}; int LY[]={0,0,0,1,0,1,0}; int LZ[]={0,1,0,0,1,0,0};

void setup() {

pinMode(a,OUTPUT); pinMode(b,OUTPUT); pinMode(c,OUTPUT); pinMode(d,OUTPUT); pinMode(e,OUTPUT); pinMode(f,OUTPUT); pinMode(g,OUTPUT);

pinMode(D1,OUTPUT); pinMode(D2,OUTPUT); pinMode(D3,OUTPUT); pinMode(D4,OUTPUT); Serial.begin(9600); }

void loop(){

printer("1234567890");

} void printer(String str){ if (str.length()<=4){ showDigit(D1,str[0]); showDigit(D2,str[1]); showDigit(D3,str[2]); showDigit(D4,str[3]); }else{ wordShifter(str); } } void wordShifter(String str){

int i=0; while(i

void getPattern(char s){ switch (s){ case '1': for(int j=0;j<7;j++){letter[j]=n1[j];} break; case '2': for(int j=0;j<7;j++){letter[j]=n2[j];} break; case '3': for(int j=0;j<7;j++){letter[j]=n3[j];} break; case '4': for(int j=0;j<7;j++){letter[j]=n4[j];} break; case '5': for(int j=0;j<7;j++){letter[j]=n5[j];} break; case '6': for(int j=0;j<7;j++){letter[j]=n6[j];} break; case '7': for(int j=0;j<7;j++){letter[j]=n7[j];} break; case '8': for(int j=0;j<7;j++){letter[j]=n8[j];} break; case '9': for(int j=0;j<7;j++){letter[j]=n9[j];} break; case '0': for(int j=0;j<7;j++){letter[j]=n0[j];} break; case 'A': for(int j=0;j<7;j++){letter[j]=LA[j];} break; case 'B': for(int j=0;j<7;j++){letter[j]=LB[j];} break; case 'C': for(int j=0;j<7;j++){letter[j]=LC[j];} break; case 'D': for(int j=0;j<7;j++){letter[j]=LD[j];} break; case 'E': for(int j=0;j<7;j++){letter[j]=LE[j];} break; case 'F': for(int j=0;j<7;j++){letter[j]=LF[j];} break; case 'G': for(int j=0;j<7;j++){letter[j]=LG[j];} break; case 'H': for(int j=0;j<7;j++){letter[j]=LH[j];} break; case 'I': for(int j=0;j<7;j++){letter[j]=LI[j];} break; case 'J': for(int j=0;j<7;j++){letter[j]=LJ[j];} break; case 'K': for(int j=0;j<7;j++){letter[j]=LK[j];} break; case 'L': for(int j=0;j<7;j++){letter[j]=LL[j];} break; case 'M': for(int j=0;j<7;j++){letter[j]=LM[j];} break; case 'N': for(int j=0;j<7;j++){letter[j]=LN[j];} break; case 'O': for(int j=0;j<7;j++){letter[j]=LO[j];} break; case 'P': for(int j=0;j<7;j++){letter[j]=LP[j];} break; case 'Q': for(int j=0;j<7;j++){letter[j]=LQ[j];} break; case 'R': for(int j=0;j<7;j++){letter[j]=LR[j];} break; case 'S': for(int j=0;j<7;j++){letter[j]=LS[j];} break; case 'T': for(int j=0;j<7;j++){letter[j]=LT[j];} break; case 'U': for(int j=0;j<7;j++){letter[j]=LU[j];} break; default: for(int j=0;j<7;j++){letter[j]=def[j];} break;

} }

void showDigit2(int place,char s){ getPattern(s); digitalWrite(place,1); digitalWrite(a,letter[0]); digitalWrite(b,letter[1]); digitalWrite(c,letter[2]); digitalWrite(d,letter[3]); digitalWrite(e,letter[4]); digitalWrite(f,letter[5]); digitalWrite(g,letter[6]); delay(4); digitalWrite(place,0); } void showDigit(int place,char s){ getPattern(s); digitalWrite(place,1); digitalWrite(a,letter[0]); digitalWrite(b,letter[1]); digitalWrite(c,letter[2]); digitalWrite(d,letter[3]); digitalWrite(e,letter[4]); digitalWrite(f,letter[5]); digitalWrite(g,letter[6]);

delay(4); digitalWrite(place,0); }

Comments

author
osalomak (author)2015-09-04

Hi.

Your numbers goes wrong!

This is correct.. :P

int n1[]={0,0,1,1,1,1,1};

int n2[]={0,1,0,0,1,0,0};

int n3[]={0,0,0,1,1,0,0};

int n4[]={0,0,1,1,0,1,0};

int n5[]={1,0,0,1,0,0,0};

int n6[]={1,0,0,0,0,0,0};

int n7[]={0,0,1,1,0,0,1};

int n8[]={0,0,0,0,0,0,0};

int n9[]={0,0,0,1,0,0,0};

int n0[]={0,0,0,0,0,0,1};

About This Instructable

2,048views

28favorites

License:

Bio: I'm a undergraduate student in London metropolitan university and i following my degree (software engineering).
More by ErangaG:How to deal with 4 digit 7 segment display Digital transistor identifier
Add instructable to: