Smart Classroom Door With Calliope Mini

In this project, learners explore smart access and automation systems using the Calliope Mini. They use an InfraRed (IR) sensor to detect movement and program a servo motor to automatically open and close a classroom door. We have included extra challenges that encourage learners to adjust detection distance, opening speed, and door timing, making learning fun and interactive. Through this hands-on experience, learners develop logical thinking, creativity, and responsible design skills while discovering how coding, robotics, and smart systems improve convenience, safety, and accessibility in everyday environments.

ItemPurpose
Calliope Mini V3The microcontroller that reads the sensor and controls the servo
Micro ServoOpens and closes the “door”
IR SensorDetects when someone approaches the doorway
3V Battery Pack for CalliopePowers the Calliope Mini safely
External 5V Battery PackProvides safe power for the servo (higher current needed)
Jumper WiresConnect all components together
Common Ground WireShares ground between Calliope and servo power for correct signals

InfraRed Sensor 

IR Sensor Connections
  1. IR VCC → connect to Calliope VCC pin

  2. IR GND → connect to the Calliope GND pin

  3. IR OUT → connect to Calliope Pin 1

Servo Motor

Servo Motor Connections
  1. Servo VCC (red) → connect to 5V battery pack (+)

  2. Servo GND (brown/black) → connect to 5V battery (–)

  3. IMPORTANT: Connect the same ground line to Calliope GND.

  4. Servo Signal (yellow/white) → connect to Calliope Pin 0

Note: All grounds (GND) must be linked together so the Calliope can control the servo correctly

Follow these steps carefully to open and explore the project in MakeCode for Calliope Mini:

Plug in your Calliope Mini to your computer using a USB cable, then follow the steps in the video to upload your code and bring your project to life!

CodeWhat it Does
set servoPin to P0Sets pin P0 as the pin used to control the servo motor.
set pirPin to P1Sets pin P1 as the pin used to read the PIR motion sensor.
foreverRepeats the blocks inside continuously so the system always checks for movement.
digital read pin P1Reads the PIR sensor to check if movement is detected.
if digital read pin P1 = 1 thenChecks if motion is detected by the PIR sensor.
set servo P0 angle to 90°Turns the servo motor to open the door when motion is detected.
pause 500 msWaits for a short time while the door stays open.
set servo P0 angle to 0°Moves the servo back to close the door after waiting.

IMPORTANT: Ensure the servo extension is added in MakeCode (go toAdvanced → Extensions → Servo).

  • Door not opening?
    Ensure the servo motor signal wire is connected to P0 and that the servo has enough power (external power is recommended).
  • Door opens randomly?
    Check the PIR sensor sensitivity and make sure it is not facing moving objects like curtains or people far away.
  • No movement detected?
    Confirm the PIR sensor OUT pin is connected to P1 and allow the sensor a few seconds to warm up after powering on.
  • Servo moves the wrong way?
    Adjust the servo angles (for example, change 90° to 60° or 120°) to match how the door is mounted.
  • Door closes too fast?
    Increase the pause time (for example, from 500 ms to 2000 ms) so the door stays open longer.
  • Nothing works at all?
    Check that power, ground (GND), and signal wires are correctly connected and not loose.

  • How a PIR sensor can detect movement

  • How a servo motor can open and close a door automatically

  • How microcontrollers use sensor data to make decisions

  • How automation improves convenience and accessibility

  • How coding and robotics work together in real-life systems

  • Basics of sensors, actuators, and simple automation

  • Add a Reset Button using Pin P3
    When pressed, it stops the door motor and resets the system to standby mode.

  • Add an LED indicator strip
    → Red = Door is opening
    → Yellow = Motion detected, preparing to open
    → Green = Door closed / safe

  • Add a light sensor for smarter automation
    The door only opens automatically when motion is detected and it’s dark enough or conditions require it.

  • Create a classroom model with multiple doors
    Test how several doors can operate automatically in different rooms.

  • Add sound effects
    Play a short chime or alert when motion is detected.

  • Add a real-time timer
    Logs how long the door remains open during each detection event.

Use Edge Impulse to build, train, and deploy machine learning (ML) model to make their automatic door system even smarter. The AI learns from movement patterns and predicts when someone is coming.

For example:

  • Movement Predictor: The Calliope Mini observes when and where people usually approach the door and learns to open the door before someone reaches it.
  • Smart Door Action: When the AI predicts someone is coming, it automatically opens the door faster. It can also ignore random movements (like pets or hanging curtains) so the door doesn’t open unnecessarily.
  • Fun Test Game: Students can walk toward the door at different speeds or times, and see if the AI guesses correctly and opens the door at the right moment.