Pages

Thursday 31 July 2014

Tutorial of 7473, Master - Slave J-K Flip - Flops with Complementary Outputs

          7473 is a commonly used Master-Slave J-K Flip-Flop IC. These ICs have two independant  Master-slave Flip-Flops with two complementary outputs. During the positive transistion of clock, data from J and K input is transferred to master and during the negative transistion of clock, data from master get transferred to the slave. If the clock is HIGH, no change will happen to the output ( Q and Qbar ), even if the value of J and K change. Output will change only during the negative transitions of clock. A logical LOW at CLR button will reset the outputs ( Q and Qbar ) and the outputs ( Q and Qbar ) will not change even if the J, K or CLK is changed. CLR should be set to HIGH after clearing the outputs.

          Circuit diagram to put one master-slave flip-flop in circuit is given below. Input pins ( J, K, CLK and CLR ) of the flip-flop is connected to 5V through pull up resistors. Push button switches are connected in between the inputs ( J, K, CLK and CLR ) and ground. These switches helps to shift the inputs between HIGH and LOW voltages. When the switch is OFF, corresponding input will be HIGH. Similarly, if the switch is ON, corresponding input will be LOW. 5V is given from a 5V Voltage regulator. Output is connected to LEDs through current limiting resistors.



Pinout diagram of 7473

          Pinout diagram of 7473 is given below. Each 7473 has two master-slave J K flip-flips. Half portion of IC, above VCC and ground constitutes the first flip-flop and the half portion below VCC and Ground constitutes the second master-slave flip-flop.

Truth Table of 7473

From the truth table, we can conclude that:

1. When CLR is LOW, Q will be LOW and Qbar will be HIGH. These outputs will not change, even if the other inputs ( J, K and CLK)  change, until CLR is set to HIGH.
2. When CLR becomes HIGH, if J is LOW and K is HIGH, Q becomes LOW and Qbar becomes HIGH during the next negative transition.
3. When CLR becomes HIGH, if J is HIGH and K is LOW, Q becomes HIGH and Qbar becomes LOW during the next negative transition.
4. When CLR becomes HIGH, if J and K are HIGH, Q and Qbar will toggle in each negative transitions.
5. When CLR becomes HIGH, if J and K are LOW, Q and Qbar will remain in the previous state and is independant of the state of CLK input.


Why pull up resistors ?.

          5V is given to J, K, CLK and CLR through pull up resistors. Pull up resistors helps to pull the inputs ( J, K, CLK and CLR )  to a HIGH value always. When any of the push button switch turns on, corresponding input ( J, K, CLK and CLR )  get grounded through the push button switch. That input ( J, K, CLK and CLR )  will get LOW voltage.

          If the same circuit is done without connecting the pull up resistors of proper resistance, when any of the swith turns on, power supply get shorted through the switch. High current will flow through the switch due to low resistance of the path. This may damage the power supply and gate operation will not take place.

Why push button switches ?.

          Push button switches are connected in between the inputs ( J, K, CLK and CLR ) and ground as shown in the circuit. Push button switch is most suitable for this purpose, because by default it will be in off state. A switch in off state means, corresponding input ( J, K, CLK and CLR ) gets a HIGH voltage. When a switch is pressed, that switch turns on and corresponding input ( J, K, CLK and CLR )  will get grounded and get a LOW voltage. When press is released switch will automatically turn off. 



Working 7473 can be pictorially represented as shown below.

1. S1 - ON ,  CLR1 - LOW
    S2 - X    , K1 - X
    S3 - X    , J1 - X
    S4 - X    , CLK1 - X
    Q1 - LOW
    Q1bar - HIGH

2. S1 - OFF   ,  CLR1 - HIGH
    S2 - ON     , K1 - LOW
    S3 - OFF    , J1 - HIGH
    S4 - OFF    , CLK1 - HIGH
    Q1 - LOW
    Q1bar - HIGH

3. S1 - OFF   ,  CLR1 - HIGH
    S2 - ON     , K1 - LOW
    S3 - OFF    , J1 - HIGH
    S4 - ON      , CLK1 - LOW
    Q1 - HIGH
    Q1bar - LOW

4. S1 - OFF   ,  CLR1 - HIGH
    S2 - ON     , K1 - LOW
    S3 - OFF    , J1 - HIGH
    S4 - OFF    , CLK1 - HIGH
    Q1 - HIGH
    Q1bar - LOW

5. S1 - OFF   ,  CLR1 - HIGH
    S2 - OFF    , K1 - HIGH
    S3 - ON     , J1 - LOW
    S4 - OFF    , CLK1 - HIGH
    Q1 - HIGH
    Q1bar - LOW
6. S1 - OFF   ,  CLR1 - HIGH
    S2 - OFF    , K1 - HIGH
    S3 - ON     , J1 - LOW
    S4 - ON    , CLK1 - LOW
    Q1 - LOW
    Q1bar - HIGH

 7. S1 - OFF   ,  CLR1 - HIGH
     S2 - OFF    , K1 - HIGH
     S3 - ON     , J1 - LOW
     S4 - OFF   , CLK1 - HIGH
     Q1 - LOW
     Q1bar - HIGH

 8. S1 - OFF   , CLR1 - HIGH
     S2 - OFF   , K1 - HIGH
     S3 - OFF   , J1 - HIGH
     S4 - OFF   , CLK1 - HIGH
     Q1 - LOW
     Q1bar - HIGH

 9. S1 - OFF   ,  CLR1 - HIGH
     S2 - OFF   , K1 - HIGH
     S3 - OFF   , J1 - HIGH
     S4 - ON    , CLK1 - LOW
     Q1 - HIGH
     Q1bar - LOW

 10. S1 - OFF   ,  CLR1 - HIGH
       S2 - OFF   , K1 - HIGH
       S3 - OFF   , J1 - HIGH
       S4 - OFF   , CLK1 - HIGH
       Q1 - HIGH
       Q1bar - LOW

 11. S1 - OFF   ,  CLR1 - HIGH
       S2 - OFF   , K1 - HIGH
       S3 - OFF   , J1 - HIGH
       S4 - ON    , CLK1 - LOW
       Q1 - LOW
       Q1bar - HIGH

12. S1 - OFF   ,  CLR1 - HIGH
      S2 - OFF   , K1 - HIGH
      S3 - OFF   , J1 - HIGH
      S4 - OFF    , CLK1 - HIGH
      Q1 - LOW
      Q1bar - HIGH

 13. S1 - OFF   ,  CLR1 - HIGH
       S2 - OFF   , K1 - HIGH
       S3 - OFF   , J1 - HIGH
       S4 - ON    , CLK1 - LOW
       Q1 - HIGH
       Q1bar - LOW

14. S1 - OFF   ,  CLR1 - HIGH
      S2 - OFF   , K1 - HIGH
      S3 - OFF   , J1 - HIGH
      S4 - OFF   , CLK1 - HIGH
      Q1 - HIGH
      Q1bar - LOW

15. S1 - OFF   ,  CLR1 - HIGH
      S2 - OFF   , K1 - HIGH
      S3 - OFF   , J1 - HIGH
      S4 - ON    , CLK1 - LOW
      Q1 - LOW
      Q1bar - HIGH

16. S1 - OFF   ,  CLR1 - HIGH
      S2 - OFF   , K1 - HIGH
      S3 - OFF   , J1 - HIGH
      S4 - OFF   , CLK1 - HIGH
      Q1 - LOW
      Q1bar - HIGH

17. S1 - OFF  ,  CLR1 - HIGH
      S2 - OFF   , K1 - HIGH
      S3 - OFF   , J1 - HIGH
      S4 - ON    , CLK1 - LOW
      Q1 - HIGH
      Q1bar - LOW

Tuesday 29 July 2014

Practical Demo of S R Latch using 7400 NAND Gate and Push Button Switches

          S R latch is the basic Flip Flop and has an interesting property "memory". It can be set to a state which is retained until explicitly reset. Practically, S R latch can be demonstrated using 7400 NAND gate IC. Circuit is done as shown in the following diagram. Each 7400 has four NAND gates arranged as shown in the pinout diagram. 

          Two NAND gates are used in this circuit. Input is given to S and R through the pull up resistors. Output of the NAND gates are connected to LEDs through current limiting resistors. Output of both NAND gates are loop backed to one input of other NAND gate. 5V for the working of 7400 is given from Arduino or from a 5V regulator. Two push button switches, S1 and S2 controls the voltage level of S and R. 7400 is shown by a box in the circuit diagram. Dotted lines are to demonstrate the continuation of 7400 IC. A break is given to the drawing of 7400 IC by dotted lines. This is for drawing the loop back back connection easily. If the loop back connection is not given in such a way, it will become very difficult to understand the circuit from drawing.   




Pinout diagram of 7400

          Pinout diagram of 7400 is given below. Each 7400 has four NAND gates arranged as shown in the following diagram.
Why pull up resistors ?.

          5V is given to S and R through pull up resistors. Pull up resistors helps to pull the NAND gate input to a HIGH value always. When any of the push button switch turns on, corresponding NAND gate input get grounded through the push button switch. That NAND gate input will get LOW voltage.

          If the same circuit is done without connecting the pull up resistors of proper resistance, when any of the swith turns on, power supply get shorted through the switch. High current will flow through the switch due to low resistance of the path. This may damage the power supply and gate operation will not take place.

Why push button switches ?.

          Push button switches are connected in between the NAND gate inputs ( S and R ) and ground as shown in the circuit. Push button switch is most suitable for this purpose, because by default it will be in off state. A switch in off state means, corresponding NAND gate input (S and R) gets a HIGH voltage. When a switch is pressed, that switch turns on and corresponding NAND gate input will get grounded and get a LOW voltage. When press is released switch will automatically turn off. 


Truth Table of S R Latch

          From the truth table, it is clear that if S=R=1, output ( Q and Qbar ) will retains the previous state. ie if the output ( Q and Qbar ) was 0,1 previously, output will remain at 0,1 when S and R becomes 1. Similarly, if the output ( Q and Qbar ) was 1,0 previously, output will remain at 1,0 when S and R becomes 1. If S=R=0, that state is not allowed.
          Truth table can be pictorially represented as shown below. Working of the circuit is very clear from the animated image given below.

          When S1 turns ON and S2 turns OFF, S will be grounded and R will get HIGH voltage. That is, S will be 0 and R will be 1. If S=0 and R=1, Q will be 1 and Qbar will be 0. That is, first LED will turn ON and second LED will turn OFF. This is the SET condition. This state can be used as memory. Now, if both switches turn on, Q and Qbar will remain in the previous condition ( Q=1, Qbar=0 ).

          When S1 turns OFF and S2 turns ON, S will get HIGH voltage and R will get grounded. That is, S will be 1 and R will be 0. If S=1 and R=0, Q will be 0 and Qbar will be 1. That is first LED will turn OFF and second LED will turn ON. This is the RESET condition. Now, if both switches turn on, Q and Qbar will remain in the previous condition ( Q=0, Qbar=1 ). 

Monday 28 July 2014

Controlling 74LS138, 3 - Line to 8 - Line Decoder / Demultiplexer, using Arduino

          We have already seen Controlling 74138, 3-Line to 8-Line Decoder/Demultiplexer, using Switches. Controlling 74138 using Arduino is more simpler. Circuit is done as shown in the following diagram. Here an arduino mega board is used for controlling 74138. Select pins ( A, B and C ) and enable pins ( G1, G2A and G2B ) are connected to digital pins of arduino. Connections are:

G1 pin of 74138 is connected to the 8th digital pin of arduino.
G2B pin of 74138 is connected to the 9th digital pin of arduino.
G2A pin of 74138 is connected to the 10th digital pin of arduino.
C pin of 74138 is connected to the 11th digital pin of arduino.
B pin of 74138 is connected to the 12th digital pin of arduino.
A pin of 74138 is connected to the 13th digital pin of arduino.




Pinout diagram of 74138

          Pinout diagram of 74138 is given below. It has three enable pins ( G1, G2A, G2B ), three select pins ( A, B, C ) and eight output pins ( Y0 - Y7 ). Vcc is normally 5V and is supplied from Arduino board or from 7805 voltage regulator. 74138 will take data inputs through the select pins and outputs through the output pin having the number same as input. That is,

if the select pins are at L L L ( 0 in decimal ) in the order C B A, output will be through Y0.
if the select pins are at L L H ( 1 in decimal ) in the order C B A, output will be through Y1.
If the select pins are at L H L ( 2 in decimal ) in the order C B A, output will be through Y2.
If the select pins are at L H H ( 3 in decimal ) in the order C B A, output will be through Y3.
If the select pins are at H L L ( 4 in decimal ) in the order C B A, output will be through Y4.
If the select pins are at H L H ( 5 in decimal ) in the order C B A, output will be through Y5.
If the select pins are at H H L ( 6 in decimal ) in the order C B A, output will be through Y6.
If the select pins are at H H H ( 7 in decimal ) in the order C B A, output will be through Y7.

74138 always gives a complemented output. LED will turn off, if there is an output. LED will turn on, if there is no output.






Truth table of 74138

          Truth table of 74138 is given below. 74138 gives inverted output. That is, LED will turn off, if there is an output through corresponding pin. If the output is HIGH ( H ), LED corresponding to that output will turn ON. Similarly, If the output is LOW ( L ), LED corresponding to that output will turn OFF.

          From the truth table, it is clear that G1 should be HIGH ( H ) always. If G1 is LOW ( L ), all the outputs will be HIGH ( H ) and will not change, even if the select (A, B and C) pins change. That is, all the LEDs will turn on. Similarly, G2A and G2B should be LOW ( L ) always. Otherwise, all the outputs will be HIGH ( H ) and will not change, even if the select (A, B and C) pins change.

          If G1 is HIGH ( H ), G2A is LOW ( L ) and G2B is LOW ( L ) , outputs will change with change in select pins ( A, B and C ). Changes in output with change in input is clearly given in the truth table given above.


Program

Now upload the following program to your arduino board.

int G1 = 8;        // G1 pin of 74138 is connected to the 8th pin of arduino
int G2B = 9;     // G2B pin of 74138 is connected to the 9th pin of arduino
int G2A = 10;   // G2A pin of 74138 is connected to the 10th pin of arduino

int C = 11;        // C pin of 74138 is connected to the 11th pin of arduino
int B = 12;        // B pin of 74138 is connected to the 12th pin of arduino
int A = 13;        // A pin of 74138 is connected to the 13th pin of arduino

// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pins as an output.
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);

  pinMode(G2B, OUTPUT);
  pinMode(G2A, OUTPUT);
  pinMode(G1, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(G2B, LOW);   // Set G2B to LOW
  digitalWrite(G2A, LOW);   // Set G2A to LOW
  digitalWrite(G1, HIGH);     // Set G1 to HIGH


  // Input 0 0 0 ( 0 in decimal ) in the order C B A. Output will be through Y0
  digitalWrite(A, LOW);  
  digitalWrite(B, LOW);  
  digitalWrite(C, LOW);  
  delay(1000);          

  // Input 0 0 1 ( 1 in decimal ) in the order C B A. Output will be through Y1
  digitalWrite(A, HIGH);  
  digitalWrite(B, LOW);  
  digitalWrite(C, LOW);  
  delay(1000);

  // Input 0 1 0 ( 2 in decimal ) in the order C B A. Output will be through Y2
  digitalWrite(A, LOW);  
  digitalWrite(B, HIGH);  
  digitalWrite(C, LOW);  
  delay(1000);

  // Input 0 1 1 ( 3 in decimal ) in the order C B A. Output will be through Y3
  digitalWrite(A, HIGH);  
  digitalWrite(B, HIGH);  
  digitalWrite(C, LOW);  
  delay(1000);

  // Input 1 0 0 ( 4 in decimal ) in the order C B A. Output will be through Y4
  digitalWrite(A, LOW);  
  digitalWrite(B, LOW);  
  digitalWrite(C, HIGH);  
  delay(1000);

  // Input 1 0 1 ( 5 in decimal ) in the order C B A. Output will be through Y5
  digitalWrite(A, HIGH);  
  digitalWrite(B, LOW);  
  digitalWrite(C, HIGH);  
  delay(1000);

  // Input 1 1 0 ( 6 in decimal ) in the order C B A. Output will be through Y6
  digitalWrite(A, LOW);  
  digitalWrite(B, HIGH);  
  digitalWrite(C, HIGH);  
  delay(1000);

  // Input 1 1 1 ( 7 in decimal ) in the order C B A. Output will be through Y7
  digitalWrite(A, HIGH);  
  digitalWrite(B, HIGH);  
  digitalWrite(C, HIGH);  
  delay(1000);
}

Output will be a running LEDs. Reduce the time delay to increase the speed of running LEDs.

Sunday 27 July 2014

Controlling 74LS138, 3 - Line to 8 - Line Decoder / Demultiplexer, using Switches

          74138 is a commonly used 3-line to 8-line demultiplexer/decoder. 74138 is specifically designed for high speed memory decoders and data transmission systems. It is a shottkey-clamped TTL system and reduces the effective system delay considerably. Pinout diagram of 74138 is given below. It has three enable pins ( G1, G2A, G2B ), three select pins ( A, B, C ) and eight output pins ( Y0 - Y7 ). Vcc is normally 5V and is supplied from Arduino board or from 7805 voltage regulator. 74138 will take data inputs through the select pins and outputs through the output pin having the number same as input. That is,

if the select pins are at L L L ( 0 in decimal ) in the order C B A, output will be through Y0.
if the select pins are at L L H ( 1 in decimal ) in the order C B A, output will be through Y1.
If the select pins are at L H L ( 2 in decimal ) in the order C B A, output will be through Y2.
If the select pins are at L H H ( 3 in decimal ) in the order C B A, output will be through Y3.
If the select pins are at H L L ( 4 in decimal ) in the order C B A, output will be through Y4.
If the select pins are at H L H ( 5 in decimal ) in the order C B A, output will be through Y5.
If the select pins are at H H L ( 6 in decimal ) in the order C B A, output will be through Y6.
If the select pins are at H H H ( 7 in decimal ) in the order C B A, output will be through Y7.

74138 always gives a complemented output. LED will turn off, if there is an output. LED will turn on, if there is no output.



Controlling 74138 using switches

          We have already seen the basic characteristics of 74138. Next is to use 74138 in circuit. Controlling 74138 using switches is simple, but it will take a little time. If you are a beginner, definetly you will get confused atleast once before getting the proper output. Circuit is done as shown in the following diagram. Six switches are used in the circuit. First three switches are for controlling the Enable pins (G1, G2A and G2B ) and the next three switches are for controlling the select pins (A, B and C). Switches are used for controlling the contact of these control pins ( enable and select pins) to ground. Eight outputs ( Y0 - Y7 ) are connected to seperate LEDs through current limiting resistors of 1K each.

Why Pull Up resistors ?.

          I had already published one blog on controlling NAND gate using Pull down resistors  But in this circuit, I used pull up resistors. Both methods are acceptable. While controlling NOT gate using switches, I found that pull up resistors are more effective than pull down resistors. In this circuit, voltage for the control pins (enable and select pins) are supplied through the pull up resistors. A switch is also connected to the control pins ( enable and select pins ). When the switch turns on, corresponding control pin ( enable and select pin ) get connected to ground through switch. Voltage source also get grounded through the pull up resistor. So, that control pin ( enable and select pin ) will be at logical LOW. Similarly, when the switch is off, corresponding control pin (enable and select ) will get high voltage through the pull up resistor. So, that control pin (enable and select ) will be at logical HIGH.

          If pull up resistors are not used, when the switch turns on, power supply get shorted, high current will flow through that switch, due to low resistance of path. This will damage the power supply. Pull up resistor provides necessary resistance to the path to limit the current flow when switch turns on and hence protect the power supply from shorts.


Truth table of 74138

          Truth table of 74138 is given below. Voltage at a control ( enable or select ) pin will be HIGH ( H ), if the switch corresponding to that control ( enable or select ) pin is OFF. Similarly, voltage at a control ( enable or select ) pin will be LOW ( L ), if the switch corresponding to that control ( enable or select ) pin is ON. Because, switch will ground the voltage. 74138 gives inverted output. That is, LED will turn off, if there is an output through corresponding pin. If the output is HIGH ( H ), LED corresponding to that output will turn ON. Similarly, If the output is LOW ( L ), LED corresponding to that output will turn OFF.

          From the truth table, it is clear that G1 should be HIGH ( H ) always. If G1 is LOW ( L ), all the outputs will be HIGH ( H ) and will not change, even if the select (A, B and C) pins change. That is, all the LEDs will turn on. Similarly, G2A and G2B should be LOW ( L ) always. Otherwise, all the outputs will be HIGH ( H ) and will not change, even if the select (A, B and C) pins change.

          If G1 is HIGH ( H ), G2A is LOW ( L ) and G2B is LOW ( L ) , outputs will change with change in select pins ( A, B and C ). Changes in output with change in input is clearly given in the truth table given above.

State of switch and voltage at corresponding control (enable or select) pin

If switch S1 is OFF, Voltage at G1 will be HIGH ( H ). If switch S1 is ON, Voltage at G1 will be LOW ( L ).
If switch S2 is OFF, Voltage at G2B will be HIGH ( H ). If switch S2 is ON, Voltage at G2B will be LOW ( L ).
If switch S3 is OFF, Voltage at G2A will be HIGH ( H ). If switch S3 is ON, Voltage at G2A will be LOW ( L ).

If switch S4 is OFF, Voltage at C will be HIGH ( H ). If switch S4 is ON, Voltage at C will be LOW ( L ).
If switch S5 is OFF, Voltage at B will be HIGH ( H ). If switch S5 is ON, Voltage at B will be LOW ( L ).
If switch S6 is OFF, Voltage at A will be HIGH ( H ). If switch S6 is ON, Voltage at A will be LOW ( L ).

Enjoy decoding...

Saturday 26 July 2014

Control 7404, NOT Gate IC, Using Arduino Mega

          We have already seen, controlling 7404 using switch. Controlling 7404 using Arduino is more simple. Circuit is done as shown in the following diagram. An arduino mega is used to control 7404. 5V for IC is supplied from the 5V pin of Arduino Mega. Ground is given to the, GND pin of Arduino. Output is connected to an LED through a current limiting resistor to protect LED from overcurrent. Pull down resistor is not needed in this circuit because, when the arduino digital pin outputs LOW, voltage level at this digital pin will be less than 2V which will give LOW voltage at the NOT gate input. But in switch controlling of 7404 , pull down resistor must be connected.



Pinout diagram of 7404 is given below

          Each 7404 has six NOT gates arranged as shown in the following diagram. First NOT gate is used for this circuit.

Working of Circuit

          Gate input is connected to the 13th digital pin of Arduino. When the digital pin outputs a HIGH voltage, gate input will be at logical HIGH and gate output will be LOW. This will turn off the LED. Similarly when the digital pin outputs a LOW voltage, gate input will be at logical LOW and the gate output will be HIGH. This will turn off the LED. Truth table is given below.
If the circuit is completed, upload the following program to your Arduino board.

// NOT gate input is connected to the Digital Pin 13 of Arduino
// give it a name:
int NOT_input = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(NOT_input, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(NOT_input, HIGH);   // Give HIGH at the NOT gate input
  delay(1000);               // wait for a second
  digitalWrite(NOT_input, LOW);    // Give LOW at the NOT gate input
  delay(1000);               // wait for a second
}

          If the uploading is successfull, LED at the output of logic gate will blink in one second delay. An inbuilt LED is connected to the 13th pin of arduino. When this LED turn on, LED at the gate output will turn off and vice versa.

Friday 25 July 2014

Control 7404, NOT Gate IC, using Switch

         NOT gate is commonly used to INVERT a logical HIGH to logical LOW or logical LOW to logical HIGH. Each NOT gate has one input and one output. Commonly used NOT gate IC is 7404. Pinout diagram of 7404 is given below. Each 7404 has 6 NOT gates arranged as shown in the following figure. 14th pin is the Vcc and 7th pin is the Ground.


Recommended operating conditions of 7404

         Recommended operating conditions of 7404 is given in the following table. Supply voltage should be less than 5.25V and greater than 4.75V. A voltage greater than 2V will be considered as HIGH level and voltage less than 0.8V will be considered as LOW level. 

Truth table of NOT gate

          Truth table of NOT gate is given below. NOT gate will give a HIGH output, if the input is LOW. Similarly output will be HIGH, if the input is LOW.
Control 7404 using Switch

          Circuit to control 7404 using switch is given below. 5V is supplied from an Arduino board or from 7805 Voltage regulator. Each 7404 has six NOT gates. Any NOT gate can be used in the circuit. First NOT gate is used in this circuit ( A1,Y1 ).

Explanation of the circuit

          When switch is off, input pin of NOT gate will get connected to ground through the pull down resistor. Gate will consider it as logical LOW, So output will be HIGH and LED will turn ON. If the input pin is left unconnected ( not connected to pull down resistor and switch ), IC will assume itself that, voltage at the gate input is logical HIGH. So, turning off the switch without connecting pull down resistor will not give logical LOW at the input. That is, switch will have no effect in changing the voltage level at the gate input if pull down resistor is not connected. Similarly, when the switch turns on, voltage across the input pin will be 5V. Gate will consider it as logical HIGH. so the output will be logical LOW. This will turn off the LED. A current limiting resistor is provided in series with LED to protect LED from overcurrent. Truth table of this circuit is given below.


Alternate Method

           NOT gate can be controlled by another circuit also. Circuit is done as shown in the following diagram. Here pull down resistor is replaced by a switch. Switch is used to control the connection of gate input to ground. When the switch turns on, gate input get connected to ground. Output is connected to an LED through a current limiting resistor for LED protection. Switch in the previous circuit is replaced by a pull up resistor. Pull up resistor pulls the input pins to HIGH, when switch is closed. If pull up resistor is not used, when switch turns on, power supply get shorted through the switch. This will result in large current and will damage the power supply.

Explanation of the Circuit

              When the switch turns off, gate input pin get HIGH voltage from the voltage source through the pull up resistor. So output will be LOW and LED will turn off. But when the switch turns on, gate input get connected to ground and hence the gate input pin will be at logical LOW. So the output will be HIGH. This will turn on LED. Truth table of this circuit is given in the following table.

Thursday 24 July 2014

-5V-0-5V Voltage Regulator Using 7805 and 7905

          We have already seen the Simple Tips for Efficient use of 78xx Linear Voltage Regulators and 79xx Series Three Terminal Voltage Regulators. In this blog, we will see the regulated dual power supply using 7805 and 7905. Regulated dual power supply is designed to create positive and negative voltages. Such voltages are normally used in op-amps.

          A simple circuit to create regulated dual power supply is given below. A positive voltage regulator (7805) and a negative voltage regulator (7905) is used in this circuit. Seperate power supplies ( 9V Transistor battery ) are given to both regulators individually. Filter capacitors are normally connected across the input and output of regulators. Value of capacitance depends on the regulator. Two diodes, D1 and D2 should be connected for reverse bias protection of the regulators. Similarly another two diodes, D3 and D4 should be connected for output polarity reversal protection. Voltage at the output side of 7805 will be +5V and voltage at the output side of 7905 will be -5V. Common point of both ICs will be shorted and the voltage at this point will be 0V.

          Voltage across the output of 7805 and common will be 5V. Similarly, voltage across the common and output of 7905 will be 5V. Voltage across the output of 7805 and 7905 will be 10V.

          Pinout diagram of 7805 and 7905 is given below. In 7805 first pin is the input, second pin is the common and third pin is output. But in 7905, first pin is common, second pin is input and third pin is the output.

If the circuit is done successfully, check the

  1. Voltage across output of 7805 and common - 5V
  2. Voltage across common and output of 7905 - 5V
  3. Voltage across output of 7805 and output of 7905 - 10V

Wednesday 23 July 2014

Reverse Bias Protection for 78xx and 79xx Series Voltage Regulators

          We have already seen 78xx positive voltage regulators and 79xx series negative voltage regulators. One thing we have missed in those circuits is the reverse-bias protection system. This type of protection system is necessary when the input voltage collapse faster than the output voltage. If the output voltage is approximately more than 7V, emitter base junction of the internal or external series pass element get break down and get damaged. Normally a shunt diode is used to prevent this. Shunt diode is connected in such a way that the input supply will reverse bias the diode.

          First circuit is the reverse bias protection circuit for 78xx series and second circuit is the reverse bias protection circuit for 79xx series. Diode is normally connected across the input and output pin of the integrated circuit in such a way that, input will reverse bias the diode. Diode used here is 1N4001.

Tuesday 22 July 2014

NOT Gate Realization using BC 547 and Arduino Mega

          NOT Gate realization using BC 547 and arduino is a simple task. "Transistor as a switch" principle is used here. We had already seen the Circuit to Turn On an LED During Night and Turn Off the Same During Day Using LDR. In that circuit, a light sensing resistor is used to control the base current.  But in this circuit, an arduino mega board will be used. As we know, NOT gate gives a HIGH output if the input is LOW and gives a LOW output if the input is HIGH. In this circuit, input is the state of digital pin of Arduino and output is the LED. Digital pin of Arduino has two states, HIGH and LOW. HIGH is 5V and LOW is 0V. Similarly if the LED turns off, it will be considered as LOW and if it turns on, it will be considered as HIGH. Circuit is done as shown in the following diagram.

Transistor - BC 547 is the transistor used here. It is an NPN transistor and is suitable for small operations.

5V - Normally supplied from arduino or  5V regulator.

R3 -  If R3 is not connected, when transistor turns on, power supply get shorted through C,B,E and F due to the low resistance of transistor. This will increase current abruptly which will damage the transistor as well as power supply.

R4 -  When transistor turns on, for the collector current to flow through the transistor, resistance of  other path ( through CHJF ) should be high. If R4 is not connected, resistance of both parallel paths ( CEF and CHJF ) will be almost same and current will flow through both parallel paths equally, which may turn on the LED even if the transistor is ON.

Observations

LED will TURN OFF when Digital Pin of Arduino is HIGH.
LED will TURN ON  when Digital Pin of Arduino is LOW.


Explanation of the Circuit

          "Transistor as a switch" principle is used in this circuit. When transistor act as switch, a small base current is sufficient to drive a large current from collector to emitter ( through CEF ). Then transistor is said to be in saturation. If the base current is less than a particular amount, transistor will be off and current will not flow from collector to emitter ( through CEF ).

           Arduino is connected in the circuit in such a way that, it will control the current to the base of transistor. Current reaching the collector pin of transistor have two options. Either it can flow through the transistor to ground ( through CEF ). Otherwise, it can flow through 1K resistor and LED to ground (  through CHJF ). Current always choose low resistance path. That is, if the transistor get sufficient base current, transistor turn on and current at the collector pin will flow from collector to emitter and then to ground ( through CEF ). If the transistor don't have sufficient base current, transistor get turn off. So current will flow through the 1K resistor and LED to ground ( through CHJF ). This will turn on LED. That is, if the base current is not sufficient, transistor will turn off and LED will turn on.

         Arduino controlls the current through the base of transistor. When the digital pin of arduino is at HIGH level, then the base of transistor will get sufficient current and transistor will turn on. So current will flow through transistor ( CEF ) and LED will not get sufficient current. So LED will turn off. Similarly, when the digital pin of arduino is at a LOW level, then the base of transistor will not get sufficient current and transistor will turn off. So current will flow through 1K resistor and LED ( CHJF ) and LED will turn on.


Arduino Program.

Now upload the following program to your arduino board.

int base_current = 2; // Digital pin selected to Control base current is 2

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(base_current, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(base_current, HIGH);   // turn the LED OFF by making INPUT HIGH
  delay(1000);               // wait for a second
  digitalWrite(base_current, LOW);    // turn the LED ON by making INPUT LOW 
  delay(1000);               // wait for a second
}

Output

          If uploading is successfull, LED will turn ON when Digital pin is LOW and LED will turn OFF when Digital pin is HIGH. 

Monday 21 July 2014

Turn On an LED During Day and Turn Off in Night Using LDR and BC547

          We have already seen the Circuit to Turn On an LED During Night and Turn Off the Same During Day Using LDR and the Circuit to Sense Light using Arduino Mega and LDR. In this blog, we will see the circuit to turn on LED during the day time and turn off the same at night. Circuit is simple as shown in the following diagram.


Transistor - BC 547 is the transistor used here. It is an NPN transistor and is suitable for small operations.

5V - Normally supplied from Arduino or 5V Regulator.

R1 -  This is a current limiting resistor. It helps to switch the transistor between ON and OFF states by controlling the current through R1 and hence through the base of transistor. If that resistor is not connected, there is a possibility that, base current will always remain high because, LDR alone cannot resist the current considerably to turn off the transistor.

R2 -  It is a pull down resistor. It will ground the base, if there is no external signals to the base of transistor. When an external signal is connected, beginners confuse whether this signal get grounded through R2. But this signal will not get grounded because of high resistance of R2 ( 10K ).

R3 -  If R3 is not connected, when transistor turns on, power supply get shorted through A,C,B,E and F due to the low resistance of transistor and LED. This will increase current abruptly which will damage the transistor, LED and power supply.
Observations

LED will TURN OFF when LDR is kept at DARK.
LED will TURN ON  when  LDR is kept at LIGHT.

Explanation of the Circuit

          "Transistor as a switch" principle is used to turn on and turn off an LED depending on the background light condition. When transistor act as switch, a small base current is sufficient to drive a large current from collector to emitter ( through ACEF ). Then transistor is said to be in saturation. If the base current is less than a particular amount, transistor will be off and current will not flow from collector to emitter ( through ACEF ).

           LDR is connected in the circuit in such a way that, it will control the current to the base of transistor. If the transistor get sufficient base current, transistor turn on and current at the collector pin will flow from collector to emitter and then to ground through LED ( through ACEF ). This will turn on the LED. If the transistor don't have sufficient base current, transistor turn off. So current will not flow through the transistor and LED will turn off.

         LDR controlls the current through the base of transistor. This circuit will turn on LED during day and turn off LED during night. During day time, resistance of LDR will be less which will drive more current to base. This will turn on the transistor and collector current will flow through the transistor to ground ( through CEF ). This will turn on LED. During night, resistance of  LDR will increase which will block current flow to the base of transistor. This will turn off the transistor and collector current will not flow through the transistor which will turn off the LED.

Sunday 20 July 2014

Simple Circuit to Sense Light using Arduino Mega and LDR

          Before starting this blog, you should have some idea about the basics of working of LDR and Transistor. Read this blog to get some idea about working of LDR and BC547 transistor .

          We have already seen the Circuit to Turn On an LED During Night and Turn Off the same During Day Using LDR. Here we will design the circuit to sense the presence of light around LDR using Arduino Mega.

           Connections are done as shown in the following circuit diagram. Collector pin of transistor is given to the digital pin 2 of arduino. 5V for the working of transistor is supplied from 5V pin of arduino. Ground for the circuit is given from the Gnd pin of Arduino. Pinout diagram of BC547 is given at the left side top in the following diagram.

Transistor - BC 547 is the transistor used here. It is an NPN transistor and is suitable for small operations.

5V - Normally supplied from Arduino.

R1 -  This is a current limiting resistor. It helps to switch the transistor between ON and OFF states by controlling the current through R1 and hence through the base of transistor. If that resistor is not connected, there is a possibility that, base current will always remain high because, LDR alone cannot resist the current considerably to turn off the transistor.

R2 -  It is a pull down resistor. It will ground the base, if there is no external signals to the base of transistor. When an external signal is connected, beginners confuse whether this signal get grounded through R2. But this signal will not get grounded because of high resistance of R2 ( 10K ).

R3 -  If R3 is not connected, when transistor turns on, power supply get shorted through A,C,B,E and F due to the low resistance of transistor. This will increase current abruptly which will damage the transistor as well as power supply.

Observations

Arduino will read 0, when LDR is kept at LIGHT.
Arduino will read 1, when LDR is kept at DARK.

Tabular column.

          Voltage across various components of the circuit, when LDR is kept at DARK and LIGHT conditions is given in the following table.


Explanation of the Circuit

          "Transistor as a switch" principle is used here. When transistor act as a switch, a small base current is sufficient to drive a large current from collector to emitter ( through ACEF ). Then transistor is said to be in saturation. If the base current is less than a particular amount, transistor will be off and current will not flow from collector to emitter ( through ACEF ).

           LDR is connected in the circuit in such a way that, it will control the current to the base of transistor. Arduino reads current flow from collector pin of transistor to digital pin of arduino. Since the collector pin is connected to the digital pin of arduino, it will read 1 if there is a current flow from collector pin to arduino pin and will read 0, if there is no current flow from collector pin to arduino pin, If the transistor get sufficient base current, transistor turn on and current at the collector pin will flow from collector to emitter and then to ground ( through CEF ). So no current will flow through arduino and it will read 0. If the transistor don't have sufficient base current, transistor get turn off. So current will flow to the digital pin of arduino. Then arduino will read 1.

         LDR controlls the current through the base of transistor. Arduino will read 1 at night and will read 0 during the day time. During the day time, resistance of LDR will be less which will drive more current to base. This will turn on transistor and collector current will flow through the transistor to ground ( through CEF ). So current will not reach the digital pin of arduino and it will read 0 during light. During night, resistance of  LDR will increase which will block current flow to the base of transistor. This will turn off the transistor and collector current will flow to the digital pin of arduino. So arduino will read 1 at dark.

Calculation of the Base current during DARK and LIGHT condition

LDR in DARK

Voltage across R1, Vag  =  0.02V
Resistance of R1             =  1K = 1000 Ohm
Current through R1, Ir1  =  0.02 / 1000  =0.02mA
This current will be approximately equal to the base current, which is not sufficient to turn on the transistor. So arduino will read 1. Because collector current will flow to the digital pin of arduino, not through the transistor.

LDR in LIGHT

Voltage acroos R1, Vag  =  0.18V
Resistance of R1             =  1K = 1000 Ohm
Current through R1, Ir1   =  0.18 / 1000  =0.18mA
This current will be approximately equal to the base current, which is sufficient to turn on the transistor. So LED will turn OFF. Because collector current will flow through the transistor ( CEF ), not through the LED.

Arduino Program to sense the presence of light.

// Collector pin is connected to the Digital pin 2 of Arduino
int collector_pin = 2;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // make the collector pin's pin an input:
  pinMode(collector_pin, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int light_intensity = digitalRead(collector_pin);
  // print out the intensity of light, 1 for Dark and 0 for Light:
  Serial.println(light_intensity);
  delay(1);       
}

          After compiling, upload this program to your arduino board. If the uploading is successfull, open serial monitor. Change the baud rate to 9600. Serial monitor will display the "light_intensity". "light_intensity" will be 1 if the sensor is in darkness and will be 0 if the sensor is in light.

Saturday 19 July 2014

Circuit to Turn On an LED During Night - Automatic Street Light Demo

          An LED that turn on during night and turn off  during day is amazing. Normally a Light Depending Resistor is used to sense the presence of LIGHT. We cannot connect LDR directly to LED. Some switching methods should be adopted to make an LED to respond, when LDR is kept at LIGHT or DARK. Transistors are normally used for switching. This blog will help you to design a circuit that will turn on an LED during night and turn off during day like street lights. By some simple modifications in this circuit, we can easily reverse the operation.

Circuit Diagram

          Connections are done as shown in the following circuit diagram. Transistor used is BC547. Pinout diagram of BC547 is given at right side top of following image.

Transistor - BC 547 is the transistor used here. It is an npn transistor and is suitable for small operations.

5V - Normally supplied from arduino or  5V regulator.

R1 -  This is a current limiting resistor. It helps to switch the transistor between ON and OFF states by controlling the current through R1 and hence through the base of transistor. If that resistor is not connected, there is a possibility that, base current will always remain high because, LDR alone cannot resist the current considerably to turn off the transistor.

R2 -  It is a pull down resistor. It will ground the base, if there is no external signals to the base of transistor. When an external signal is connected, beginners confuse whether this signal get grounded through R2. But this signal will not get grounded because of high resistance of R2 ( 10K ).

R3 -  If R3 is not connected, when transistor turns on, power supply get shorted through A,C,B,E and F due to the low resistance of transistor. This will increase current abruptly which will damage the transistor as well as power supply.

R4 -  When transistor turns on, for the collector current to flow through the transistor, resistance of  other path ( through CHJF ) should be high. If R4 is not connected, resistance of both parallel paths ( CEF and CHJF ) will be almost same and current will flow through both parallel paths equally, which may turn on the LED even if the transistor is ON.


Observations

LED will TURN OFF when LDR is kept at LIGHT.
LED will TURN ON  when  LDR is kept at DARK.

Tabular column.

          Voltage across various components of the circuit, when LDR is kept at DARK and LIGHT conditions is given in the following table.


Explanation of the Circuit

          "Transistor as a switch" principle is used to turn on and turn off an LED depending on the background light condition. When transistor act as switch, a small base current is sufficient to drive a large current from collector to emitter ( through ACEF ). Then transistor is said to be in saturation. If the base current is less than a particular amount, transistor will be off and current will not flow from collector to emitter ( through ACEF ).

           LDR is connected in the circuit in such a way that, it will control the current to the base of transistor. Current reaching the collector pin of transistor have two options. Either it can flow through the transistor to ground ( through CEF ). Otherwise, it can flow through 1K resistor and LED to ground (  through CHJF ). Current always choose low resistance path. That is, if the transistor get sufficient base current, transistor turn on and current at the collector pin will flow from collector to emitter and then to ground ( through CEF ). If the transistor don't have sufficient base current, transistor get turn off. So current will flow through the 1K resistor and LED to ground ( through CHJF ). This will turn on LED. That is, if the base current is not sufficient, transistor will turn off and LED will turn on.

         LDR controlls the current through the base of transistor. This circuit will turn on LED during night and turn off LED during day. During day time, resistance of LDR will be less which will drive more current to base. This will turn on transistor and collector current will flow through the transistor to ground ( through CEF ) because, the resistance of transistor is low compared to resistance of 1K resistor connected in series with LED ( CHJF ). This will turn off LED. During night, resistance of  LDR will increase which will block current flow to the base of transistor. This will turn off the transistor and collector current will flow through 1K resistor and LED ( through CHJF ) which will turn on the LED.

Calculation of the Base current during DARK and LIGHT condition

LDR in DARK

Voltage across R1, Vag  =  0.02V
Resistance of R1             =  1K = 1000 Ohm
Current through R1, Ir1  =  0.02 / 1000  =0.02mA
This current will be approximately equal to the base current, which is not sufficient to turn on the transistor. So LED will turn ON. Because collector current will flow through the LED ( CHJF ), not through the transistor.

LDR in LIGHT

Voltage acroos R1, Vag  =  0.18V
Resistance of R1             =  1K = 1000 Ohm
Current through R1, Ir1   =  0.18 / 1000  =0.18mA
This current will be approximately equal to the base current, which is sufficient to turn on the transistor. So LED will turn OFF. Because collector current will flow through the transistor ( CEF ), not through the LED.