Teaching pack · UAT 105
A 15-week teaching plan, 5 worksheets, a scoring rubric and a map from the course description to the lessons, for instructors to evaluate and adapt before teaching.
Coverage of the course description
The lessons fully teach 11 of 11 description topics. Each topic lists the modules and lesson sections that teach it, and incomplete topics say what is missing.
| Description topic | Modules | Where it is taught | Status |
|---|---|---|---|
| Digital systems | M1 | Module 1: logic gates and truth tables, and from gates to an adder | Covered |
| Computer components | M2 | Module 2: the von Neumann computer, the memory hierarchy, on-board buses and storage | Covered |
| Data representation | M1 | Module 1: binary and hexadecimal, two's complement integers and the float 0.1 in memory | Covered |
| Introductory operating systems | M2 | Module 2: Introductory operating systems (the kernel, processes and threads, round-robin and priority scheduling, CPU utilisation, file systems and paths, the Linux command line, Examples 3–4 and the operating-system activity) · The memory hierarchy and interrupts · The two computers on a drone (real-time OS versus Linux) | Covered |
| Data communications | M1M2M3 | Module 1: error detection with parity and CRC · Module 2: on-board buses and baud rate · Module 3: protocol layers and encapsulation | Covered |
| Computer networks | M3 | Module 3: IPv4 addresses and subnets, and setting up a ground-station network | Covered |
| Internet protocols | M3M4 | Module 3: protocol layers, IPv4, and TCP versus UDP · Module 4: MQTT publish/subscribe | Covered |
| Wireless networking | M3 | Module 3: wireless links and signal loss, the 2.4 GHz link power budget and radio frequency rules | Covered |
| Cloud computing | M5 | Module 5: what the cloud is, and edge or cloud | Covered |
| The Internet of Things | M4 | Module 4: IoT architecture, QoS, retained messages and Last Will, data freshness and queues | Covered |
| Basic cybersecurity | M4M5 | Module 4: Mosquitto and security (TLS and ACL) · Module 5: the CIA triad and threats, four tools, HMAC and NIST CSF 2.0 | Covered |
Weekly teaching plan
| Week | Topic | Pre-class | Lecture | Lab | Evidence |
|---|---|---|---|---|---|
| 1 M1 | Binary, hexadecimal and units of data | Read module 1 up to 'Binary and hexadecimal' | Base conversion, bits versus bytes, and kB versus KiB | Worksheet 1 part A: read the first 40 bytes of the .tlog file and pick apart the first frame header by hand | Table of the first frame header (length, sequence, system ID, message ID) |
| 2 M1 | Two's complement, logic gates and adders | Read the two's complement, logic gates and adder sections; run Example 1 | Negative integers, floats in memory, truth tables and the full adder | Worksheet 1 part B: a base_mode flag decoder and an 8-bit adder tested on every pair 0–255 | Code for both functions and a test run passing every pair |
| 3 M1 | Error detection with parity and CRC | Read the parity and CRC section; run Example 2; take the module 1 quiz | The CRC of a HEARTBEAT frame and why a CRC is not security | Worksheet 1 part C: check the CRC of every frame in the .tlog file with crc16_mcrf4xx | Number of frames with a bad CRC, and quiz result |
| 4 M2 | The von Neumann computer, memory and interrupts | Read module 2 up to 'The memory hierarchy and interrupts' | CPU, memory and buses; polling versus interrupts | Worksheet 2 part A: run lscpu and free -h on a Raspberry Pi or Linux machine and compare with the flight controller | Table comparing cores, clock and RAM |
| 5 M2 | The two computers on a drone and on-board buses | Read 'The two computers on a drone' and 'On-board buses'; run Example 1 | Real-time OS versus Linux; UART, I²C, CAN and SPI; position messages per second | Worksheet 2 part B: list the Pixhawk 6X ports with bus types and compute the data budget of a 57600 baud telemetry radio | Port table and percentage of capacity used |
| 6 M2 | Storage, write speed and introductory operating systems | Read the storage and introductory operating systems sections; run the code of Examples 2–3; take the module 2 quiz | A 128 GB V30 card against video bit rate; processes, scheduling, CPU utilisation, file systems and the Linux command line | Worksheet 2 part C: run SITL and measure CPU and RAM use during the simulation | Worksheet 2 short report and quiz result |
| 7 M3 | Protocol layers, encapsulation and IPv4 addresses | Read module 3 up to 'IPv4 addresses and subnets'; run Example 1 | Header overhead at each layer, subnets and special addresses | Worksheet 3 part A: capture SITL telemetry in Wireshark, filter udp.port == 14550 and find the 0xFD that starts each MAVLink frame | Packets per second and a byte view with each layer marked |
| 8 M3 | TCP versus UDP and wireless links | Read the TCP versus UDP and wireless link sections; run Example 2 | Why telemetry uses UDP, the 2.4 GHz link power budget and frequency rules | Worksheet 3 part B: pause SITL data forwarding; record what QGroundControl shows and any mode change in the log | Record of the link loss with times |
| 9 M3 | Setting up a ground-station network; midterm | Read the ground-station network section; review modules 1–3; take the module 3 quiz | Midterm examination (modules 1–3) | Worksheet 3 part C: build the Figure 3 network with a real router, set a static IP and ping every pair | Network diagram with addresses and ports, and midterm score |
| 10 M4 | IoT architecture and publish/subscribe | Read module 4 up to 'Publish/subscribe and topics' | Layers of an IoT system and topic design principles | Worksheet 4 part A: install Mosquitto; use mosquitto_sub and mosquitto_pub; try + and # | Screenshots of each wildcard result |
| 11 M4 | QoS, retained messages and Last Will | Read the QoS and retained message sections; run Example 1 | The three QoS levels and duplicated commands under QoS 1 | Worksheet 4 part B: a paho-mqtt program simulating three drones and a subscriber showing data age; test the Last Will | Code and a record of what happened when one drone was killed |
| 12 M4 | Data freshness, queues and Mosquitto security | Read the data freshness and Mosquitto security sections; run Example 2; take the module 4 quiz | A dashboard that cannot keep up; TLS, per-device accounts and ACLs | Worksheet 4 part C: enable TLS and an ACL and test that drone 1 cannot publish to drone 2's topics | Configuration files, ACL test result and quiz result |
| 13 M5 | The cloud and choosing edge processing | Read module 5 up to 'Edge or cloud'; run Example 1 | Cloud service models; sending raw images or analysis results | Worksheet 5 part A: build manifest.csv with SHA-256 and a program that re-checks after copying | Manifest and a run that catches the altered file |
| 14 M5 | The CIA triad and four security tools | Read the CIA triad and four tools sections; run Example 2; take the module 5 quiz | Catching forged commands with HMAC, and why MAVLink signing does not encrypt | Worksheet 5 part B: add an HMAC and sequence number to command messages; enable MAVLink signing in SITL and inspect it in Wireshark | Test results for forged and replayed messages, and the extra bytes per frame |
| 15 M5 | NIST CSF 2.0, the data life cycle and mini-project presentations | Read the NIST CSF 2.0 and data life-cycle section; prepare the mini-project | Course wrap-up and project criteria | Worksheet 5 part C: a six-function CSF 2.0 table and a data life-cycle chart; then present the mini-project, a secure MQTT drone reporting system (building on worksheets 4–5) | Mini-project report and presentation, scored with the rubric |
Worksheets and instructor guide
One worksheet per module. Students open it on the web, print it or download the .docx. The instructor guide under each worksheet gives the class timing, expected results, discussion questions and notes for students with different backgrounds.
1Worksheet 1 Reading a drone's bits
Analysis activity · About 6 h of class time · CLO1
Objective: Read and interpret the bytes of real MAVLink frames, build an adder from gates and check the CRC of a whole file
Equipment
- Computer with Python and pymavlink
- telemetry_sample.tlog from UAT 104
- MAVLink common.xml documentation
- Module 1 example code
Safety
- Desk work only; no flying
Steps
- Read the first 40 bytes with open(..., "rb") and pick out the first frame's length, sequence, system ID and message ID by hand
- Write a function that turns base_mode into the names of all 8 flags from common.xml
- Build an 8-bit adder from full_adder
- Test the adder on every pair 0–255 against (x + y) % 256
- Get each message's CRC_EXTRA from pymavlink
- Check every frame's CRC with crc16_mcrf4xx and count the mismatches
Deliverables
- Table of the first frame header
- Flag decoder and adder code with test results
- Number of bad-CRC frames with code
Checklist
- Table 1 lists every header field (STX, length, incompat, compat, sequence, system ID, component ID, message ID) in both hex and decimal
- The adder is tested on all 65,536 pairs, the number of wrong pairs (must be 0) is reported, and runnable code is attached
- The base_mode decoder is tested on at least 3 values including the lesson's 0x51, with flag names matching common.xml
- Table 3 covers every message type in the file, the frame counts add up to the program's total, and the source of each CRC_EXTRA is stated
Instructor guide
Class timing
- Review number bases, two's complement and the MAVLink 2 frame layout40 min
- Read the first 40 bytes by hand and fill in Table 160 min
- Write and test the base_mode decoder60 min
- Build the 8-bit adder from full_adder and test every pair70 min
- Check the CRC of every frame and fill in Table 390 min
- Wrap-up, questions and hand-in checklist40 min
Expected results
- Table 1 (UAT 104's telemetry_sample.tlog): the first 8 bytes are the recording time, and the first frame starts at the 9th byte (offset 8 counting from 0): STX 0xFD (253), length 0x09 (9 bytes), incompat 0x00, compat 0x00, sequence 0x00 (0), system ID 0x01 (1), component ID 0x01 (1), message ID 00 00 00 = 0, which is HEARTBEAT, then the 9-byte payload 04 00 00 00 02 03 01 03 03 and CRC 68 f7. Students who start the header at the first byte of the file get every field wrong; point out that they must find 0xFD first.
- Table 2: base_mode 0x51 = 01010001 gives CUSTOM_MODE_ENABLED, STABILIZE_ENABLED and MANUAL_INPUT_ENABLED; 0xD1 adds SAFETY_ARMED; 0x01 gives CUSTOM_MODE_ENABLED only. Adder: 5 + 6 = 11 with carry 0, 200 + 100 gives 44 with carry 1 (300 - 256 = 44). All 65,536 pairs tested with 0 wrong. Even one wrong pair means the carry is not passed to the next bit correctly.
- Table 3: the file has 7,911 frames of 5 types: HEARTBEAT (ID 0, CRC_EXTRA 50) 396 frames, SYS_STATUS (ID 1, 124) 396, ATTITUDE (ID 30, 39) 3,955, GLOBAL_POSITION_INT (ID 33, 104) 1,582 and VFR_HUD (ID 74, 20) 1,582. Bad CRC: 0 frames (the synthetic file has no damage). If a group gets many mismatches, the usual causes are including 0xFD in the calculation, forgetting CRC_EXTRA, or using a fixed payload length instead of the length byte (in this file ATTITUDE is 16 or 12 bytes long because MAVLink 2 drops trailing zero bytes from the payload).
- They are the time the ground station received the message, in microseconds since 1 January 1970, big-endian: 1,773,455,400,000,000 us, which is 2026-03-14 02:30:00 UTC (09:30 Thai time). They are not part of the frame because the drone did not send them; the ground station adds them when it writes the .tlog (UAT 104 module 4). A strong answer also notes that the tlog time is big-endian while MAVLink data is little-endian.
- 0x81 appears in 384 of 396 frames (0x01 in the other 12, at the start). 0x81 = 10000001 is SAFETY_ARMED plus CUSTOM_MODE_ENABLED, so for almost the whole file the motors are armed and the autopilot uses its own modes (custom_mode says which). The early 0x01 frames are not yet armed. A strong answer uses AND with a bitmask rather than guessing from the decimal value.
- Carry 1 in 32,640 pairs (the pairs with x + y >= 256, equal to 0 + 1 + ... + 255). In these pairs the 8-bit sum equals x + y - 256, exactly (x + y) % 256. This is the same overflow that makes MAVLink's sequence counter wrap from 255 to 0, so sequence gaps must be computed modulo 256. In this file the sequence jumps from 183 to 88 during the 8.1 s link loss: plain subtraction gives -95, but modulo 256 gives 161 (160 frames missing).
- No. A CRC only catches accidental errors. Anyone can compute a fresh CRC for a forged message because the formula and CRC_EXTRA are public and there is no secret key. Proving the real sender needs MAVLink signing or an HMAC (module 5). A strong answer separates protection against noise from protection against forgery.
Discussion questions
- Why might MAVLink store numbers little-endian, and what happens if two computers interpret byte order differently?
- If two vendors used the same message ID with different data layouts, how does CRC_EXTRA prevent harm?
- In incident analysis, how does reading the bytes yourself differ from trusting a library's output, and when is it worth going down to the byte level?
Adapting to student background
- Upper secondary (M.6)
- Have them convert the Table 1 bytes by hand before checking with Python, and prove on paper that the full-adder carry is (A AND B) OR (S1 AND Cin) before coding.
- Vocational certificate
- Give starter code with blanks to fill and a place-value strip (128 64 32 16 8 4 2 1) for binary to decimal; pair them with a confident coder.
- Diploma
- Extension: write a program that finds sequence jumps in the file, computes missing frames modulo 256 and compares them with the link-loss period.
2Worksheet 2 Exploring computers and buses
Lab · About 6 h of class time · CLO1
Objective: Compare the two kinds of computer on a drone, identify the flight controller's buses and compute a telemetry radio's data budget
Equipment
- Raspberry Pi or a Linux computer
- Pixhawk 6X page in the PX4 user guide
- SITL simulator
- MAVLink common.xml documentation
Safety
- Desk work only; no flying
- Power off before connecting or unplugging board cables
Steps
- List every Pixhawk 6X port with its bus type (UART, I²C, CAN, internal SPI) and compare with Figure 2
- Use lscpu and free -h to see cores, clock and RAM, and compare with the flight controller
- Run SITL and record CPU and RAM use during the simulation
- Find the payload sizes of HEARTBEAT, ATTITUDE and GLOBAL_POSITION_INT in common.xml
- Compute the percentage of a 57600 baud radio used at 1, 10 and 4 Hz
Deliverables
- Port and bus table
- Comparison table of the two computers
- Data budget calculation with working
Checklist
- Table 1 gives a bus type for every port on the PX4 user guide page, with at least one row each for UART, I²C, CAN and internal SPI
- Table 2 contains real lscpu and free -h output (screenshot attached) and the CPU and RAM use while SITL runs, with units
- Table 3 frame sizes include the 12 bytes of header and CRC, and capacity is 5760 bytes per second (8N1, divided by 10)
- The total budget percentage is worked step by step, with a unit on every value
- Record shows power was off every time a board cable was connected or removed
Instructor guide
Class timing
- Board safety briefing and von Neumann review30 min
- Read the Pixhawk 6X page and fill in the port and bus table70 min
- Run lscpu and free -h and compare with the flight controller50 min
- Run SITL and record CPU and RAM use80 min
- Find payload sizes in common.xml and compute the data budget90 min
- Wrap-up, questions and hand-in checklist40 min
Expected results
- Table 1: check port names against the Pixhawk 6X page of the PX4 user guide version in use. The answer pattern from the lesson: TELEM and GPS ports are UART (2 wires, TX and RX, point to point), CAN ports are twisted pairs for DroneCAN, the I²C port serves a compass or rangefinder, the IMU and barometer are on internal SPI (no external port), and Ethernet can link to the companion computer as in Figure 2. Accept if every bus type written is correct.
- Table 2: the flight controller from the lesson is an STM32H753 Cortex-M7, 1 core at 480 MHz (clock period 2.083 ns), 2 MB flash, 1 MB RAM, running NuttX; a Raspberry Pi 5 has 4 Cortex-A76 cores up to 2.4 GHz and 1 to 16 GB of RAM depending on the model, running Linux. CPU and RAM use while SITL runs varies by machine and has no fixed value; check that units are given (percent, MB or GB) and that the command used, such as top, is stated.
- Table 3: HEARTBEAT payload 9 bytes, frame 21 bytes x 1 Hz = 21 B/s (0.36%); ATTITUDE 28 bytes, frame 40 x 10 Hz = 400 B/s (6.94%); GLOBAL_POSITION_INT 28 bytes, frame 40 x 4 Hz = 160 B/s (2.78%); total 581 B/s of 5760 B/s = 10.09% (accept 10.0 to 10.1%). Frame sizes are maximums (unsigned). The real telemetry_sample.tlog, which also carries other messages, measures about 622 B/s.
- SPI has a shared clock and is fast, which suits an IMU read hundreds of times a second and sitting close to the processor on the same board. UART needs no shared clock and only two wires point to point, which suits external devices that send a stream of bytes, such as GNSS and radios. A strong answer mentions speed versus cable length and choosing I²C or CAN when there are many devices or electrical noise.
- With an 8 GB Raspberry Pi 5: 8 GB / 1 MB = 8,192 times the RAM and 2.4 GHz / 480 MHz = 5 times the clock (not counting cores). But Linux does not guarantee response times, so a flight-control task that must finish every 2.5 ms (400 Hz) could miss cycles, while an RTOS uses preemptive priority so control always gets the CPU first. A strong answer also says clock speeds cannot be compared directly across architectures.
- 10.09%. Dividing 57600 by 8 gives 7200 B/s and 581/7200 = 8.07%, overstating capacity by 25%. A design calculated at 80% would really run at 100% and drop messages when noise appears, because 8N1 uses 10 bits per byte (start bit, 8 data bits, stop bit).
- ATTITUDE at 50 Hz: 21 + 40 x 50 + 160 = 2,181 B/s = 37.86%. It still fits, but headroom is needed for other messages such as SYS_STATUS, ground-station commands, resends during noise and MAVLink signing (module 5). A strong answer proposes how much to reserve and why; reserving half (at most 2,880 B/s) still leaves room for about 57 more 40-byte frames per second on top of 581 B/s.
Discussion questions
- If an AI object-detection camera is added to the drone, which computer and which bus should it connect to, and why?
- How can a large but slow memory card lose logs even when it still has free space?
- Why would a flight-controller maker choose only 1 MB of RAM when memory has become so cheap?
Adapting to student background
- Upper secondary (M.6)
- Have them write B = baud/10 and frame = payload + 12 before calculating and explain in their own words why 8N1 uses 10 bits; give extra supervised time connecting real cables.
- Vocational certificate
- Start by holding the real board and pointing to each port against Figure 2, then work the data budget one message at a time in a fill-in table, checking with a calculator.
- Diploma
- Extension: measure real message rates from SITL or telemetry_sample.tlog, compare with the calculated budget and explain the difference (uncounted messages and payloads with trailing zeros removed).
3Worksheet 3 Capturing SITL telemetry and building a field network
Lab · About 6 h of class time · CLO2
Objective: See protocol layers in real packets, observe a link loss and set up a working ground-station network
Equipment
- Computer with SITL and QGroundControl
- Wireshark (with Npcap on Windows)
- Wi-Fi router
- Onboard computer or Raspberry Pi
Safety
- Desk work only; no flying
- Capture only on the lab network, never on other people's networks
Steps
- Run SITL and QGroundControl and capture on the loopback interface
- Filter udp.port == 14550, count packets per second and find 0xFD beneath the UDP and IP headers
- Pause SITL data forwarding; record what QGroundControl shows and any mode change in the log
- Build the Figure 3 network and give the onboard computer a static IP
- Ping every pair and draw the network with addresses and ports
Deliverables
- Packet byte view with layers marked
- Link-loss record
- Network diagram with ping results
Checklist
- Table 1 has packets per second with how it was measured, and a byte view with the IPv4, UDP and MAVLink layers clearly marked
- Table 2 records when forwarding was paused and resumed, with what QGroundControl showed and the mode in the log
- The onboard computer has a static IP in 192.168.10.0/24 and Table 3 pings every pair (at least 3 machines plus the router)
- The network diagram shows every IP address, UDP port 14550 and the direction of MAVLink traffic
- Capture was done only on the lab network, and the submitted file holds no data from other networks
Instructor guide
Class timing
- Capture rules briefing and protocol-layer review30 min
- Run SITL and QGroundControl and capture on loopback60 min
- Filter, count the rate and find 0xFD in the byte view60 min
- Link-loss test and event record60 min
- Build the field network, set the static IP, ping and draw the diagram110 min
- Wrap-up, questions and hand-in checklist40 min
Expected results
- Table 1: packets per second depend on the message rates SITL is set to and have no fixed value; check that the value is fairly steady and was measured from Wireshark's Statistics or from the first and last packet times (with the UAT 104 file's rates, 1 + 10 + 4 + 1 Hz, about 16 frames per second). The 0xFD byte comes after the 20-byte IPv4 header and the 8-byte UDP header. Counted from the start of the packet in Wireshark, its position depends on the loopback link header (on Windows with Npcap a 4-byte header gives offset 32; on Linux a 14-byte header gives offset 42, counting from 0).
- Table 2: while forwarding is paused, QGroundControl reports lost communication or no vehicle, and the values on screen freeze. Whether the mode in the log changes depends on the ground-station-loss failsafe setting in SITL and the armed state, as in the knowledge unit "C2 and abnormal events in simulation". With the failsafe enabled and the vehicle flying, expect a mode change such as RTL; without it, no change. A correct answer also states the setting used.
- Table 3 (Figure 3): router 192.168.10.1, laptop 192.168.10.20, tablet 192.168.10.21, onboard computer 192.168.10.30, all in 192.168.10.0/24, which has 254 host addresses (broadcast 192.168.10.255). Every pair should ping; times on indoor Wi-Fi are usually a few to a few tens of ms. If pinging a Windows laptop fails but the reverse works, think of the firewall.
- After the 20-byte IPv4 header and the 8-byte UDP header, 28 bytes in total (with the link header before them). A 21-byte HEARTBEAT becomes 49 bytes, so headers are 28/49 = 57.1%. The smaller the message, the larger the header share (a 40-byte GLOBAL_POSITION_INT gives 41.2%). A strong answer says that every layer's headers must be counted when comparing with link capacity.
- No. UDP has no acknowledgement and no resending, so data from the gap is simply gone. When the link returns, the screen shows the latest values at once, which is good for telemetry because new values replace old ones. With TCP, new data would wait behind resent old data and the whole stream would lag.
- Neither can ping; the problem is in the network layer. 169.254.x.x means no DHCP address was assigned, so check the Wi-Fi connection or set an IP by hand. 192.168.1.20/24 is in a different subnet from 192.168.10.30/24, so change it to an unused address in 192.168.10.0/24, such as 192.168.10.20.
- Check the transport layer: is the drone sending to the laptop's IP and port 14550, and does the Windows firewall allow UDP 14550? Then check the application layer in Wireshark with udp.port == 14550: do packets arrive and start with 0xFD? A strong answer goes from the bottom layer up instead of trying random fixes.
Discussion questions
- If many people open phone hotspots near the field, how might the ground-station network be affected, and how can you reduce the effect?
- Why is capturing traffic on other people's networks forbidden, even just for practice?
- Which devices in the field network should use a static IP and which DHCP, and why?
Adapting to student background
- Upper secondary (M.6)
- Have them compute subnet sizes with 2^(32-p) - 2 and the header share before opening Wireshark, then check against the capture; give extra time on the real router and IP settings.
- Vocational certificate
- Focus on hands-on work: wire the router, set IPs and ping from a layer-by-layer step card; use Figure 3 as the diagram template and colour the layers in the byte view instead of calculating.
- Diploma
- Extension: split 192.168.10.0/24 into /26 ranges for ground stations and drones, configure them and show that traffic between the groups needs routing.
4Worksheet 4 A battery-reporting system for a drone fleet
Lab · About 6 h of class time · CLO3
Objective: Build an MQTT system that reports several drones, knows data freshness, detects lost drones and restricts rights per topic
Equipment
- Computer with Mosquitto
- Python and paho-mqtt
- The MQTT and Mosquitto knowledge unit
Safety
- Desk work only; no flying
- Use only a local or lab broker
Steps
- Run mosquitto_sub -t "drone/#" -v and publish with mosquitto_pub; try + and #
- Write a program that simulates three drones sending battery level every second at QoS 0
- Add a retained online status and a Last Will of offline
- Write a subscriber that shows the latest value with its age, then kill one drone abruptly
- Enable TLS and an ACL and test that drone 1 cannot publish to drone 2's topics
Deliverables
- Simulated drone and subscriber code
- Last Will test record
- TLS and ACL configuration with test result
Checklist
- Table 1 has at least 4 cases, including + failing to match several levels and # matching the parent level
- Table 2 shows the data age of all three drones at each time and a row where the status turns offline from the Last Will
- The Mosquitto config has a listener on 8883 with certificates, allow_anonymous off, and an ACL letting each drone write only to drone/<id>/#
- No password or private key appears in submitted code or files (read from environment variables)
- Runnable simulated-drone and subscriber code is attached, showing the lines that set QoS, retain and the will
Instructor guide
Class timing
- Lab broker rules and publish/subscribe review30 min
- Try mosquitto_sub and mosquitto_pub with + and #45 min
- Write the three simulated drones with retained status and Last Will90 min
- Write the data-age subscriber and run the kill test75 min
- Enable TLS and ACL and test the rights80 min
- Wrap-up, questions and hand-in checklist40 min
Expected results
- Table 1: drone/+/battery receives drone/1/battery but not drone/1/status or drone/1/gps/fix; drone/# receives every topic under drone, including the topic drone itself; drone/+ does not receive drone/1/battery (two levels). Every actual result should match the expectation; mismatches usually come from wrong letter case or stray spaces in the topic.
- Table 2: normally each drone sends every 1 s, so data age stays between about 0 and 1 s (accept up to about 1.5 s on one computer). After one drone is killed, its battery value freezes and its data age rises by 1 s every second; its status turns offline when the Last Will arrives. The other two stay normal.
- Table 3: connecting on port 8883 with ca.crt succeeds; connecting without a username is refused; drone 1 publishing to drone/1/battery succeeds; drone 1 publishing to drone/2/battery delivers nothing to a subscriber on drone/# (the broker drops it; with logging on, the denial appears in the log). The last result is the key evidence.
- drone/+/battery does not receive drone/1/status because the last level must be exactly battery and + stands only for the second level. drone/# does receive it because # stands for all remaining levels. A strong answer cites the Table 1 rows.
- When the program is killed, the operating system closes the connection at once without sending DISCONNECT, so the broker sends the Last Will almost immediately (usually under 1 s). If the cable or signal is simply lost, the broker must wait for the keep-alive timeout first (with 60 s set, possibly about 90 s). Meanwhile the screen looks normal but keeps getting older, which is why data age must always be shown.
- Status changes rarely and a late subscriber must know at once whether the drone is online, so it should be retained. Battery level changes every second; if retained, a new subscriber could get a very old value without knowing, such as 76% from a drone that dropped off long ago.
- 3 messages per second in and 2 out, so the queue grows by 1 per second: after 60 s it holds 60 messages and a new one waits about 60/2 = 30 s (after 5 minutes, 300 messages and 150 s). Fix it by lowering the send rate, batching, adding processing power or using message expiry to drop stale messages.
- The ACL proves drone 1 cannot pose as drone 2 (it stops impersonation at the topic level). TLS encrypts data in transit and stops eavesdropping on the network. TLS does not limit who may write which topic, and an ACL does not hide data from an eavesdropper, so both are needed, together with one account per device.
Discussion questions
- Which is safer to send at QoS 1, "climb another 10 m" or "set altitude to 50 m", and why?
- If the command centre has several screens, how should measurement and command topics be separated so rights are easy to set?
- What happens to the whole system if the broker fails, and how should you prepare for it?
Adapting to student background
- Upper secondary (M.6)
- Have them write Q = (λ - μ)t and W ≈ Q/μ and predict results before testing, and draw the QoS 1 message sequence when a PUBACK is lost.
- Vocational certificate
- Start with mosquitto_pub and mosquitto_sub typed from an example card, then give starter drone code where only topics and values change; use a table instead of formulas for the queue.
- Diploma
- Extension: add MQTT 5.0 message expiry to the battery messages and test that a slow subscriber no longer receives messages older than the limit.
5Worksheet 5 Sending mission data securely
Lab · About 6 h of class time · CLO3, CLO2
Objective: Use hashes and HMACs to protect data and command integrity, and frame an organisation's cybersecurity
Equipment
- Sample image folder
- Python (hashlib and hmac)
- SITL and Wireshark from worksheet 3
- MQTT programs from worksheet 4
Safety
- Desk work only; no flying
- Keep secret keys out of code and out of submitted files
Steps
- Build manifest.csv with the name, size and SHA-256 of every file
- Copy the folder, alter one file and make the checker catch it
- Add an HMAC and sequence number to commands; the receiver rejects bad or repeated messages
- Enable MAVLink signing in SITL and use Wireshark to see the extra bytes and whether content is readable
- Draw a six-function CSF 2.0 table and a survey mission data life-cycle chart naming the owner at each step
Deliverables
- Manifest code and check result
- HMAC code with an explanation of the attack the sequence number stops
- MAVLink signing observations
- CSF table and data life-cycle chart
Checklist
- manifest.csv lists every file in the folder, and the checker names the exact file that was altered (not just that something differs)
- Table 2 has at least 4 cases: genuine command, altered command, replayed command and a new valid sequence number
- The secret key is read from an environment variable or a file outside the repository and does not appear in submitted code, screenshots or report
- The write-up correctly separates the jobs of hash, HMAC, signing and encryption, at least one sentence per tool
- Table 3 covers all six functions including Govern, and the data life-cycle chart names an owner at every step
Instructor guide
Class timing
- Secret-key handling briefing and review of CIA and the four tools30 min
- Build the manifest, re-check and alter a file70 min
- Add an HMAC and sequence number to MQTT commands and test90 min
- Enable MAVLink signing in SITL and inspect with Wireshark60 min
- Build the CSF 2.0 table and the data life-cycle chart70 min
- Wrap-up, questions and hand-in checklist40 min
Expected results
- Table 1: every file has a 64-character hex SHA-256 (the table shows only the first 8). Before the change all files match; after altering one file, that file alone fails and all others match. Hash values differ between groups because the images differ. Check the program with the lesson's text "survey-2026-03-14 block A", which must give b21608ab...
- Table 2: genuine command with a new sequence number, accepted; altered command (for example RTL to LAND), HMAC fails, rejected; replayed command, HMAC passes but the sequence number is repeated or older, rejected; new command with a higher number, accepted. The HMAC-SHA256 tag is 32 bytes, and the receiver must compare with hmac.compare_digest.
- Table 3: Govern names owners of mission data and sets a retention policy; Identify keeps an inventory of drones, ground stations, keys and datasets; Protect uses TLS, one account per device, MAVLink signing and firmware updates; Detect watches broker logs and alerts on unknown connections; Respond has a procedure for a possibly leaked key, such as revoking accounts and replacing keys; Recover restores data from hash-checked backups and reviews lessons learned. The life-cycle chart must have five steps (collect, transfer, store, use or share, review or delete) with an owner at every step.
- Yes, because the hash is computed from every bit of the content; change one bit and the whole hash changes, whatever the size. But a hash has no key, so a deliberate forger can alter the file and put a fresh hash in the manifest, just like the CRC in module 1. You need an HMAC or a digital signature, or the manifest must be kept where the attacker cannot change it.
- Replay: an attacker records a genuine command with a valid HMAC and sends it again later. The HMAC still passes because the content is unchanged, but the sequence number is repeated or older than one already received, so the receiver rejects it (the replayed-command row in Table 2). It is the same idea as the always-increasing timestamp in MAVLink signing.
- 13 bytes longer per frame (the MAVLink 2 signature block: 1-byte link ID, 6-byte timestamp and the 48-bit, 6-byte signature), for example HEARTBEAT from 21 to 34 bytes and GLOBAL_POSITION_INT from 40 to 53 bytes. The content is still readable because signing does not encrypt, so it protects integrity and proves the source but not confidentiality, which needs encryption at another layer.
- Before: 581 B/s = 10.09%. After: (21 + 13) x 1 + (40 + 13) x 10 + (40 + 13) x 4 = 776 B/s = 13.47% of 5760 B/s, about 3.4 points more, with plenty of room left. A strong answer notes that small messages pay the largest share (HEARTBEAT grows by 61.9%).
Discussion questions
- If one drone's secret key leaks, how does the damage differ between a system with one key for every drone and one with a key per drone?
- Should aerial photos that show houses and people be processed at the edge or in the cloud, and which parts should be shared? Why?
- Of the six CSF 2.0 functions, which should a small unit with few staff start with?
Adapting to student background
- Upper secondary (M.6)
- Have them fill in a comparison table of the four tools (key needed or not, which CIA objective) before coding, and explain why compare_digest is safer than ==.
- Vocational certificate
- Give starter manifest code using hashlib and let them alter files and see the result themselves, favouring doing over theory; use picture cards of the six CSF functions for Table 3.
- Diploma
- Extension: carry out a real Respond step in the lab: replace one drone's HMAC key and show that commands using the old key are rejected while the other drones keep working.
Scoring rubric
For worksheets and the mini-project. Each criterion scores level (1–4) ÷ 4 × weight.
| Criterion | Weight | Excellent (4) | Good (3) | Fair (2) | Needs work (1) |
|---|---|---|---|---|---|
| Accuracy of calculations and code | 30% | All calculations and code correct, reproducible and tested | Nearly all correct, method shown | Some errors or missing tests | Many errors or does not run |
| Working system and network configuration | 25% | System fully works with test evidence for every part; faults traced layer by layer | Nearly all works, most evidence present | Partly works or evidence missing | Does not work |
| Security and data handling | 20% | Tools matched to their jobs (TLS, ACL, HMAC, hash) with the threats they stop explained correctly | Nearly all correct | Confuses the job of some tools | Security not considered |
| Communication and reporting | 25% | Clear, with correct diagrams and tables and units on every value | Clear with minor flaws | Hard to follow or missing parts | Does not communicate results |
Assessment map: CLOs and how they are assessed Draft
The CLOs are a web-team draft; the course owner sets the final ones (curriculum book, part 4). This table is built from the worksheet and module-quiz data, so it follows any change to the CLOs.