✈ Sky-Lab

Introduction to Drones, Robotics and Edge Devices

Audience: BSc holders (engineering, computer science, physics, mathematics, IT) Format: 10 weeks · 2 h lecture + 3 h lab per week (≈ 50 contact hours) Prerequisites: basic Python, first-year calculus and linear algebra Software: Python 3.9+, numpy, matplotlib — runs on any laptop, no GPU needed

Learning outcomes

By the end of the course, participants can:

  1. Explain how multirotor drones fly, and design and tune a PID controller.
  2. Model a differential-drive robot, and write controllers and path planners for it.
  3. Process sensor data on resource-limited edge devices (filtering, anomaly detection).
  4. Compress a machine-learning model for edge deployment and measure the trade-offs.
  5. Plan an autonomous mission under energy constraints, and fly it safely.
  6. Judge when to compute on the edge versus the cloud, for settings with weak connectivity like rural Ethiopia.

Weekly plan

Week Topic Simulation Exercise Hardware lab
1 Course intro; autonomy stack (sense → think → act); safety and regulation drone_altitude_sim.py (demo) Set up Python; play the Sky-Lab game —
2 Feedback control: P, I, D, anti-windup, tuning drone_altitude_sim.py Ex 1 PID altitude hold —
3 Multirotor physics: thrust, torque, attitude, motor mixing, cascaded control planar_quad_sim.py Ex 2 Motor mixing —
4 Ground robots: differential drive kinematics, odometry diff_drive_sim.py Ex 3 Kinematics Lab B (part 1)
5 Navigation: go-to-goal, sensors (ultrasonic, lidar, IMU), obstacle avoidance diff_drive_sim.py Ex 4 Go-to-goal Lab B (part 2)
6 Path planning: graphs, BFS, Dijkstra, A*; maps and SLAM overview astar_sim.py Ex 5 A* —
7 Edge devices: microcontrollers vs single-board computers, IoT, MQTT, power edge_node_sim.py Ex 6 Filters Lab A (ESP32)
8 On-device intelligence: anomaly detection, TinyML, quantization edge_node_sim.py Ex 7 Anomaly, Ex 8 Quantization Lab C (Raspberry Pi)
9 Mission planning: energy budgets, routing, failsafes; real cases of medical drone delivery mission_sim.py Ex 9 Capstone planner Lab D (Tello)
10 Capstone presentations; ethics, privacy and regulation; careers all Capstone demo Lab D boss challenge

Assessment

Component Weight How
Graded exercises (Ex 1–8) 35% Auto-grader: pass = 70% of the marks for that exercise, medal = the rest (Bronze 80%, Silver 90%, Gold 100%)
Hardware lab quests 25% Instructor signs off checkpoints during the lab
Capstone (Ex 9 + flight demo + 10-minute talk) 30% Route quality from the grader, a safe flight, and the presentation
Knowledge Rush quizzes and participation 10% Best quiz score from the game, plus class engagement

The XP and leaderboard are for motivation. Marks come from the table above, so a student who joins late can still earn full marks.

Gamification design (why it works)

Context examples to use in lectures

Hardware labs

The simulations teach the ideas; these four labs put them on real, low-cost hardware. Each lab mirrors one or more graded exercises, so students re-use the code they already wrote.

Lab Hardware Builds on Time
A. Smart sensor node ESP32 + DHT22 (or DHT11) Ex 6, Ex 7 3 h
B. Obstacle-avoiding robot car Arduino Uno + L298N + 2 DC motors + HC-SR04 Ex 3, Ex 4 4 h
C. Edge AI camera Raspberry Pi 4/5 + Camera Module Ex 8 3 h
D. Programmed drone mission DJI/Ryze Tello (indoor mini drone) Ex 1, Ex 9 3 h

Suggested kit per group of 3–4 students

No kit yet? Every lab can be started in a free online simulator: ESP32 and Arduino circuits run in Wokwi (wokwi.com), and Lab D can be rehearsed with sims/planar_quad_sim.py and sims/mission_sim.py.

Safety and rules (read before Lab D)

Gamification: Hardware Quests

Each lab has "quest" checkpoints. The instructor signs them off and awards bonus XP on the leaderboard sheet (suggested: 50 XP per checkpoint, 100 XP for the lab's "boss challenge").

Lab A — details and quests

Lab A — Smart sensor node (ESP32 + MicroPython)

Story: A rural health post keeps vaccines in a fridge that must stay between 2 °C and 8 °C. Build a node that filters the temperature, detects anomalies on the device, and only sends alarms and short summaries over the network.

Wiring (DHT22)

DHT22 pin ESP32 pin
VCC (+) 3V3
DATA GPIO 4 (add a 10 kΩ pull-up to 3V3 if your module has none)
GND (−) GND

Setup

  1. Flash MicroPython on the ESP32 (download the firmware from micropython.org and follow the ESP32 instructions there; esptool is used for flashing).
  2. Install Thonny (thonny.org) and select MicroPython (ESP32) as the interpreter.
  3. Copy main.py to the board. Edit the Wi-Fi name, password and MQTT broker at the top.
  4. To see messages, subscribe from a laptop: mosquitto_sub -h test.mosquitto.org -t "skylab/<your-group>/#" (public test broker: never send real patient data to it).

Quest checkpoints

  1. Sensor online — raw readings print every 2 s.
  2. Clean signal — paste your EMAFilter from Exercise 6; print raw vs filtered.
  3. Watchdog — paste your detector logic from Exercise 7; breathe on the sensor or touch it with a warm finger to trigger an alarm.
  4. Bandwidth saver — the node publishes only a summary every 60 s plus alarms. Count bytes sent vs a "send everything" design.

Boss challenge: run the node on battery and use machine.deepsleep() between readings. Measure how many hours a 2000 mAh power bank lasts.

Lab B — details and quests

Lab B — Obstacle-avoiding robot car (Arduino)

Story: A small delivery robot must move along a corridor of a health centre without hitting people or furniture.

Wiring

Part Pin Arduino
L298N ENA (left speed, remove jumper) D5 (PWM)
L298N IN1 / IN2 (left direction) D7 / D8
L298N ENB (right speed, remove jumper) D6 (PWM)
L298N IN3 / IN4 (right direction) D9 / D10
HC-SR04 TRIG D11
HC-SR04 ECHO D12
L298N 12V / GND battery + / − (also connect GND to Arduino GND)

Quest checkpoints

  1. Wheels turning — testMotors() drives forward, back, spins left and right. Relate each move to wheel_speeds_to_twist() from Exercise 3.
  2. Eyes open — the serial monitor prints the ultrasonic distance in cm.
  3. Don't crash — the robot drives forward and turns away when an obstacle is closer than SAFE_CM.
  4. Smooth driver — replace the on/off turning with a proportional rule: the closer the obstacle, the slower the robot (same idea as go_to_goal slowing near the goal).

Boss challenge: mount the HC-SR04 on a small servo, scan left/centre/right, and always turn toward the side with the most free space (a 3-beam "lidar").

Lab C — details and quests

Lab C — Edge AI camera (Raspberry Pi)

Story: A camera at a farm co-operative or a clinic entrance must recognise objects locally, without uploading video to the cloud (privacy, no internet, lower cost).

Setup (Raspberry Pi OS, 64-bit)

sudo apt update && sudo apt install -y python3-picamera2
python3 -m venv --system-site-packages ~/edge && source ~/edge/bin/activate
pip install ai-edge-litert numpy pillow      # LiteRT, the new name of TensorFlow Lite
#   older OS? use:  pip install tflite-runtime

Get two versions of an image-classification model, one float32 and one int8 (quantized), plus the labels file. MobileNet models in .tflite format are published by the TensorFlow / LiteRT team (search "mobilenet tflite"), or convert your own with the TensorFlow Lite converter. Put them in this folder as:

model_float.tflite   model_int8.tflite   labels.txt

Run

python classify.py --model model_int8.tflite      # live camera
python classify.py --benchmark                    # compare float vs int8
python classify.py --image test.jpg --model model_float.tflite   # no camera

Quest checkpoints

  1. First sight — the Pi prints the top-3 labels for what the camera sees.
  2. Stopwatch — record inference time (ms) and frames per second.
  3. Squeeze it — run --benchmark: compare file size, speed and top-1 label of the float and int8 models. Connect the result to Exercise 8.
  4. Smart trigger — only save a photo when a chosen label (e.g. "person") has confidence > 0.6. Count how much storage/bandwidth that saves vs recording video.

Boss challenge: measure power draw with a USB power meter, then compute energy per inference (joules) for float vs int8.

Lab D — details and quests

Lab D — Programmed drone mission (Tello)

Story: Rehearse an autonomous delivery route indoors before anyone flies a real delivery drone outdoors.

The Tello is a small, light indoor drone with a Python SDK. It holds altitude and position itself (its own flight controller runs the PID loops you wrote in Exercise 1), so students command high-level moves.

Setup

pip install djitellopy

Turn on the Tello, connect the laptop to its Wi-Fi (TELLO-XXXXXX), then:

python mission.py --dry-run          # prints the plan, does not fly
python mission.py                    # flies (spotter ready!)

Quest checkpoints

  1. Pre-flight check — connect, print battery and temperature; refuse to fly below 30% battery.
  2. Square — take off, fly a 1 m square, land.
  3. Delivery route — fly the waypoint list produced by your Exercise 9 planner (scaled down to fit the room), hovering 2 s at each "health post".
  4. Telemetry log — save height, battery and attitude every 0.5 s to a CSV and plot it. Compare with the altitude plots from sims/drone_altitude_sim.py.

Boss challenge: put a printed marker (e.g. an ArUco tag) on the floor and use the Tello's camera stream with OpenCV to land on it.

Safety rules: see hardware_labs/README.md. Press Ctrl+C at any time — the script then lands the drone.

⬇ Download the student pack (all code for the exercises, simulations and labs)