In the previous lesson, we learned about digital electronics. Digital electronics uses “1s” and “0s” to transfer information. We learned about binary numbers and logic level which defines the voltage level/range of a “Low (0)” and “High (1)”. Now, we will start to explore how we can use multiples digital signals and combine them to get one final binary signal. This is done with logic gate. A logic gate is a circuit that will react to one or multiples binary inputs and output a binary signal based on its inputs. A logic gate is designed to do a specific logical operation on its binary inputs. For you information, the circuit inside the logic gate is generally made of transistors or diodes. For our lessons, we don’t need to understand how it work internally but it is good to know what kind of components are inside of a logic gate for your general knowledge. Logic gates are very useful and are the basic building blocks for every digital electronics circuits. A microprocessor is basically thousands to millions of logic gates wisely combine to do tons of mathematical operations and much more. In this lesson, we are going to start with our first logic gate called the “AND” Gate. The “AND” Gate is represent below :

The “AND” gate do the logical operation “AND” and is often represents with “&” or “&&”. The “AND” logical operation produces a “High” output if all of its input are “1s”. If one or multiples of its inputs are “0s”, the output of the “AND” logic gate will be a zero. Logic gate are always draw with inputs on the left and the output on the right. On Figure 1, A and B are the inputs of the “AND” logic gate and we have the output on the right. The symbol shown above is very important since it is the symbol for this particular gate. We will see that other logic gates have different symbols and you should memorize these symbols. Below, you can find the four possible inputs combination with its output result :

**Truth table**

A truth table is often used to describe how a logic gate behave with given inputs. For the “AND” logic gate with 2 inputs, we have the following truth table :

On the left side of the truth table, you have the inputs “A” and “B” with all 4 possibles combination of “0s” and “1s”. First line is “A” equals “0” and “B” equals “0” which result in an output of “0”. The second line is “A” equals “0” and “B” equals “1” which result in an output of “0”. The fourth and last line of the truth table is “A” equals “1” and “B” equals “1” which result in an output of “1” for the “AND” logic gate. Some truth table will use True or False instead of a binary number. True is a “1” and False is a “0”. You will notice that in all truth table, the inputs value will follow a particular pattern. For a two inputs table, you will always have “0” “0” on the first line, “0” “1” on the second line, “1” “0” on the third line and “1” “1” on the final line. We didn’t learn how to count with binary number yet but they are the number 0, 1 , 2 and 3 in the binary system. In later lesson, we will learn how to count with binary number but do note that most truth table for logic gate will followed the binary system for the inputs side of the table. The count starts from 0 up to the number of possible combinations minus one since zero is included. For the “AND” gate with two inputs, there are 4 possible combinations so the truth table will start at 0 and stop at 3.

**3 or more inputs “AND” gate**

We could have more than two inputs with an “AND” gate but there will always be only one output. The 3 or more inputs “AND” gate follows the same rule as the 2 inputs “AND” gate. The “AND” logical operation produces a “High” output if all of its input are “1s”. If one or multiples of its inputs are “0s”, the output of the “AND” logic gate will be a zero. Below, you can find the schematic for a 3 inputs “AND” gate and its truth table :

If you don’t know how many possible inputs combination exists with an “AND” gate, you can calculate it with the following formula :

In the case of the 3 inputs “AND” gate, we have :

For a 4 inputs “AND” gate, we have :

With a 3 inputs “AND” gate, we have 8 possible combinations so the truth table will have eight lines and the inputs will start at the binary value of 0 and end at 7 in the binary system. You can have even more inputs if necessary but the truth table will become bigger. For example, a 4 inputs “AND” gate truth table would have 16 lines which starts to be pretty long. For “AND” gate, the important things to remember is that it produces a “High” output if all of its input are “1s”. If one or multiples of its inputs are “0s”, the output of the “AND” logic gate will always be a zero. This is easier to remember than a huge truth table. Truth table will be more useful with some logic gate that are a bit more complex or when we will starts combining multiples logic gate together which could create a circuit with a very specific behavior.

You might wonder at this point what kind of inputs this logic gate would receive to actually be useful. Let’s say we have an automated table saw inside an enclosure with a door to access the table saw. A person places a block of wood and when the table saw is activated, it will automatically cut the block of wood to the desired length or width. We don’t want a person to be able to start the table saw while a person is placing a block of wood inside the enclosure. We could have two sensors on the door that check if the door is properly closed. These sensors would send a “1” when the door is closed. You would also have two buttons spread far apart and the operator needs to press both at the same time with its two hands to start the table saw. These switch would send a “1” when they are pressed.

The 4 inputs “AND” gate in this case could be used since it will allow to check if the doors is closed with the two sensors sending two “1s” and if the operator is pressing the two buttons which would send the two last “1s” to the 4 inputs “AND” gate. If all conditions are met, we would have 4 “1s” which would means that the 4 inputs “AND” gate sends a “1” to its output. This output would be used to start the table saw. If one of the condition is not met (like if the operators is not pressing the two buttons at the same time or if the door is not closed), the table saw wouldn’t start.

The example above is one of many possibles uses of the “AND” gate. The “AND” gate can be used in a wide variety of applications. This was just a quick example of how useful a logic gate can be. We have completed the lesson on the “AND” gate. We will reuse this logic gate when combining it with others logic gate later in this chapter. In the next lesson, we will explore a different logic gate called the “OR” gate.