Materials
-
AI Light Switch Activity Information
https://microbit.org/projects/make-it-code-it/ai-light-switch/ -
AI light switch video
https://youtu.be/zr76DdP3kdw?si=FIajDY5AK2RbWoNx -
Example CreateAI Code
https://createai.microbit.org/import?id=ai-light-switch&project=Project%3A%20AI%20light%20switch&name=AI%20light%20switch&editors=makecode -
Getting Started with CreateAI
https://youtu.be/Q8IX6kcDYVo?si=8xinq454ujGTMWvg -
Micro:bit CreateAI Teaching Tips
https://microbit.org/teach/teaching-tools/#micro:bit-createai
Activity Instructions
- Introduce the Activity
- What if you could train a computer to turn lights on without touching a switch?
- Where might that be useful?
- How could a computer recognize your actions?
- Today, you’re building a touchless, micro:bit and AI-powered light switch.
- Introduce AI & Machine Learning
- Machine learning means teaching a computer using examples instead of step-by-step instructions.
- Explain simply:
- You give examples (dataset)
- The computer finds patterns in the data
- It predicts what new inputs are
- We’re going to teach it to recognize movements
- Collect Training Data
- Guide students in CreateAI
- Create movement classes:
- Clapping
- Waving
- Still
- Connect your micro:bit to CreateAI
- Record multiple samples for each class
- The more good examples you give, the better your AI will work.
- Train & Test the Model
- Train model once you have recorded enough data, and see what your AI learned.
- Students:
- Click Train model
- Test movements
- Discuss:
- Does it recognize movement correctly?
- Where does it make mistakes?
- Improve the Model (Iteration)
- AI gets better with better data. Are there any classes that need more data to help improve the accuracy of detecting the movements correctly?
- Students:
- Add more sample data to the classes
- Remove incorrect ones
- Retrain and test
- Connect AI to micro:bit Code
- Students:
- Open project in MakeCode
- Download to both micro:bits
- Explain roles:
- Sender micro:bit → detects movement
- Receiver micro:bit → controls “light”
- Program the Light Switch Logic in MakeCode
- Walk students through creating the code or use the completed code link (provided within MakeCode) to share the completed code with students.
- Discuss the behavior within the code:
- Clap → send “lightsOn”
- Wave → send “lightsOff”
- Receiver:
- “lightsOn” → LEDs ON
- “lightsOff” → LEDs OFF
- Test the System
- Try your micro:bit AI light switch!”
- Students:
- Wear or hold sender micro:bit
- Perform the three actions
- Discuss:
- Does the second micro:bit respond correctly?
- Real-World Connection
- Discuss:
- What is this functionality similar to in the real world?
- Options:
- Smart home devices
- Motion-controlled lighting
- Touchless interfaces
- Accessibility technolog
- Introduce the Activity
- What if you could train a computer to turn lights on without touching a switch?
- Where might that be useful?
- How could a computer recognize your actions?
- Today, you’re building a touchless, micro:bit and AI-powered light switch.
- Introduce AI & Machine Learning
- Machine learning means teaching a computer using examples instead of step-by-step instructions.
- Explain simply:
- You give examples (dataset)
- The computer finds patterns in the data
- It predicts what new inputs are
- We’re going to teach it to recognize movements
- Collect Training Data
- Guide students in CreateAI
- Create movement classes:
- Clapping
- Waving
- Still
- Create movement classes:
- Connect your micro:bit to CreateAI
- Record multiple samples for each class
- The more good examples you give, the better your AI will work.
- Guide students in CreateAI
- Train & Test the Model
- Train model once you have recorded enough data, and see what your AI learned.
- Students:
- Click Train model
- Test movements
- Discuss:
- Does it recognize movement correctly?
- Where does it make mistakes?
- Improve the Model (Iteration)
- AI gets better with better data. Are there any classes that need more data to help improve the accuracy of detecting the movements correctly?
- Students:
- Add more sample data to the classes
- Remove incorrect ones
- Retrain and test
- Connect AI to micro:bit Code
- Students:
- Open project in MakeCode
- Download to both micro:bits
- Explain roles:
- Sender micro:bit → detects movement
- Receiver micro:bit → controls “light”
- Students:
- Program the Light Switch Logic in MakeCode
- Walk students through creating the code or use the completed code link (provided within MakeCode) to share the completed code with students.
- Discuss the behavior within the code:
- Clap → send “lightsOn”
- Wave → send “lightsOff”
- Receiver:
- “lightsOn” → LEDs ON
- “lightsOff” → LEDs OFF
- Test the System
- Try your micro:bit AI light switch!”
- Students:
- Wear or hold sender micro:bit
- Perform the three actions
- Discuss:
- Does the second micro:bit respond correctly?
- Real-World Connection
- Discuss:
- What is this functionality similar to in the real world?
- Options:
- Smart home devices
- Motion-controlled lighting
- Touchless interfaces
- Accessibility technolog
- Discuss:
- Introduce the Activity
- What if you could train a computer to turn lights on without touching a switch?
- Where might that be useful?
- How could a computer recognize your actions?
- Today, you’re building a touchless, micro:bit and AI-powered light switch.
- Introduce AI & Machine Learning
- Machine learning means teaching a computer using examples instead of step-by-step instructions.
- Explain simply:
- You give examples (dataset)
- The computer finds patterns in the data
- It predicts what new inputs are
- We’re going to teach it to recognize movements
- Collect Training Data
- Guide students in CreateAI
- Create movement classes:
- Clapping
- Waving
- Still
- Create movement classes:
- Connect your micro:bit to CreateAI
- Record multiple samples for each class
- The more good examples you give, the better your AI will work.
- Guide students in CreateAI
- Train & Test the Model
- Train model once you have recorded enough data, and see what your AI learned.
- Students:
- Click Train model
- Test movements
- Discuss:
- Does it recognize movement correctly?
- Where does it make mistakes?
- Improve the Model (Iteration)
- AI gets better with better data. Are there any classes that need more data to help improve the accuracy of detecting the movements correctly?
- Students:
- Add more sample data to the classes
- Remove incorrect ones
- Retrain and test
- Connect AI to micro:bit Code
- Students:
- Open project in MakeCode
- Download to both micro:bits
- Explain roles:
- Sender micro:bit → detects movement
- Receiver micro:bit → controls “light”
- Students:
- Program the Light Switch Logic in MakeCode
- Walk students through creating the code or use the completed code link (provided within MakeCode) to share the completed code with students.
- Discuss the behavior within the code:
- Clap → send “lightsOn”
- Wave → send “lightsOff”
- Receiver:
- “lightsOn” → LEDs ON
- “lightsOff” → LEDs OFF
- Test the System
- Try your micro:bit AI light switch!”
- Students:
- Wear or hold sender micro:bit
- Perform the three actions
- Discuss:
- Does the second micro:bit respond correctly?
- Real-World Connection
- Discuss:
- What is this functionality similar to in the real world?
- Options:
- Smart home devices
- Motion-controlled lighting
- Touchless interfaces
- Accessibility technolog
- Discuss:
Tips for Running Activity
- Expect:
- Model inaccuracies (valuable learning moment)
- Need for multiple training attempts
- Emphasize:
- AI is only as good as its data
- Systems connect multiple devices
- Students can design intelligent systems not just code
- Expect:
- Model inaccuracies (valuable learning moment)
- Need for multiple training attempts
- Emphasize:
- AI is only as good as its data
- Systems connect multiple devices
- Students can design intelligent systems not just code
- Expect:
- Model inaccuracies (valuable learning moment)
- Need for multiple training attempts
- Emphasize:
- AI is only as good as its data
- Systems connect multiple devices
- Students can design intelligent systems not just code
Assessment Opportunities
Reflection / Exit Ticket Ideas:
- How did your AI learn to recognize movements?
- What made your model more accurate?
- What happened when it made mistakes?
- How is this different from traditional coding?
Reflection / Exit Ticket Ideas:
- How did your AI learn to recognize movements?
- What made your model more accurate?
- What happened when it made mistakes?
- How is this different from traditional coding?
Reflection / Exit Ticket Ideas:
- How did your AI learn to recognize movements?
- What made your model more accurate?
- What happened when it made mistakes?
- How is this different from traditional coding?
Extension Opportunities
Students can:
- Add a third action (dim lights)
- Control multiple micro:bits at once
- Add sound or external LEDs
- Build a smart room prototype
- Explore accessibility applications
Students can:
- Add a third action (dim lights)
- Control multiple micro:bits at once
- Add sound or external LEDs
- Build a smart room prototype
- Explore accessibility applications
Students can:
- Add a third action (dim lights)
- Control multiple micro:bits at once
- Add sound or external LEDs
- Build a smart room prototype
- Explore accessibility applications