Algorithmic Thinking & Flowcharts
Learning Objective
Understand the concept of algorithms as step-by-step instructions. Master conditional logic (IF-THEN-ELSE) through flowcharting, preparing for the creation of automation rules.
Theory: Thinking Like a Computer
What is an Algorithm?
An algorithm sounds like a big scary word, but it's really just a fancy word for a "recipe" or a "set of instructions". Computers are very fast, but they are not smart on their own. They need exact, step-by-step instructions to do anything. If you miss a step, the computer will get confused!
Think of a recipe for baking a cake:
1. Mix flour and sugar.
2. Add eggs.
3. Bake at 180°C for 30 minutes.
If you bake it for 3 hours instead of 30 minutes, you get charcoal! An algorithm must be precise.
The Magic of IF-THEN-ELSE
Computers make decisions using a special trick called IF-THEN-ELSE. It works just like decisions in real life!
THEN (Take an umbrella)
ELSE
THEN (Wear sunglasses)
For Teachers
Computational thinking is a critical 21st-century skill. This lesson helps students transition from manually turning a knob to autonomously setting rules for the MakerBuddy.
Activity: The Human Algorithm
Before we program the MakerBuddy, let's program a human! We will create a flowchart for a daily routine.
Materials Needed:
- Paper and pencils
- Or A whiteboard/blackboard
Step-by-Step Instructions:
- Choose a Routine: Pick a simple daily task like "Getting Ready for School".
- Identify the Start: Draw an Oval labeled "START".
- List Actions: Write down the steps in rectangles.
- Add Decisions: Add at least one Diamond shape for a decision (e.g. "Is it raining?").
- End the Flowchart: Finish with an Oval labeled "END".
- "Run" the Program: Have a partner act out the steps exactly as written!
Challenge: The Smart Home Architect
Design a Smart System
Now apply your flowchart skills to the MakerBuddy IoT Kit components. Be creative!
Scenario 1: The Smart Fan
Goal: Keep the room cool but save energy.
- Input: Temperature Sensor (DHT11)
- Output: Fan (Relay)
- Condition: If Temp > 28°C, Turn Fan ON. Else, Turn Fan OFF.
- Task: Draw the flowchart for this system.
Scenario 2: The Security Light
Goal: Light up the porch only when someone is there AND it is dark.
- Inputs: Motion Sensor (PIR) and Light Sensor (LDR)
- Output: Light (LED)
- Task: Draw a flowchart with two decision diamonds, then combine them with AND. The Rule Engine can place both sensor tests inside one Condition rule — you will build this exact security light in Week 27.
Coming Up Next Week:
Week 21: The Rule Engine & The 4 Loop Modes
