Circuit Theory

The AND Logic Gate is a computer circuit that outputs TRUE if the two pieces of input data have the same state as each other. Digital electronics have two binary states: TRUE or FALSE. The electric circuits used in digital electronics to build computer logic gates will either be closed or open representing a TRUE or FALSE state.

The schematic diagram in Figure 6-2 shows a basic AND Logic Gate electric circuit in two different states. On the left, we see the circuit with both pushbutton switches closed. In this state, the output for both pushbutton switches is TRUE, and the LED will be on. On the right, we see the circuit when both switches are open. In this state, the output is FALSE, and the LED will be off.

The operation of the AND Logic Gate can easily be programmed into an Arduino microcontroller, as shown in Figure 6-1. Creating an Arduino AND Logic Gate requires a few basic electronic components found in the Ulitmate Microcontroller Pack. The logical AND operator is part of the Arduino sketch library. The Arduino AND Logic Gate will turn on an LED when two inputs are both TRUE and are logical HIGH. Why Use an Arduino Microcontroller to Build an AND Logic Gate? explains the advantages of using a smart chip to create logical gate functions.

Circuit schematic diagram showing an AND Logic Gate controlling an LED

Figure 6-2. Circuit schematic diagram showing an AND Logic Gate controlling an LED

TECH NOTE

When electrical/electronic components are connected with the output of one component becoming the input of the next, we say that they have made a series circuit.

Figure 6-3 shows the Fritzing wiring diagram.

The AND Logic Gate Fritzing wiring diagram; the flat side of the LED is the negative pin

Figure 6-3. The AND Logic Gate Fritzing wiring diagram; the flat side of the LED is the negative pin

Just like the NOT Logic Gate discussed the AND Logic Gate has a special circuit symbol, shown in Figure 6-4. The truth table (TT) shows the logic gate operation. Figure 6-5 is an AND Logic Gate TT.

The AND Logic Gate circuit symbol

Figure 6-4. The AND Logic Gate circuit symbol

The AND Logic Gate truth table

Figure 6-5. The AND Logic Gate truth table

WHY USE AN ARDUINO MICROCONTROLLER TO BUILD AN AND LOGIC GATE?

The AND Logic Gate is a simple electrical circuit where a string of pushbutton switches are wired in series. You can wire it up yourself right now, and get the same results without an Arduino. So the question “Why use an Arduino microcontroller to build an AND Logic Gate?” is very important.

The Arduino microcontroller, like all microcontrollers, has a bunch of programming instructions that are essentially built around logic operators (AND, exclusive OR [XOR], OR, and NOT [Complement(CPL)]). You can use these logic operators to make decisions based on the state of the pushbutton switches (open or closed) and using the appropriate logic operator. As you’ll see, you’ll actually be able to make the same circuit behave differently, simply by changing the Arduino code! Aren’t computers wonderful?


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *