Learning Goal
The goal of this project is to introduce students to robotics, movement, and control using a two-wheel robot car powered by the Calliope mini. Learners will program the robot to move forward, turn, and respond to commands. This project helps students understand motors, direction, and problem-solving through hands-on experimentation. By connecting the robot to vehicles they see every day, students learn how machines follow instructions to move safely and efficiently. The project builds teamwork, creativity, and confidence while strengthening foundational robotics and coding skills.
What You will Need
| Item | Purpose |
|---|---|
| Calliope Mini V3 | Brain of the robot; processes sensor data and controls movement |
| 3V Battery Pack (2× AA or AAA) | Powers the Calliope Mini safely and independently |
| L298N Motor Driver | Controls the two DC motors safely |
| 2 × DC Gear Motors | Drive the robot wheels |
| Ultrasonic Sensor (HC-SR04) | Detects obstacles in front of the robot |
| Robot Car Frame with 2 Wheels | Physical structure of the robot |
| Caster Wheel | Balances the robot |
| 12V Battery Pack | Powers the motors through the L298N |
| Jumper Wires | For all wiring connections |
| USB Cable | Uploading the program to Calliope Mini |
Understand the Circuit
IMPORATNT: This robot uses two power sources:
3V battery pack → powers the Calliope Mini
12V battery pack → powers the motors through the L298N
⚠️ The Calliope Mini is NOT powered from the motor driver.
Only signal wires go between the Calliope and the L298N.
Step 1: Power the Calliope Mini
Connect the 3V battery pack directly to the Calliope Mini battery connector
Note: This battery powers only the Calliope Mini
- Do not connect the Calliope to the 12V battery
- Do not connect Calliope to the L298N 5V pin
Step 2: Power the L298N Motor Driver
Connect 12V battery (+) → L298N Motor Driver +12V
Connect 12V battery (–) → L298N Motor Driver GND
Note: The 12V battery powers only the motors
Step 3: Connect Grounds (VERY IMPORTANT)
Connect L298N Motor Driver GND → Calliope Mini GND
Note: This creates a common ground, allowing the Calliope’s control signals to work correctly.
Step 4: Connect Motors to the L298N Moto Driver
Motor A output → Left wheel motor
Motor B output → Right wheel motor
Note: If the robot moves backward, swap the motor wires.
Step 5: Connect Calliope Control Pins to L298N Moto Driver
These wires carry control signals only not power
L298N IN1 → Calliope Pin P3
L298N IN2 → Calliope Pin P4
L298N IN3 → Calliope Pin P5
L298N IN4 → Calliope Pin P6
Step 6: Connect the Ultrasonic Sensor
The ultrasonic sensor is powered from the motor driver, not the Calliope:
Ultrasonic VCC → L298N 5V
Ultrasonic GND → L298N GND
Ultrasonic TRIG → Calliope Pin P0
Ultrasonic ECHO → Calliope Pin P1
How the System Works
- The ultrasonic sensor measures the distance in front of the robot
- The Calliope Mini reads the distance value
- If the distance is greater than 20 cm, the Calliope sends signals to the L298N motor driver to move forward
- If an obstacle is detected, the Calliope immediately stops the motors
Circuit Diagram With Breadboard
The Project Code
Follow these steps carefully to open and explore the project in MakeCode for Calliope Mini:
When you open the link, you will see a few colorful blocks that makes the project.
Next, click Edit Code tab to be directed to the MakeCode editor
Uploading the Code
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!
Understand the Code
| Code Block | What It Does |
|---|---|
sonar.ping(P0, P1) | Measures distance to obstacle |
if (distance > 20) | Checks if path is clear |
moveForward() | Drives both motors forward |
stopRobot() | Stops all motors |
pause(200) | Stabilizes sensor readings |
Troubleshooting the code
- Robot does not move?
Check motor wires are connected to OUT1/OUT2 and OUT3/OUT4 on L298N. - Robot never stops?
Ensure TRIG is on P0 and ECHO on P1. - Distance always reads 0?
Sensor may be blocked or wired incorrectly. - Motors are weak or slow?
Use fresh batteries (minimum 6V).
What You Have Learned
How L298N motor drivers power DC motors
How ultrasonic sensors measure distance
How microcontrollers make decisions and control robots
How autonomous navigation systems work in real robotics
How to combine motors, sensors, and logic into a smart machine
Extra Challenge
Add a servo motor to rotate the ultrasonic sensor left and right.
Program the robot to turn left or right instead of just stopping.
Add LEDs:
Green = moving
Red = obstacle detected
Add a buzzer that sounds when the robot stops.
Add a reset button to restart movement.
Turn it into a maze-avoiding robot.
AI Extensions
Students can use Edge Impulse (TinyML) to train a model for:
Recognizing hand gestures to control the robot
Predicting the best turning direction using past obstacle data
Detecting clap sounds to stop or start the robot
This transforms the robot into an AI-powered autonomous car, just like real self-driving vehicles.
