Exam Overview — Connected Objects (420-6P3)

Exam Structure

Part 1: Practical (reTerminal)

  • Bring your reTerminal (required)
  • Open-book: course notes, your laptop, internet all allowed
  • Teacher will ask you to connect 1–3 devices to your reTerminal
  • Tasks: take measurements → record to file → upload
  • Starter code will be provided on exam morning (generic sensor code for Digital/Analog/Serial + file recording)

Part 2: Theory (written on paper)

  • Open-book
  • Written answers on a sheet of paper provided
  • Topics covered:
    • Bash / Linux
    • Python
    • Electronics (protocols + basic circuitry)
    • Web / IoT Protocols
  • Questions will be relevant to the practical part

Part 1 Workflow — Sensor Code Patterns

Digital sensor (GPIO Zero)

from gpiozero import Button
button = Button(2)
print(button.is_pressed)  # True/False

Analog sensor (Grove Hat ADC)

  • Use AHT20 or similar I2C sensor via smbus2 or adafruit library
  • Grove Hat provides 4 ADC channels (12-bit, 0–4095)
  • See Serial Protocols for I2C Python code

Serial sensor (pySerial)

import serial
with serial.Serial('/dev/serial0', 9600) as ser:
    line = ser.readline()
    print(line)

Record measurements to a file

import json, time
 
with open('measurements.json', 'a') as f:
    record = {'timestamp': time.time(), 'value': reading}
    f.write(json.dumps(record) + '\n')

Upload (typical pattern)

# rsync to a remote host
rsync measurements.json user@host:/path/
 
# or copy to mounted Windows filesystem from WSL
cp measurements.json /mnt/c/Users/<you>/Desktop/

Quick Navigation — Theory Topics

AreaWiki page
Electronics (Ohm’s Law, resistors)Electronics and Circuitry
Signals, ADC, samplingSignals and ADC
Serial protocols (SPI/I2C/PWM/Serial)Serial Protocols
MQTT, HTTP, pub/subMQTT and IoT Protocols
GPIO, reTerminal hardware, built-in sensorsGPIO and reTerminal
Python (argparse, venv, logging, pytest)Python Essentials
Async Python (asyncio)Async Python
Linux & Bash commands (5 fingers, pipes)Linux and Bash Commands
Bash scripting (variables, if, chmod)Bash Scripting
IoT system architecture (5 components)IoT System Architecture
Azure D2C, Device TwinsAzure IoT Overview

Key Formulas to Remember

FormulaUse
V = IROhm’s Law — voltage, current, resistance
I = V / RFind current given voltage and resistance
R = V / IFind resistor value
Vr = Vsource − VledKirchhoff’s Voltage Law (series circuit)
fs = 1 / TSampling frequency from sampling period
values = 2^nNumber of distinct values for n-bit ADC
bitrate = fs × bitsBits per second for sampled signal

Key GPIO Electrical Limits (reTerminal)

  • Max current per GPIO pin: 16 mA
  • GPIO voltage: 3.3 V (not 5 V tolerant!)
  • Max current from 3.3 V / 5 V power pins: 2 A

Sensor Types on the Exam

TypeProtocolPython libPort
DigitalGPIO high/lowgpiozeroGPIO pin number
AnalogADC via I2C (Grove Hat)smbus2 / adafruitI2C bus
Temperature/HumidityI2C (AHT20)adafruit-circuitpython-ahtx0I2C
SerialUART asyncpySerial/dev/serial0
Built-in lightRead fileopen() / cat/sys/bus/iio/devices/iio:device0/in_illuminance_input
Built-in LEDWrite fileecho / tee/sys/class/leds/usr_led0/brightness