# Lights and Sounds of Logic

## Objective

To explore and implement basic logic operations using circuits that light up and make sounds.

## Difficulty

Procedure: Hard

Concept: Hard

## Concept

All digital electronics such as the new cool high definition tv's, iPods™, cell phones, computers work because of logic embedded within them to perform specific operations when prompted by the user. This logic within them, although complex, can be broken down to specific design operations or functions. These specifically defined functions include the AND operator, the OR operator and the INVERSE operator. With these three operators one can design, with a large complex design, all of the electronic devices we see around us. How is that possible? We will explore the basics of how this is done. Although we won't be making any of these devices, we will make a simple logic device that computes the outputs for specific inputs using these operations. You might call your device a very basic computer, because computers are built on the same idea at a much larger scales.

## Required Knowledge

All of the operators, in an engineering perspective, are called gates because physically they are components that perform a specified operation. Each of the gates can have any number of inputs on which it performs the specific operation to output a value. Logic is carried out in binary. Yes, your computer only knows how to talk in 0's and 1's. Your inputs and outputs are always either 0 (false) or 1 (true).

### AND Operators

For any number of inputs an AND operator produces an output of 0 if any of the inputs is 0. If and only if none of the inputs are 0, it outputs a 1. This should make sense because 1 and 0 can be interpreted as true and false or doing something or not doing something respectively. When somebody says "play and sleep", you have to do both to satisfy their condition; doing either one or none won't satisfy the condition. So, for an AND condition to be true, all the input parameters must be true.

Fill in this Truth Table with the expected outcomes to the two given inputs.

Input 1 | Input 2 | Output |
---|---|---|

0 | 0 | |

1 | 0 | |

0 | 1 | |

1 | 1 |

### OR Operators

The OR gate doing the OR operation only outputs a 0 if all the inputs are 0. If any of the inputs are 1, then it outputs a 1. This makes sense because when somebody says "play or sleep", you can either play or sleep to satisfy their condition. So, the OR condition is satisfied (making it true and outputting 1), if at least one of the input parameters is satisfied.

Fill in this Truth Table with the expected outcomes to the two given inputs.

Input 1 | Input 2 | Output |
---|---|---|

0 | 0 | |

1 | 0 | |

0 | 1 | |

1 | 1 |

### Inversion (NOT) Operators

INVERSION operator or INVERTER flips the value of the input. That is, if the input is 1, it outputs a 0 vice versa. It doesn't make sense for it have more than one input.

Fill in this Truth Table with the expected outcomes to the two given inputs.

Input | Output |
---|---|

0 | |

1 |

### Basic Circuits

First, click this link on Series and Parallel Circuits to get a better idea of what they mean.

Make sure you understand what a battery does in a circuit, and what the two resistor configurations (series and parallel) do in the circuit; how is the voltage across each resistor and current passing through each resistor effected?

If you need more information about these circuits, search for them on Wikipedia. Only focus on the resistors, do not worry about capacitors and inductors for this project.

## Design

Since the logic parameters are binary (0 and 1), the implementation of the input and output should also be binary.

Can you design a simple circuit with one or two resistors (LEDs and buzzers can be thought of as resistive elements) to implement the input output binary relationship? The following are some clues you can use.

- Use a switch.
- Your switch toggles (0 and 1) the input from the battery to toggle the output from the light and the buzzer (on and off of the light and sound).
- Make sure that when you turn your input from the battery on, the output is on and vice versa.

Can you extend this to making a INVERTER? Clues:

- Think outside the box on this one; you can either make your circuit flip the output (harder way), or you could flip the inputs (easier and clever way).
- Think about how could flip the input at the switch.
- On and of the switch is relative; calling one configuration on and the other off is purely up to you.
- Rename the on and off on the switch.

Can you design an OR gate with switches for two inputs, say A and B? Hints:

- Think in terms of what makes the buzzer turn on that you toggle with the switch.
- It is the current through them that makes them turn on.
- Which circuit configuration would you use; the Series or Parallel?
- Think about the properties of two the configurations with respect to the current of the circuit.
- Parallel
- Designing the circuit, where would you place the output measure (buzzer), and where would you place the switches for the two inputs?
- How would you test if your inputs are working correctly?
- Use LEDs.

Can you design an AND gate with switches for two inputs, say A and B?

Clue: Follow the same clues as the OR gate.

After your design is complete calculate all the voltages and currents in your gates for all the configurations of the switches. Does the current flow match the logic you expect; verify with the truth tables. If logic is incorrect go back and recheck your calculations and design.

## Materials

- Breadboard
- Wires
- Batteries
- LEDs
- Buzzer
- Switches

## Implementation

Using your circuit drawings, implement your circuit for two inputs. Connect one LED each for each input so you can see the input logic. The LED acts both a resistor and as indicator of logic. Our medium for assessing logic is the flow of current in this experiment. When current is flowing, LED lights up, when its not, it doesn't; the two cases for logic.

Connect the buzzer at the end of the circuit in series with the terminal node because you don't want its resistance characteristics to influence your current flow through the branches. Its purpose is merely to serve as an indicator of the logic of the result. You can use another LED in series with the buzzer if you also want to see the light as a logic indicator too.

## Hypothesis

Propose a specific hypothesis outlining your expectations of all the outcomes for all the inputs in terms of the buzzer and the LEDs.

## Results

After the device is built, try all the combinations of inputs. Observe and record the state of LEDs and the volume of the buzzer. Organize the data in tables.

## Discussion

Interpret the results:

- Why did you get what you observed?
- What was going on with the currents?
- Did any exceptions to the expected results occur? Explain. If they did, go back to the implementation and check the problem.

More interesting questions to explain:

- Are all the buzzer volumes the same?
- Are all the buzzer volumes the same when the LED in series with it glows? Explain. (Hint: Is the current flowing through the LED and buzzer the same for every output of logic 1?)
- Also discuss some critical aspects, limitations, suggested improvements and implications of the methods, implementation, and the use of a logic machine.

## Extensions

- Can you come up with an algorithm for creating the OR gate and AND gate circuits described for n-inputs?
- Try higher number of inputs. Do the results change? Why or why not? (Suggestion: Do not go beyond 5 inputs for the mere hassle of correctly connecting everything unless you really want to.)
- Can you combine the OR and the AND gate to one circuit so that with two switches you can toggle between the two operations?
- Explore Karnaugh Maps online and try to understand how any logic design can be implemented with a combination of these basic gates.