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:
- Explain how multirotor drones fly, and design and tune a PID controller.
- Model a differential-drive robot, and write controllers and path planners for it.
- Process sensor data on resource-limited edge devices (filtering, anomaly detection).
- Compress a machine-learning model for edge deployment and measure the trade-offs.
- Plan an autonomous mission under energy constraints, and fly it safely.
- 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)
- Clear goals and instant feedback: the grader tells students immediately what failed and gives a hint.
- Mastery, not just completion: Bronze, Silver and Gold medals reward improving a working solution, for example a faster planner or a smoother controller.
- Best attempt counts: retrying never lowers a score, so students experiment freely.
- Badges for meaningful milestones, such as finishing a module or reaching Gold.
- Leaderboard by XP: for large classes, show only the top 10 or form teams, so weaker students are not discouraged.
- Unlockable game levels: the browser game opens harder flight conditions as the student improves.
Context examples to use in lectures
- Medical deliveries by drone to remote health facilities (blood, vaccines, samples).
- Crop monitoring and locust surveillance with drones.
- Vaccine cold-chain monitoring with IoT sensors at rural health posts.
- Warehouse and hospital delivery robots.
- Edge cameras for traffic counting or wildlife monitoring where the internet is unreliable.
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
- 1 × ESP32 DevKit board, 1 × DHT22 sensor, breadboard, jumper wires, micro-USB cable
- 1 × 2WD robot car chassis kit (2 DC gear motors, wheels, battery box), 1 × Arduino Uno, 1 × L298N motor driver, 1 × HC-SR04 ultrasonic sensor, 2 × 18650 batteries or 6 × AA
- 1 × Raspberry Pi 4 (4 GB) or Pi 5, Camera Module 3, 32 GB microSD, power supply
- 1 × Tello drone per class (shared), spare batteries, propeller guards
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)
- Fly indoors in a netted or cleared room, propeller guards on, nobody under the drone.
- One pilot, one spotter. The spotter holds the emergency "land" key.
- Check battery level before every flight (the script refuses to fly below 30%).
- Outdoor drone flights are regulated. In Ethiopia, check the current rules and permit requirements of the Ethiopian Civil Aviation Authority before flying outside; in other countries, check your national aviation authority.
- Lithium batteries: charge on a non-flammable surface, never leave charging unattended, do not use swollen batteries.
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
- Flash MicroPython on the ESP32 (download the firmware from micropython.org and
follow the ESP32 instructions there;
esptoolis used for flashing). - Install Thonny (thonny.org) and select MicroPython (ESP32) as the interpreter.
- Copy
main.pyto the board. Edit the Wi-Fi name, password and MQTT broker at the top. - 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
- Sensor online — raw readings print every 2 s.
- Clean signal — paste your
EMAFilterfrom Exercise 6; print raw vs filtered. - Watchdog — paste your detector logic from Exercise 7; breathe on the sensor or touch it with a warm finger to trigger an alarm.
- 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
- Wheels turning —
testMotors()drives forward, back, spins left and right. Relate each move towheel_speeds_to_twist()from Exercise 3. - Eyes open — the serial monitor prints the ultrasonic distance in cm.
- Don't crash — the robot drives forward and turns away when an obstacle is
closer than
SAFE_CM. - Smooth driver — replace the on/off turning with a proportional rule: the
closer the obstacle, the slower the robot (same idea as
go_to_goalslowing 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
- First sight — the Pi prints the top-3 labels for what the camera sees.
- Stopwatch — record inference time (ms) and frames per second.
- Squeeze it — run
--benchmark: compare file size, speed and top-1 label of the float and int8 models. Connect the result to Exercise 8. - 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
- Pre-flight check — connect, print battery and temperature; refuse to fly below 30% battery.
- Square — take off, fly a 1 m square, land.
- 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".
- 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)