Video thumbnail Play Video

Python x IoT

IT Standard 14 20 hrs IoT Coding Python

This course introduces the exciting world of STEM and IoT applications using the versatile Unihiker or Raspberry Pi single-board computers. Designed for beginners and enthusiasts alike, it covers the essentials of setting up and programming a Linux-based computer, interfacing with hardware components through Python, and mastering device communication via HTTP and MQTT protocols. With a hands-on approach, students will learn to create innovative STEM/IoT solutions while gaining practical experience in a rapidly growing field.

Course Enquiry

Learning objectives

  • Master the basics of Unihiker/Raspberry Pi, Linux, and Python for building custom programs and applications.
  • Learn to connect and control hardware components for interactive projects.
  • Understand and apply IoT protocols to create smart home systems.

Lesson plan

Python and Coding Basic (IoT) | Set up Visual Studio Code and Python, revise the whole Python syntax set (variables, data types, operators, conditionals, lists, for loops, functions, classes/objects, libraries), practise good coding style, complete a number Mastermind exercise, and work with lists, dictionaries and JSON data.
Raspberry Pi Basic | What a Raspberry Pi is, connecting to it over SSH from Visual Studio Code, Linux commands and paths, virtual environments and pip, assembling the breadboard hardware, then first programs with gpiozero driving a Grove dual button and LED module, ending in a light-switch exercise.
GPIO and hardware control | Input versus output devices and the I2C bus; read a TSL2561 light sensor, drive a speaker/buzzer with PWM, position an SG90 servo, and capture photos from a webcam with OpenCV, through auto-light-system, play-a-note and press-and-capture exercises.
Python and IoT Basics | What IoT is, packets, IP addresses and routers; HTTP request/response with the Python requests module and JSON, using data.gov.hk for a weather report and next-train challenge; build a simple Flask web application, trigger one Pi from another over HTTP, use the Pi as a data centre, and push data to the ThingSpeak cloud.
GPIO and hardware control - 2 | Add an AHT20 temperature and humidity sensor, a quad alphanumeric display and a gesture sensor; log sensor data to ThingSpeak and build a timed 'smart report' combining the three devices.
AIoT - Classification (Introduction to Computer Vision) | What AIoT and computer vision are; run MediaPipe on the Pi, collect data with Google Teachable Machine and retrain an image classification model in Google Colab using transfer learning, with a 'focus or not focus' exercise.
AIoT - Object detection | Label your own images in VGG Image Annotator, export COCO annotations, train and test a custom MediaPipe object detection model in Google Colab, with a face-counting challenge.

Prerequisites

  • Python Basics Course or equivalent

Software

  • Visual Studio Code
  • Python 3.10 or later

Other requirements

    Hardware

    • Notebook/Desktop with updated browser
    • Hardware set:
      • Raspberry Pi 5
      • Breadboard & Jumper
      • Sensors:
        • LED
        • AHT20
        • Button
        • Light sensor
        • Servo motor
        • IR sensor
        • Ultrasonic sensor
        • Motor
        • Light strip
        • Webcam
        • …
    • Router (Only need one for whole class)