The world is full of shades of gray and colors, but when we’re looking for logic, we are only looking at black and white. Logic gates are the basic building blocks of circuitry. They can be used to check for what can be on or off, open or closed, or true or false to understand how computers use electricity to encode and transmit information. Using the littleBits logic modules, students can create rules for a circuit to follow, giving students more ability to create interesting and complex interactions. In this lesson, students will learn how to combine various inputs to achieve desired outputs, with the help of logic gates (And, OR, NAND, NOR, XOR, NOT).
littleBits logic modules are available in the Logic Expansion Pack or can be purchased individually. The lesson assumes that students have used littleBits for simple and parallel circuitry. It also assumes some prior knowledge with logic.
Note: You will need to make one photocopy of each of the Logic Gate pages from the PDF.
Students will be able to:
Use logic gates to understand principles of logic
Create truth tables for logic gates
Standards for Mathematical Practice
– MP2: Reason abstractly and quantitatively
– MP4: Model with mathematics
Pre- and Post-Test provided as attached documents
Duration: 2, 45 minute classes
Middle School (ages 11-13)
High School (ages 14-17)
MODULES & ACCESSORIES USED (6)
double AND (1)
double OR (1)
STEP 1 : Check prior knowledge
To see if students have experience with logic, have them complete the pre-test. Remind them that you don’t expect them to get everything correct.
Ask students to generate a list of questions to answer related to the pre-test. What did they understand? What concepts do they need explained? Do they have experience with logic gates, or boolean logic in programming?
STEP 2 : Introduce concepts
Introduce logic gates. You may want to use a short video, https://www.youtube.com/watch?v=aWfrNwn9G-c
In small groups, students should get littleBits modules to make a simple circuit that can do an action, such as light up with a button, run the motor, make noise, etc. Distribute materials and have students create their circuit. Once they are created, each group can go around and demonstrate their circuit. Ask students to explain “input” and “output.”
Explain that the idea of a logic gate is that it checks what goes in and determines what goes out based on various input scenarios. In the real world, logic gates can be thought of as physical gates. Use a gate to explain: If you have a fence, you install a gate. You can now walk to the gate, open it and then walk through. In this example you are the input into the gate and the gate outputs you into the yard.
We can control the behavior of a gate, for instance, by putting a lock on it. If there is one lock on the gate you need to have one key in order to get in. If there are two different locks on the gate you need to have two different keys to get in. In the case of one lock you can say you have a key or don’t have a key. So if it’s true you have the key, you can open the gate. If you don’t have a key it’s false that you can open gate.
Show students how they can write this in a table, called a Truth Table, which are used to show the function of a logic gate. Then, ask them what happens if there are two locks and one gate. How would they get through the gate? Make a 3-column chart on a whiteboard with the top row and four blank rows below. Work with students to use the blank table to determine the combinations that will and will not work. (The only way to get through this gate and to the other side is to unlock lock1 and to unlock lock 2.) Here we are working with an AND operation.
STEP 3 : Boolean logic
Now, tell students they will better understand how an electric gate works.
In small groups, distribute littleBits to make a circuit that makes something turn on and off (such as a light, buzzer, or motor). Tell students to make a circuit to turn something on and off.
Go around the room and have each group turn their power on and off. Ask what they think is input and what is output. Discuss if they think that input is high or low when the button is on and then off.
Explain: an activated input can be described in many ways. When we press a button before a motor module, the motor shaft will turn. In this example, energy passes through the input and can now flow on to the next module. When it is true that energy is flowing, we can describe the status of the input as high. When the button is no longer activated (you stopped pressing it), it is false that energy is flowing through, and we can describe the status of the input as low. It is also common to represent true, and false as a “1”, and a “0”. The trigger for state change is the presence or lack of energy. This is the foundation for boolean logic. When an action can be either true or false, it has two states. When an input can be described as having two states, they have a binary relationship. With binary numbers, we can describe false by calling it 0, and true by calling it 1.
Show the table with State A and complete State B. Example is shown above.
STEP 4 : Logic Gates Practice
Students should already be familiar with simple and parallel circuits. If not, you can use the Logic Modules Series and Parallel Circuits page from the attached PDF.
In this step, you’ll be demonstrating more about the AND module: how to use it, how to make a Truth Table, and how it would be used in the real world. Use the Logic Modules AND Gate sheet to demonstrate the activity. Set up the circuit shown in the photo, or have a couple of students set it up.
Explain that the AND module is a logic gate with two inputs and one output. In order for the AND gate to output on signal, both inputs need to be on at the same time. When this happens, you are able to activate any output module like an LED, a DC motor, or a buzzer. The AND module is a good option for projects in which you want two actions to trigger another. Have students demonstrate this with the Bits. Create a Truth Table for this together, using 0 and 1.
Invite a couple of students up to use the AND module to do the activity “Keep the Beat” to demonstrate how a metronome works. Discuss other examples of things that would use the AND module:
– An electronic door that will only open if it detects a person and the switch is set to unlock.
– A microwave that will only start if the start button is pressed and the door close switch is closed.
STEP 5 : Logic Gates Round Robin
Explain to students that each group will have a different Logic module, a handout, and Bits to make circuits. Each group passes their logic gate and handout to the next group. Alternatively, you could have each group present their logic gate to the class. Organize students into five groups. For each group, distribute:
– One logic module and the handout for: OR gate, XOR gate, NOT gate, NAND gate, NOR gate
– Other modules and accessories (see handouts)
Note: for a more advanced class, you may not want to give out the handout and have them do the activity on their own.
Explain the directions:
– Make the example circuit
– Understand how to create the Truth Table
– Do the Activity
– Create another example using the module
– Come up with at least three examples of uses for your module
After 10-15 minutes, have groups pass their modules and handout and each group works with another module.
Debrief at the end.
STEP 6 : Post-Assessment
(10 minutes) Have students complete the post-test. This may be administered as an exit slip for students to hand in before they leave class.