Lab 7: Building Blocks
Lab 7: Building Blocks
1. Assignment description
In this lab you build three digital circuits in pure hardware. You use the 5V and GND pins of the Arduino as a power supply. No code is required. For each circuit you find the correct IC in the lab, look up its datasheet and connect it according to the pinout.
The lab is built up step by step. Each step extends the circuit from the previous one, so do not skip steps.
What we expect:
- A working hardware circuit for part 2.1 and 2.2
- Photos proving that your circuit works for every input combination
- A short reflection of approximately half a page in Chapter 3
Step 2.3 is optional
Step 2.3 is not graded. It is intended for students who finish early.
2. Lab
For every part you need to find the correct IC yourself. Your teacher can tell you which ICs are available. Look up the datasheet online and use it to identify the correct pins before you start connecting anything.
General wiring rules that apply to every part:
- Power the IC with 5V and GND from the Arduino
- A logic 1 input is created by connecting the pin directly to 5V
- A logic 0 input is created by connecting the pin directly to GND
- Always connect unused inputs to GND unless the datasheet says otherwise
- Always connect VCC and GND pins of the IC. A chip without power does nothing
2.1 D Flip-Flop
What do we need?
- 1x D flip-flop IC
- 2x push button with 10K ohm pull-down resistor
- 1x LED with 220 ohm resistor
- Jumper wires
- Breadboard
- Arduino UNO R4 (as power supply only)
A D flip-flop has one data input (D), one clock input (CLK) and one output (Q). The output only changes at the moment the clock receives a rising edge: that is, when CLK goes from 0 to 1. Whatever value D has at that exact moment is stored and appears on Q. Changing D after the clock has risen has no effect until the next rising edge.
Connect the circuit as follows:
- One push button connected to the D input
- One push button connected to the CLK input
- The Q output connected to the LED
- Look up the PR (preset) and CLR (clear) pins in the datasheet and connect them so they are not active
Look up the datasheet for your IC and identify the exact pin numbers for D, CLK, Q, PR, CLR, VCC and GND before you connect anything.
Test all four scenarios below and take a photo for each one. The photo must clearly show the state of both buttons and the LED.
Scenario 1: D = 0, press CLK. The LED should turn off.
Scenario 2: D = 1, press CLK. The LED should turn on.
Scenario 3: D = 1, do not press CLK. The LED should not change.
Scenario 4: D = 0, do not press CLK. The LED should not change.
In your own words, explain what you observed. Why does the LED not change when you only press button D?
2.2 Multiplexer
What do we need?
- 1x multiplexer IC
- 2x push button with 10K ohm pull-down resistor
- 1x LED with 220 ohm resistor
- Jumper wires
- Breadboard
- Arduino UNO R4 (as power supply only)
A multiplexer selects one of several inputs and forwards it to the output. Two select pins (S0 and S1) determine which input is selected.
For a 4-to-1 multiplexer:
| S1 | S0 | Output |
|---|---|---|
| 0 | 0 | I0 |
| 0 | 1 | I1 |
| 1 | 0 | I2 |
| 1 | 1 | I3 |
Set the four inputs to fixed values by connecting them directly to 5V or GND:
| Input | Value | Connect to |
|---|---|---|
| I0 | 1 | 5V |
| I1 | 0 | GND |
| I2 | 1 | 5V |
| I3 | 1 | 5V |
Connect the two push buttons to S0 and S1. Connect the output Y to the LED.
Look up the datasheet for your IC and identify the exact pin numbers for I0–I3, S0, S1, Y, VCC and GND. Pay attention to any enable pins. Check the datasheet to see how to connect them correctly.
Fill in the truth table below based on what you observe. Take a photo for each row. The photo must clearly show the state of both select buttons and the LED.
| S1 | S0 | Expected output | Observed output |
|---|---|---|---|
| 0 | 0 | 1 (I0) | |
| 0 | 1 | 0 (I1) | |
| 1 | 0 | 1 (I2) | |
| 1 | 1 | 1 (I3) |
Do your observed outputs match the expected outputs? If not, describe what went wrong and how you solved it.
In your own words, explain what the multiplexer does. Where could this be useful in a real circuit?
2.3 Extra: Demultiplexer
This step is optional and is not graded.
What do we need?
- 1x demultiplexer IC
- 2x push button with 10K ohm pull-down resistor (select inputs)
- 1x push button as data input
- 4x LED with 220 ohm resistor
- Jumper wires
- Breadboard
- Arduino UNO R4 (as power supply only)
A demultiplexer does the opposite of a multiplexer. It takes one input and forwards it to one of several outputs. The select pins determine which output receives the signal.
| S1 | S0 | Active output |
|---|---|---|
| 0 | 0 | Y0 |
| 0 | 1 | Y1 |
| 1 | 0 | Y2 |
| 1 | 1 | Y3 |
Connect one push button as the data input. Connect two push buttons to S0 and S1. Connect the four outputs Y0–Y3 each to a separate LED.
Active LOW outputs
Some demultiplexer ICs have active LOW outputs, meaning the selected output goes LOW instead of HIGH. If that is the case, the selected LED will turn off instead of on. Check the datasheet and describe what you observe.
Test all four select combinations and observe which LED reacts to your data button. Take a photo for each combination.
| S1 | S0 | Active LED | Data button pressed, LED reacts? |
|---|---|---|---|
| 0 | 0 | Y0 | |
| 0 | 1 | Y1 | |
| 1 | 0 | Y2 | |
| 1 | 1 | Y3 |
Are the outputs active HIGH or active LOW on your IC? How did you find this in the datasheet?
3. Reflection
Write a short reflection of approximately half a page (font: Arial 9.5). Answer the following questions in your own words:
What did you learn?
Which concepts from the theory did you recognise in the lab? Give a concrete example.
What was difficult?
Which step gave you the most trouble? How did you solve it?
What would you do differently?
If you had to redo this lab, what would you approach differently?
D flip-flop in IoT
A D flip-flop stores a single bit. Can you think of a situation in an IoT device where storing a single bit of information is useful?
Datasheets vs step-by-step instructions
What is the difference between working with a datasheet in this lab compared to just following step-by-step instructions? What are the advantages and disadvantages?