0% found this document useful (0 votes)
8 views6 pages

Module3 IoT and Python Notes

Module 3 covers IoT systems and Python logical design, including a weather monitoring case study that outlines the process of sensor data collection and cloud processing. It provides guidance on Python installation, data types, control flow, functions, modules, packages, file handling, date and time operations, and object-oriented programming concepts. Additionally, it discusses Python packages relevant for IoT applications, such as JSON, XML, HTTP, and SMTP.

Uploaded by

prajwalcg3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Module3 IoT and Python Notes

Module 3 covers IoT systems and Python logical design, including a weather monitoring case study that outlines the process of sensor data collection and cloud processing. It provides guidance on Python installation, data types, control flow, functions, modules, packages, file handling, date and time operations, and object-oriented programming concepts. Additionally, it discusses Python packages relevant for IoT applications, such as JSON, XML, HTTP, and SMTP.

Uploaded by

prajwalcg3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MODULE 3 – IoT SYSTEMS & PYTHON LOGICAL DESIGN (EXAM NOTES)

CONTENTS

1. Weather Monitoring Case Study (IoT Design Methodology)

2. Python Installation

3. Python Data Types & Structures

4. Control Flow

5. Functions

6. Modules

7. Packages

8. File Handling

9. Date & Time

10. Classes (OOP)

11. Python Packages for IoT (JSON, XML, HTTP, SMTP)

------------------------------------------------------------

1. WEATHER MONITORING CASE STUDY – SIMPLE EXPLANATION

Purpose: To monitor temperature, pressure, humidity, light using IoT end nodes.

Process:

• Sensors read values every fixed interval.

• Data is stored temporarily.

• Data is sent to cloud for processing.

• Cloud aggregates, analyzes, and visualizes readings.

Models:

A. Process Specification

– Read sensors → Store → Send → Wait → Repeat.


B. Domain Model

– Physical Entity: Environment

– Virtual Entity: Digital representation

– Devices: Temp, pressure, humidity, light sensors, mini-computer

– Services: Controller service

– Resources: On-device & cloud resources

C. Information Model

Attributes: temperature, pressure, humidity, light

Each attribute stores the sensed value.

D. Controller Service

– Runs every 15 seconds

– Reads sensors

– Sends data to cloud using REST API

E. Deployment

– Multiple sensor nodes in different locations

– All send data to cloud database

– Cloud performs aggregation and prediction

------------------------------------------------------------

2. INSTALLING PYTHON

Windows:

Download from python.org and run installer.

Linux (Ubuntu):

sudo apt-get install build-essential


sudo apt-get install required libraries

wget Python source

configure → make → make install

------------------------------------------------------------

3. PYTHON DATA TYPES & STRUCTURES

Numbers: int, float, long, complex

Strings: Sequence of characters

Lists: Mutable, ordered

Tuples: Immutable version of list

Dictionaries: Key-value mapping

Type Conversion: int(), float(), str(), list(), set()

------------------------------------------------------------

4. CONTROL FLOW

if, elif, else → decision making

for → iterate through sequence

while → loop until condition false

range → generate number sequence

break → exit loop

continue → skip current iteration

pass → do nothing (placeholder)

------------------------------------------------------------

5. FUNCTIONS

def functionName(parameters):
function body

Features:

• Default arguments

• Keyword arguments

• Variable length (*args)

• Pass-by-reference (lists change globally)

------------------------------------------------------------

6. MODULES

Module = Python file containing functions/classes.

Import using:

import module

from module import function

dir(module) → list functions inside module.

------------------------------------------------------------

7. PACKAGES

Package = Folder containing Python modules + __init__.py

Used for organizing large projects.

Example: skimage package with subfolders.

------------------------------------------------------------

8. FILE HANDLING

open(filename, mode)

Modes:
r – read

w – write

a – append

rb / wb – binary

Functions:

read(), readline(), readlines(), write(), tell(), seek(), close()

------------------------------------------------------------

9. DATE & TIME OPERATIONS

datetime module → date, today(), strftime(), date difference

time module → timestamps, formatting, localtime(), strftime()

------------------------------------------------------------

10. CLASSES (OOP)

Class contains:

• Constructor (__init__)

• Destructor (__del__)

• Instance variables

• Class variables

• Methods

Inheritance → Child class reuses parent class.

Overriding → Child replaces parent method.

Hidden attributes → __variable

------------------------------------------------------------

11. PYTHON PACKAGES FOR IoT


A. JSON

Easy format for transferring data.

json.dumps() → encode

json.loads() → decode

B. XML

Structured data with tags.

Use xml.dom.minidom to parse & generate XML.

C. HTTP Requests

Using httplib2 / urllib2

GET, POST requests to send/receive IoT data.

D. SMTP (Email)

Used for sending alerts from IoT devices:

Use smtplib module.

------------------------------------------------------------

END OF MODULE 3 NOTES

You might also like