IntegrationReviewComprehensive
On this page

Activity 4.2.7 — Unit 4 Integration & Assessment


Learning Objectives

By the end of this lesson, students will be able to:

  1. Explain how sensors, logic circuits, and microcontrollers work together in complete systems
  2. Apply concepts from Units 1-3 to design integrated solutions
  3. Analyze real-world applications of digital electronics
  4. Demonstrate mastery through a comprehensive design problem

Vocabulary

Vocabulary (click to expand)
TermDefinition
IntegrationCombining multiple subsystems into a complete working system
Sensor FusionCombining data from multiple sensors
Voltage DividerCircuit that divides voltage using resistors
H-BridgeCircuit that controls DC motor direction
Closed-Loop ControlSystem that uses feedback to maintain desired state

Part 1: Connecting the Dots

Throughout this course, you’ve learned building blocks of digital electronics. Now let’s see how they fit together into complete systems.

From Components to Systems

Unit 1: Foundations

  • Basic circuit concepts
  • Boolean logic and gates

Unit 2: Combinational Logic

  • Designing with gates
  • Multiplexers, decoders, adders

Unit 3: Sequential Logic

  • Flip-flops and registers
  • Counters and state machines

Unit 4: Integration

  • Sensors (inputs)
  • Microcontrollers (processing)
  • Actuators (outputs)
  • Complete systems

Key insight: Any complex digital system can be broken into these three parts: INPUTS (sensors) → PROCESSING (logic/code) → OUTPUTS (actuators)

How Each Unit Contributes

UnitRole in System
Unit 1Understanding voltage, current, power
Unit 2Signal processing, data encoding, selection
Unit 3Timing, memory, state management
Unit 4System integration, sensors, microcontrollers

Part 2: Topic Review

Sensors: Digital vs Analog

Digital Sensors: Output HIGH or LOW (on/off)

  • IR sensor (object detection)
  • Pushbutton/switch
  • Hall effect sensor (magnetic field)

Analog Sensors: Output continuous voltage

  • Photoresistor (light level)
  • Thermistor (temperature)
  • Potentiometer (position)
  • Force Sensitive Resistor (pressure)

Voltage Dividers

Many sensors are essentially variable resistors. A voltage divider converts resistance to voltage:

Vout = Vin × (R2 / (R1 + R2))

     +5V
       |
      R1 (fixed, e.g., 10k)
       |
       +----> Vout to Arduino A0
       |
      R2 (sensor, varies)
       |
      GND

Motor Types and Drivers

Motor TypeControlDriver Needed
DC MotorSpeed, directionH-Bridge (L293D)
Servo MotorPosition (angle)Servo library
Stepper MotorPrecise stepsStepper library or H-Bridge

H-Bridge Logic (L293D):

Input 1Input 2Motor
00Off (coast)
10Forward
01Reverse
11Off (brake)

State Machines

Moore Machine: Outputs depend only on current state

  • State diagram shows outputs in each state

Mealy Machine: Outputs depend on current state AND inputs

  • More complex, can react to inputs faster

State Table Format:

Current StateInputsNext StateOutputs
WAITINGvehicle=1COUNTINGred LED
COUNTINGcoin=1GATE_OPENgreen LED

Microcontroller Concepts

Arduino Digital I/O:

  • pinMode(pin, INPUT/OUTPUT)
  • digitalWrite(pin, HIGH/LOW)
  • digitalRead(pin)

Arduino Analog I/O:

  • analogRead(pin) → 0-1023
  • analogWrite(pin, value) → PWM (0-255)

Timing:

  • millis() returns milliseconds since startup
  • Use for non-blocking delays
  • Never use delay() in state machine code

PWM (Pulse Width Modulation)

PWM simulates analog output using digital signals:

  • Duty cycle = time HIGH / total time
  • 0% duty = always off (0V)
  • 50% duty = half on (2.5V average)
  • 100% duty = always on (5V)

Applications:

  • LED brightness control
  • Motor speed control
  • Audio generation (tone)

Part 3: The Tollbooth — Full System Analysis

Let’s analyze a complete integrated system: the tollbooth from Lessons 4.1.3 and 4.2.4.

System Breakdown

INPUTS                          PROCESSING                    OUTPUTS
──────────────────────────────────────────────────────────────────
IR Sensor ──────────┐           ┌─────────────────┐          Servo Motor
(pin 2)             │           │ State Machine   │ ───────── (pin 9)
                    │           │                 │
Coin Button ────────┼──────────→│ WAITING         │          Red LED
(pin 3)             │           │ COUNTING        │ ───────── (pin 4)
                    │           │ GATE_OPEN       │          Green LED
                    │           │ GATE_CLOSED     │ ───────── (pin 5)
                    │           └─────────────────┘          Buzzer
                    │                    │                   (pin 6)
                    └────────────────────┘

Hardware/Software Split

What the Logic ICs Did (Unit 3):

  • Store current state (flip-flops)
  • Determine next state (combinational logic)
  • Generate reset signals

What Arduino Does (Unit 4):

  • Store current state (variable)
  • Determine next state (if/else or switch/case)
  • Control timing (millis())
  • Control outputs (digitalWrite, servo)

Trade-offs

AspectDiscrete LogicArduino
Component countMany ICsOne board
Design timeComplexSimpler
ModificationRequires rewiringChange code
SpeedVery fastLimited by clock
TimingExternal componentsProgrammable
Cost (small runs)HigherLower

Part 4: Real-World Applications

Digital electronics is everywhere. Here’s how the concepts apply:

Automation

  • Warehouse robots: Sensors detect objects → microcontroller calculates path → motors move robot
  • Automated checkout: Barcode scanner (digital input) → processor calculates price → display shows total

Robotics

  • Line-following robot: IR sensors detect line → microcontroller adjusts motor speeds → robot follows line
  • Robot arm: Potentiometers at joints → microcontroller reads positions → servo motors move to target angles

IoT (Internet of Things)

  • Smart thermostat: Temperature sensor → microcontroller decides heating/cooling → wireless module sends data to phone
  • Smart lighting: Light sensor detects day/night → microcontroller controls LEDs → scheduled on/off times

Key insight: The concepts you’ve learned form the foundation for careers in robotics, automation, embedded systems, and IoT.


Part 5: Comprehensive Design Problem

Scenario

A parking garage needs a vehicle counting system. The system should:

  1. Count vehicles as they enter (IR sensor)
  2. Display the current count (two 7-segment displays, 00-99)
  3. Show “FULL” when at 50 vehicles (both displays flash)
  4. Have a manual reset button

Design Requirements

  • Use at least one logic IC (74LS90 or 74LS47)
  • Use Arduino for main control
  • Include proper state machine
  • Document your design

Questions to Answer

  1. What sensors are needed? How do they connect to Arduino?
  2. What logic ICs are needed? What do they do?
  3. How do the displays connect? What decoder is needed?
  4. What is the state machine? Draw it.
  5. Write the Arduino code.
Show Solution
DESIGN SOLUTION:

1. Sensors:
   - IR sensor on pin 2 (enter detection)
   - Pushbutton on pin 3 (reset)
   - Both use INPUT_PULLUP

2. Logic ICs:
   - 74LS90 for decade counters (cascaded for 00-99)
   - 74LS47 for BCD-to-7-segment decoding
   
3. Display Connection:
   - 74LS90 #1 (ones): pins QA-QD to 74LS47 #1
   - 74LS90 #2 (tens): pins QA-QD to 74LS47 #2
   - Carry from #1 to clock of #2
   
4. State Machine:
   - COUNTING: Normal operation, count vehicles
   - FULL: At 50+ vehicles, flash displays
   - Reset: Return to 00

5. Arduino Code (key sections):
   
   // In loop():
   if (vehicleDetected && !counting) {
     // Debounce - wait between counts
   }
   
   // Check for FULL
   if (totalCount >= 50) {
     state = FULL;
   }
   
   // In FULL state - flash display
   if (millis() - flashTimer > 500) {
     toggleDisplays(); // Flash on/off
   }

Key insight: The 74LS90 handles the actual counting 
(checks for 50 via Arduino reading), Arduino handles 
state logic and display enable/disable.

Part 6: Self-Assessment Checklist

Before the Engineering Showcase, make sure you can do these:

Concepts

  • Explain how sensors convert physical quantities to electrical signals
  • Describe the difference between digital and analog inputs
  • Draw a block diagram of a complete digital system
  • Explain what PWM is and why it’s useful
  • Describe the difference between Moore and Mealy state machines

Skills

  • Read analog sensors with analogRead()
  • Use map() to convert sensor values to useful ranges
  • Use millis() for non-blocking timing
  • Write code using switch/case for state machines
  • Use the Servo library to control a servo motor
  • Debug using Serial.print()

Projects

  • Built and tested the tollbooth project
  • Created a working Christmas display project
  • Documented all projects with code comments

Best Practices

  • Comment code thoroughly
  • Use functions to organize code
  • Test components individually before integrating
  • Keep backup copies of working code

Part 7: Preparation for Engineering Showcase

Your final project should be polished and ready to demonstrate.

Presentation Checklist

Project:

  • Works reliably (runs without errors)
  • Has clear purpose/mission
  • Includes both hardware and software

Documentation:

  • Code is commented
  • Circuit diagram is accurate
  • Block diagram shows system architecture

Demonstration:

  • Can explain how it works
  • Can show different features/modes
  • Can answer questions about design choices

Common Issues and Fixes

IssueFix
Arduino not respondingCheck USB connection, select correct port
Sensors not workingVerify wiring, check pull-up/down resistors
Code not loadingCheck for syntax errors, verify board selection
Unstable readingsAdd smoothing (averaging), check power supply
Servo jitteringCheck servo power (may need external supply)

Key insight: Start your presentation with a 30-second explanation of what your project does, then demonstrate. Practice this before the showcase!


Summary

  • Complete systems have three parts: INPUTS → PROCESSING → OUTPUTS
  • Unit 1 provides foundation, Unit 2 handles combinational logic, Unit 3 handles sequential logic, Unit 4 integrates everything
  • Sensors convert physical phenomena to electrical signals
  • Microcontrollers provide programmable intelligence
  • PWM enables analog control from digital pins
  • State machines are the key to handling complex behavior
  • The Engineering Showcase demonstrates your learning

Key Reminders

  • Break problems into input/processing/output parts
  • Test each component before integrating
  • Use Serial.println() for debugging
  • Keep backup copies of working code
  • Comment your code for others (and future you!)
  • Be ready to explain your project at the showcase

📝 Unit 4 Reflection

After completing this unit, answer these questions:

  1. What was the most challenging concept in this unit? How did you overcome it?

  2. Which project were you most proud of? What made it successful?

  3. How has your understanding of “how computers work” changed?

  4. What topic would you like to learn more about?


Custom activity — adapted from PLTW Digital Electronics