<<<< Arduino program to display "HE" in a 16*8 LED display
In the last blog, we created a simple program to display "HE" in a 16*8 LED matrix. But the brightness of LEDs was less in that case. In such situations, a simple technique is used to increase the brightness of LEDs.
Brightness of LEDs will be less in this case. Next is to make some modifications in the program to increase the brightness. Modified program is given below. Part of the program that turn on LEDs is put inside a "for" loop. "for" loop iterates two times (light_intensity=2). This will increase the on time of LEDs two times more than the off time which will increase the brightness of LEDs.
Repeating the same "for" loop for all frames will increase the brightness of all LEDs in "HE" display. That program will be lengthy and you can download it from the following box. Upload the downloaded program to your arduino board.
If uploading is successfull, you will get a brighter "HE" display. By changing the value of variable "light_intensity", we can adjust the brightness of LEDs. But, increasing the value of "light_intensity" above a particular value will result in blinking of LED matrix.
After displaying each frames, program turn off all the LEDs by sending 255 to the cathode terminals of 16*8 LED matrix. This turn off process is unavoidable for getting an expected output. That is, turn on time and turn off time of LED matrix is equal. This will reduce the brightness of LED matrix to half. If the on time of LED matrix is more than the off time, our eyes will feel that brightness of LEDs get increased. A simple modification in program will increase the on time of LED matrix. Put the part of the program, that creates the individual frames, inside a "for" loop.
We had already seen the programs to create individual frames for "HE" display in past few blogs. Arduino program to create the first frame is given below. Upload this program to your arduino board.
We had already seen the programs to create individual frames for "HE" display in past few blogs. Arduino program to create the first frame is given below. Upload this program to your arduino board.
int latchPin = 11; //Pin connected to ST_CP of 1st 74595 int clockPin = 12; //Pin connected to SH_CP of 1st 74595 int dataPin = 13; //Pin connected to DS of 1st 74595 int latchPin2 = 8; //Pin connected to ST_CP of 2nd 74595 int clockPin2 = 9; //Pin connected to SH_CP of 2nd 74595 int dataPin2 = 10; //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() { /*************************** FIRST FRAME ***************************/ // take the latchPin low so the LEDs don't change while you're sending in bits: digitalWrite(latchPin, LOW); //Send 1 1 1 1 1 1 1 0 (254) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595 shiftOut(dataPin, clockPin, MSBFIRST, 254); //Send 1 1 0 0 0 0 1 1 (195) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595 shiftOut(dataPin, clockPin, MSBFIRST, 195); // 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 1 1 1 1 1 1 1 0 (254) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 3rd 74595 shiftOut(dataPin2, clockPin2, MSBFIRST, 254); // 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); }
Brightness of LEDs will be less in this case. Next is to make some modifications in the program to increase the brightness. Modified program is given below. Part of the program that turn on LEDs is put inside a "for" loop. "for" loop iterates two times (light_intensity=2). This will increase the on time of LEDs two times more than the off time which will increase the brightness of LEDs.
int latchPin = 11; //Pin connected to ST_CP of 1st 74595 int clockPin = 12; //Pin connected to SH_CP of 1st 74595 int dataPin = 13; //Pin connected to DS of 1st 74595 int latchPin2 = 8; //Pin connected to ST_CP of 2nd 74595 int clockPin2 = 9; //Pin connected to SH_CP of 2nd 74595 int dataPin2 = 10; //Pin connected to DS of 2nd 74595 int i=0, light_intensity=2; 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<light_intensity;i++) { /*************************** FIRST FRAME ***************************/ // take the latchPin low so the LEDs don't change while you're sending in bits: digitalWrite(latchPin, LOW); //Send 1 1 1 1 1 1 1 0 (254) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595 shiftOut(dataPin, clockPin, MSBFIRST, 254); //Send 1 1 0 0 0 0 1 1 (195) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595 shiftOut(dataPin, clockPin, MSBFIRST, 195); // 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 1 1 1 1 1 1 1 0 (254) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 3rd 74595 shiftOut(dataPin2, clockPin2, MSBFIRST, 254); // 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); }
Repeating the same "for" loop for all frames will increase the brightness of all LEDs in "HE" display. That program will be lengthy and you can download it from the following box. Upload the downloaded program to your arduino board.
Next : Cluster of Seven Segment Displays to LED Matrix >>>> |
0 comments: