EP0401 Python Programming for IoT - Lesson 1 - RPi setup & headless mode new
Lesson Overview
Title: Setting up the Python programming environment in a single board computer
Lecturer: S.P. Chong
Date: 17/10/2022
Objectives
Overview of the module:
Topics to be covered
Assessments and schedule
Learn to set up the Python programming environment on Raspberry Pi (a single board computer)
Key features of Raspberry Pi
Required hardware for using Raspberry Pi
Using the IDE (Integrated Development Environment)
Topics & Schedule
Term 1
Lesson 1: Raspberry Pi setup (including headless mode)
Lesson 2: Python basics (+ Python OOP)
Lesson 3: Physical computing
Lesson 4: Sensor data collection, storage, visualization & analytics
Lesson 5: Sensor data upload to cloud & notifications
Quiz: 30% before MST
Term 2
Lesson 6: A simple web server
Lesson 7: GUI (Graphical User Interface)
Mini Project: 20% CD after vacation, 40% implementation before exam
Assessments
Online Quiz (30%)
Coverage: Lessons 1 to 5
Format: 75-90 MCQs, closed book, using Lock-down Browser
Duration: 1.5 hours
Week: Before MST
Mini Project (60%)
Requirements: Use Python on Raspberry Pi to implement an IoT application
Work in pairs
Present idea for critique in the 1st week of the 2nd term before implementation
Internet of Things (IoT)
Definition: “Things” connected to the internet to exchange data
Purpose: Improves lives, work, and play
Application Example: Intruder detection system notifying homeowners with photographs during absence.
Further Questions: What sensors are used? What cloud platform? (Hint: Google)
Key Features of Raspberry Pi 3 Model B+
Processor:
1.4GHz 64-bit quad-core processor
Connectivity:
Dual-band wireless LAN
Bluetooth 4.2/BLE
Faster Ethernet
Additional Features:
Power-over-Ethernet support (with separate PoE HAT)
Technical Terminology to Understand
64-bit processor
Quad-core processor
Dual-band wireless LAN
BLE (Bluetooth Low Energy)
Ethernet
PoE HAT (Power over Ethernet Hardware Attached on Top)
Raspberry Pi Hardware Requirements
Essential Hardware:
Keyboard
HD monitor (with HDMI cable)
Mouse
5V 2.5A adaptor
Micro SD card (16GB or higher)
Usage: Raspberry Pi as a CPU
Setting up the Raspberry Pi OS (Operating System)
Key Steps:
Download NOOBS (New Out of the Box Software) from the official website.
Download SD Formatter for Windows and format the SD card.
Unzip NOOBS into the SD card.
Insert the SD card into Raspberry Pi; connect mouse, keyboard, monitor, and power.
Writing & Running Your First Python Program
Click on: Raspberry Pi > Programming > Python 3 (IDLE)
Enter code line by line in the Python Shell for immediate interpretation.
Create a new file by selecting: File > New File.
Import necessary libraries, set GPIO mode, and configure output pins.
Program while loops for consistent execution.
Save your file as "BlinkLED" and run it with F5.
Lab Exercises
Exercise 1.1: Understanding computer terms
Exercise 1.2: Exploring Raspberry Pi details
Exercise 1.3: Setting up the Raspberry Pi OS
Exercise 1.4: Writing your first Python program
Headless Mode Setup for Raspberry Pi
Steps:
Ensure authentication through a laptop without peripherals.
Connect laptops and Raspberry Pi on the same Local Area Network (LAN).
Set static IP addresses for both devices.
Enable VNC for remote desktop access.
Use downloaded VNC Viewer for connection.
Conclusion
This lesson introduces essential concepts of Python programming and hands-on Raspberry Pi usage. Understanding the IoT applications and using Raspberry Pi will enhance practical computing skills.