Pages

Tuesday 30 September 2014

Modify Arduino Program for Turning on LED 8 of 2*2*2 LED Cube (Part 5 of 13)

<<<<  Read Previous Part (Part 4)

          We had already seen the internal circuit of 2*2*2 LED cube in the last blog. Here, we will make some modifications in the circuit to turn on LED 8 only.

          If the circuit is done as given above, LED 8 will turn on. Positive terminal of 5V cell is connected to the anode terminals of LED 5, LED 6, LED 7 and LED 8 through a current limiting resistor of 1K. Negative terminal of 5V cell is connected to the cathode terminals of LED 4 and LED 8. From these two connections, we can conclude that the only LED which get both positive and negative voltages is LED 8. This will turn on LED 8.

Continued in Next Part (Part 6)  >>>>

Modify 2*2*2 LED Cube Circuit to Turn on LED 3 only (Part 4 of 13)

<<<<  Read Previous Part (Part 3)

          We had already seen the internal circuit of 2*2*2 LED cube in the last blog. Here, we will make some modifications in the circuit to turn on LED 3 only.

          If the circuit is done as given above, LED 3 will turn on. Positive terminal of 5V cell is connected to the anode terminals of LED 1, LED 2, LED 3 and LED 4 through a current limiting resistor of 1K. Negative terminal of 5V cell is connected to the cathode terminals of LED 3 and LED 7. From these two connections, we can conclude that the only LED which get both positive and negative voltages is LED 3. This will turn on LED 3.

Continued in Next Part (Part 5)  >>>

How to Turn on LED 2 only of 2*2*2 using a Battery (Part 3 of 13)

<<<<  Read Previous Part (Part 2)

          We had already seen the internal circuit of 2*2*2 LED cube in the last blog. Here, we will make some modifications in the circuit to turn on LED 2 only.

          If the circuit is done as given above, LED 2 will turn on. Positive terminal of 5V cell is connected to the anode terminals of LED 1, LED 2, LED 3 and LED 4 through a current limiting resistor of 1K. Negative terminal of 5V cell is connected to the cathode terminals of LED 2 and LED 6. From these two connections, we can conclude that the only LED which will get both positive and negative voltages is LED 2. This will turn on LED 2.

Continued in Next Part (Part 4) >>>

Circuit to Turn on LED 1 only of a 2*2*2 LED Cube using a Battery (Part 2 of 13)

<<<<  Read Previous Part (Part 1)

          We had already seen the internal circuit of 2*2*2 LED cube in the last blog. Here, we will make some modifications in the circuit to turn on LED 1 only.
          If the circuit is done as given above, LED 1 will turn on. Positive terminal of 5V cell is connected to the anode terminals of LED 1, LED 2, LED 3 and LED 4 through a current limiting resistor of 1K. Negative terminal of 5V cell is connected to the cathode terminals of LED 1 and LED 5. From these two connections, we can conclude that the only LED which will get both positive and negative voltages is LED 1. Then, LED 1 will turn on.

Continued in Next Part (Part 3)  >>>>

Circuit Diagram of a 2*2*2 LED Cube (Part 1 of 13)

<<<<  Previous : Video of an Amazing Pattern in a Cluster of 8 Common Cathode Seven Segment Displays

          We have designed LED matrix and seven segment displays in past few blogs. Here, we will see the basic concepts of LED cube. Schematic of a 2*2*2 LED cube is given below. As shown in the diagram, 2*2*2 LED cube has 8 LEDs. 4 LEDs at the top and 4 LEDs at the bottom. One of the important fact which had to be considered while arranging LEDs is the facility to turn on any LED individually. An arrangement of LEDs in cubical shape is given below.


          From the schematics, it is clear that, blue line indicates the cube. Cube has 8 corners. LEDs are arranged at the corners of cube. Red line indicates the positive terminals and black line indicates the negative terminals. Positive terminals at the top corners are shorted to get a common positive terminal (f). Similarly, positive terminals at the bottom corners are also shorted to get a second positive terminal (e). Negative terminals of 2 LEDs located at each edges are shorted to get 4 negative terminals (a, b, c and d). Using these 6 terminals, we can turn on any LED individually.

Continued in Next Part (Part 2)  >>>

Monday 29 September 2014

Amazing Pattern in a Cluster of 8 Seven Segment Displays using Arduino

<<<<  Previous : Scrolling Number Display in a Cluster of 8 Common Cathode Seven Segment Displays

          We have found the circuit for controlling a cluster of 8 common cathode seven segment displays using arduino and 74595 in previous blogsClick here to start reading from the beginning of "controlling a cluster of eight common cathode seven segment displays using arduino and 74595".

          Here, we will create an amazing pattern in a cluster of 8 common cathode seven segment displays. Designing patterns in seven segment displays is always interesting. Video of a beautiful pattern designed in seven segment display cluster is given below.
          By shifting out proper values, we can easily create many amazing patterns. Visit and subscribe our you tube channel for more similar videos.



Next : Basic Concepts of 2*2*2 LED Cube  >>>>

Sunday 28 September 2014

Connecting Current Limiting Resistors to a Cluster of 8 Seven Segment Displays?

          We had already seen the criterion for connecting current limiting resistors to LED matrix. Same criterion have to be followed for connecting current limiting resistors to a cluster of 8 common cathode seven segment displays. We had reduced the number of control pins, for a cluster of 8 common cathode seven segment displays in previous blog. Current limiting resistors can be either connected to the anode terminals or to the cathode terminals. Current limiting resistors of 100 ohm are connected to the anode terminals (a, b, c, d, e, f, g and dp) as shown in the following circuit.


          To get maximum brightness, each segments of seven segment display should have separate resistors. Since only one seven segment display will be on at a time, if resistors are connected to the anode terminals (a, b, c, d, e, f, g and dp), each segments will get separate resistors. So segments will light up at maximum brightness. At the same time, if separate resistors are connected to the cathode terminals of seven segment display cluster, when a particular seven segment display turns on, resistor connected to the cathode terminal of that seven segment display will become common to all the anode terminals of that seven segment display which will reduce the brightness of that seven segment display considerably. From these, we can conclude that, current limiting resistors should be connected to the anode terminals (a, b, c, d, e, f, g and dp).

Control Seven Segment Display Cluster using Arduino  >>>>

Thursday 25 September 2014

How to Write Superscript and Subscript Letters in Blogger ?

          While writing some blogs, we will have to convert certain letters to subscript or superscript. Blogger is not providing a direct tool to write subscript and superscript letters. Some HTML tricks are used to write subscript and superscript letters in blogger.

          In the following image, we have to write "th" as superscript and "2" as subscript. Some modifications are required in the HTML to write superscript and subscript letters in blogger. For that, covert the editor from "Compose" mode to "HTML" mode.


Now your editor will be as given below.

         Put <sup> and </sup> tags before and after "th". Similarly, put <sub> and </sub> tags before and after "2" as shown below.

          Now convert your editor from "HTML" mode to "Compose" mode again. "th" will be converted to superscript and "2" will be converted to subscript.

Wednesday 24 September 2014

Scrolling Number Display in a Cluster of 8 Seven Segment Displays using Arduino

<<<<  Previous : Design an Amazing Pattern in Seven Segment Display Cluster

          We have found the circuit for controlling a cluster of 8 common cathode seven segment displays using arduino and 74595 in previous blogsClick here to start reading from the beginning of "controlling a cluster of eight common cathode seven segment displays using arduino and 74595".

          Here, we will create an arduino program that will generate scrolling numbers in a cluster of 8 common cathode seven segment displays.


           Circuit is given here. Complete that circuit. Program for generating scrolling numbers is given below. Copy the program and 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=0,j=0,k=0,length_of_anode_terminal_array, anode_terminal_value=0,temp=0;

int anode_terminal_array[]={63, 6, 91, 79, 102, 109, 125, 7, 127, 111, 0};
int cathode_terminal_array[]={254, 253, 251, 247, 239, 223, 191, 127};

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(k=0;k<25;k++) // This loop provides a time delay to adjust the speed of display 
  {
  for(j=0;j<8;j++) // This loop is for accessing the array elements
  {
    for(i=0;i<2;i++) // This loop will increase the brightness of LEDs
    {
      // take the latchPin low so the LEDs don't change while you're sending in bits:     
      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, MSBFIRST, anode_terminal_array[j]);
      // 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);
      shiftOut(dataPin2, clockPin2, MSBFIRST, cathode_terminal_array[j]);
      // 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);  
  } 
}


  /*** ROTATE THE 'anode_terminal_array' ONE POSITION TOWARDS LEFT SIDE *****/ 

  // Get the length of "anode_terminal_array"  
  length_of_anode_terminal_array = sizeof(anode_terminal_array)/sizeof(anode_terminal_array[0]);

  // Copy the first element of array to 'temp'.
  temp=anode_terminal_array[0];
  
  /**** Shift all the elements of "anode_terminal_array", other than first element, 
  one position towards left ****/
  for(i=1;i<length_of_anode_terminal_array;i++)
  {
    anode_terminal_array[i-1]=anode_terminal_array[i];
  }  
  
  /**** Copy the value in 'temp' to last position of 'anode_terminal_array'.
  Then first element in old array becomes last element in new array ****/
  anode_terminal_array[length_of_anode_terminal_array-1]=temp;    
}

          If uploading is successful, scrolling numbers will be generated in the seven segment displays. Speed of scrolling can be adjusted by changing the upper limit of "k" loop. Brightness of LEDs can be adjusted by changing the upper limit of "i" loop.

Next : Video of Amazing Pattern in a Cluster of 8 Common Cathode Seven Segment Displays >>>>

Display 1, 2 and 3 in 1st, 2nd and 3rd SSDs using Arduino and 74595 (Part 16 of 16)

<<<< Read Previous Part (Part 15)

          We have found the circuit for controlling a cluster of 8 common cathode seven segment displays using arduino and 74595 in previous blogs. Click here to start reading from the beginning of "controlling a cluster of eight common cathode seven segment displays using arduino and 74595".

          Here, we will generate an arduino program that will display "1.", "2." and "3." in first, second and third common cathode seven segment displays as given below.


Circuit is given here. Complete that circuit and upload the following program 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=0;

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() {

  /*************** DISPLAYS NUMBER 2 **************/ 
  for(i=0;i<2;i++)  //Increase the brightness of LEDs
  {
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 0 0 0 0 1 1 0 (134) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 134);
    // 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 2nd 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); 

  /*************** DISPLAYS NUMBER 2 **************/ 
  for(i=0;i<2;i++)  //Increase the brightness of LEDs
  {
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 1 0 1 1 0 1 1 (219) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 219);
    // 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 0 1 (253) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 253);
    // 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); 
 
  /*************** DISPLAYS NUMBER 3 **************/
  for(i=0;i<2;i++)  //Increase the brightness of LEDs
  {
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 1 0 0 1 1 1 1 (207) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 207);
    // 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 0 1 1 (251) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 251);
    // 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);     
}


          "1.", "2." and "3." will be displayed in the first, second and third common cathode seven segment displays. All other seven segment displays will turn off.

Working of program

          Working of program is simple. Program will send 134 (1 0 0 0 0 1 1 0) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 0 0 0 0 1 1 0. After that, program will send 254 (1 1 1 1 1 1 1 0) to second 74595. Then, Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 1 1 1 1 1 1 1 0. This will turn on b, c and dp segments of first common cathode seven segment display and turn off all other seven segment displays as given in this part. When b, c and dp segments of a seven segment display is on "1." will be displayed in the seven segment display.

          After displaying these, arduino will send 255 (1 1 1 1 1 1 1 1) to the second 74595 to turn off all the seven segment displays.

          Then, program will send 219 (1 1 0 1 1 0 1 1) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 1 0 1 1 0 1 1. After that, program will send 253 (1 1 1 1 1 1 0 1) to second 74595. Then, Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 1 1 1 1 1 1 0 1. This will turn on a, b, d, e, g and dp segments of second common cathode seven segment display and turn off all other seven segment displays as given in this part. When a, b, d, e, g and dp segments of a seven segment display is on "2." will be displayed in the seven segment display.

          After displaying these, arduino will send 255 (1 1 1 1 1 1 1 1) to the second 74595 to turn off all the seven segment displays.

          Then, program will send 207 (1 1 0 0 1 1 1 1) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 1 0 0 1 1 1 1. After that, program will send 251 (1 1 1 1 1 0 1 1) to second 74595. Then, Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 1 1 1 1 1 0 1 1. This will turn on a, b, c, d, g and dp segments of third common cathode seven segment display and turn off all other seven segment displays as given in this part. When a, b, c, d, g and dp segments of a seven segment display is on "3." will be displayed in the seven segment display.

          After displaying these, arduino will send 255 (1 1 1 1 1 1 1 1) to the second 74595 to turn off all the seven segment displays.

Principle of Operation

          Display works based on the principle of "persistence of vision". Only one number will be displayed at a time (1. or 2. or 3.). "1." will be displayed first. Then, entire display will turn off  and "2." will be displayed. Entire display will be turned off again and "3." will be displayed. After displaying "3.", display will be turned off and "1." will be displayed again. These processes takes place within 1/16th part of a second which will give an illusion to our eyes that "1.", "2." and "3." are displaying together.

Next : Design a Pattern in Seven Segment Display Cluster  >>>>

Program to Display 1 and 2 in 1st and 2nd SSDs using 74595 ICs (Part 15 of 16)

<<<< Read Previous Part (Part 14)

          We have found the circuit for controlling a cluster of 8 common cathode seven segment displays using arduino and 74595 in previous blogs. Click here to start reading from the beginning of "controlling a cluster of eight common cathode seven segment displays using arduino and 74595".

          Here, we will generate an arduino program that will display "1." and "2." in first and second common cathode seven segment displays as given below.


Circuit is given here. Complete that circuit and upload the following program 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=0;

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() {

  /*************** DISPLAYS NUMBER 2 **************/ 
  for(i=0;i<2;i++)  //Increase the brightness of LEDs
  {
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 0 0 0 0 1 1 0 (134) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 134);
    // 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 2nd 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); 

  /*************** DISPLAYS NUMBER 2 **************/ 
  for(i=0;i<2;i++)  //Increase the brightness of LEDs
  {
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 1 0 1 1 0 1 1 (219) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 219);
    // 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 0 1 (253) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 253);
    // 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);     
}


          "1." and "2." will be displayed in the first and second seven segment displays. All other seven segment displays will turn off.

Working of program

          Working of program is simple. Program will send 134 (1 0 0 0 0 1 1 0) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 0 0 0 0 1 1 0. After that, program will send 254 (1 1 1 1 1 1 1 0) to second 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 1 1 1 1 1 1 1 0. This will turn on b, c and dp segments of first common cathode seven segment display and turn off all other seven segment displays as given in this part. When b, c and dp segments of a seven segment display is on "1." will be displayed in the seven segment display.

          After displaying these, arduino will send 255 (1 1 1 1 1 1 1 1) to the second 74595 to turn off all the seven segment displays.

          Then, program will send 219 (1 1 0 1 1 0 1 1) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 1 0 1 1 0 1 1. After that, program will send 253 (1 1 1 1 1 1 0 1) to second 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 1 1 1 1 1 1 0 1. This will turn on a, b, d, e, g and dp segments of second common cathode seven segment display and turn off all other seven segment displays as given in this part. When a, b, d, e, g and dp segments of a seven segment display is on "2." will be displayed in the seven segment display.

          After displaying these, arduino will send 255 (1 1 1 1 1 1 1 1) to the second 74595 to turn off all the seven segment displays.

Principle of Operation

          Display works based on the principle of "persistence of vision". Only one number will be displayed at a time (either 1. or 2.). "1." will be displayed first. Then turn off the entire display. After that, "2." will be displayed within 1/16th part of that second at which "1." was displayed which gives an illusion to our eyes that "1." and "2." are displaying together. Then turn off the entire display and "1." will be displayed again. "1." will be displayed within 1/16th part of that second at which "2." was displayed.

Continued in Next Part (Part 16)  >>>>

Monday 22 September 2014

Amazing Pattern in a Cluster of 8 Seven Segment Displays using Arduino and 74595

<<<< Previous : Control 8 Seven Segment Displays using Arduino and 74595

          In the past few blogs, we had seen the logic behind accessing and displaying numbers on various seven segment displays in a cluster of 8 common cathode seven segment displays. Here, we will design a pattern as shown below.


          Circuit is given here. Complete that circuit. Copy and upload the following program 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=0,k=0, j=0,l=0;
int cathode_terminal_array[]={254, 253, 251, 247, 239, 223, 191, 127};
int anode_terminal_array[]={131, 194, 208, 152, 140, 196, 224, 161};

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(l=0;l<8;l++)  // Loop to access the "anode_terminal_array" elements 
  {
    for(k=0;k<15;k++)  //Loop to adjust the speed of illumination
    {  
      for(j=0;j<8;j++) // Loop to access the "cathode_terminal_array" elements 
      {
        for(i=0;i<2;i++) // Loop to increase the brightness of Display 
        {
          // take the latchPin low so the LEDs don't change while you're sending in bits:     
          digitalWrite(latchPin, LOW);
          shiftOut(dataPin, clockPin, MSBFIRST, anode_terminal_array[l]);
          // 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);
          shiftOut(dataPin2, clockPin2, MSBFIRST, cathode_terminal_array[j]);
          // 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, pattern will be displayed in the cluster of common cathode seven segment displays. Speed of pattern can be adjusted by changing the upper limit of "k" loop.

Next : Scrolling Numbers in a Seven Segment Display Cluster  >>>>

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

<<<< 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)  >>>>

Sunday 21 September 2014

Program to Display 12345678 in 8 Seven Segment Displays using Arduino (Part 13 of 16)

<<<< Read Previous Part (Part 12)

           In the past few blogs, we had generated the programs to display 1, 2, 3, 4, 5, 6, 7 and 8 individually in seven segment displays. Here we will generate a program that will display 1, 2, 3, 4, 5, 6, 7 and 8 together in the seven segment display cluster as given below.


          This display works based on the principle of persistence of vision which means a frame seen by our eyes will remain in our eyes for the next 1/16th part of a second. If the next frame is seen within 1/16th part of that second, our eyes will feel that both frames are continuous. If the frames given below are displayed at a high speed, our eyes will feel that 1, 2, 3, 4, 5, 6, 7 and 8 are displaying together.
          Programs given in past few blogs is combined to generate the new program to display 1, 2, 3, 4, 5, 6, 7 and 8 together. Circuit is given here. Complete that circuit. Download the program as a file from the following blue box and upload to your arduino board.
          If uploading is successful, 1, 2, 3, 4, 5, 6, 7 and 8 will be displayed in corresponding seven segment display. By making proper modifications in program, we can display any number in any of the seven segment displays.
Continued in Next Page >>>>

Program and Working of Circuit to Display 9 in the Eighth SSD (Part 12 of 16)

<<<< Read Previous Part (Part 11)

          We have found the circuit for controlling a cluster of 8 common cathode seven segment displays using arduino and 74595 in previous blogs. Click here to start reading from the beginning of "controlling a cluster of eight common cathode seven segment displays using arduino and 74595".

          Here, we will generate an arduino program that will display "9." in eighth common cathode seven segment display as given below.


Circuit is given here. Complete that circuit and upload the following program 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

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);    
}

"9." will be displayed in the eighth common cathode seven segment display. All other seven segment displays will turn off.
Working of program

          Working of program is simple. Program will send 239 (1 1 1 0 1 1 1 1) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 1 1 0 1 1 1 1. After that, program will send 127 (0 1 1 1 1 1 1 1) to second 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 0 1 1 1 1 1 1 1. This will turn on a, b, c, d, f, g and dp segments of eighth common cathode seven segment display and turn off all other seven segment displays as shown in the following image. When a, b, c, d, f, g and dp segments of a seven segment display is on "9." will be displayed in the seven segment display.

          After displaying these, arduino will send 255 (1 1 1 1 1 1 1 1) to the second 74595 to turn off all the seven segment displays. Use of this function will be more clear, when you try to turn on more than one seven segment display at a time.

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