Blogroll

Powered by Blogger.

Monday 22 September 2014

Improve the Brightness of a Cluster of Seven Segment Displays by Arduino (Part 14 of 16)

by realfinetime  |  in Seven Segment Display at  01:58

<<<< Read Previous Part (Part 13)

Simple trick to increase the brightness of Seven Segment Display

          So far, we have seen a lot of programs to display different numbers in a cluster of common cathode seven segment displays in the past few blogs. But the brightness of LEDs is less in those cases. From the arduino programs, we found that, after turning on the display each time, a command is used to turn off the entire display by sending 255 to the cathode terminals. So, on time and off time of seven segment displays will become equal. This is the main cause of the reduction in brightness of LEDs. If the on time is more than the off time, brightness of LEDs get increased. A simple technique is used to increase the on time of LEDs. Put the part of the program that turn on seven segment display inside a "for" loop. Program to display "9." in the eighth seven segment display is given below.


int latchPin = 12;  //Pin connected to ST_CP of 1st 74595
int clockPin = 13;  //Pin connected to SH_CP of 1st 74595
int dataPin = 11;   //Pin connected to DS of 1st 74595

int latchPin2 = 6;  //Pin connected to ST_CP of 2nd 74595
int clockPin2 = 7;  //Pin connected to SH_CP of 2nd 74595
int dataPin2 = 5;  //Pin connected to DS of 2nd 74595

void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  
  pinMode(latchPin2, OUTPUT);
  pinMode(clockPin2, OUTPUT);
  pinMode(dataPin2, OUTPUT);
}

void loop() {
  
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 1 1 0 1 1 1 1 (239) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 239);
    // shift out the bits:    
    digitalWrite(latchPin, HIGH);
          
    // take the latchPin low so the LEDs don't change while you're sending in bits:    
    digitalWrite(latchPin2, LOW);
    //Send 0 1 1 1 1 1 1 1 (127) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 127);
    // shift out the bits:  
    digitalWrite(latchPin2, HIGH); 
    

    /********* Turn off all the LEDs *********/
    
    // take the latchPin low so the LEDs don't change while you're sending in bits:    
    digitalWrite(latchPin2, LOW);
    //Send 1 1 1 1 1 1 1 1 (255) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 255);
    // shift out the bits:  
    digitalWrite(latchPin2, HIGH);    
}

          To increase the brightness, put the part of program that turn on LEDs inside an "i" loop as shown in following program. In this case, "i" loop will iterate two times. That is, on time will be double of off time which will increase the brightness of LEDs. Modified program is given below. Upload it to your arduino board.

int latchPin = 12;  //Pin connected to ST_CP of 1st 74595
int clockPin = 13;  //Pin connected to SH_CP of 1st 74595
int dataPin = 11;   //Pin connected to DS of 1st 74595

int latchPin2 = 6;  //Pin connected to ST_CP of 2nd 74595
int clockPin2 = 7;  //Pin connected to SH_CP of 2nd 74595
int dataPin2 = 5;  //Pin connected to DS of 2nd 74595

int i;

void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  
  pinMode(latchPin2, OUTPUT);
  pinMode(clockPin2, OUTPUT);
  pinMode(dataPin2, OUTPUT);
}

void loop() {
  
  for(i=0;i<2;i++)
  {
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 1 1 0 1 1 1 1 (239) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 239);
    // shift out the bits:    
    digitalWrite(latchPin, HIGH);
          
    // take the latchPin low so the LEDs don't change while you're sending in bits:    
    digitalWrite(latchPin2, LOW);
    //Send 0 1 1 1 1 1 1 1 (127) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 127);
    // shift out the bits:  
    digitalWrite(latchPin2, HIGH); 
  }  

  /********* Turn off all the LEDs *********/
    
  // take the latchPin low so the LEDs don't change while you're sending in bits:    
  digitalWrite(latchPin2, LOW);
  //Send 1 1 1 1 1 1 1 1 (255) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
  shiftOut(dataPin2, clockPin2, MSBFIRST, 255);
  // shift out the bits:  
  digitalWrite(latchPin2, HIGH);  
 
}

          If uploading is successful, brightness of seven segment display get increased. Output is given below. "9." will be displayed in the eighth common cathode seven segment display.

          Brightness of LEDs increase with increase in the value of "i". Increasing the value of "i" above a particular limit will result in blinking of the display.

Continued in Next Page (Part 15)  >>>>

0 comments:

IMPORTANT NOTICE

All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.

For More Electronic Tips



Blog Archive

Proudly Powered by Blogger.