Student and Teacher Portal

Embedded Systems for IoT Notes

Complete exam-ready syllabus in simple English

Learn the full journey from tiny embedded devices to Raspberry Pi based IoT systems.

These notes are designed for classroom teaching, quick revision, practical lab preparation, and written exams. Every unit includes definitions, diagrams, comparison charts, code snippets, and likely exam points.

Embedded Device
Sensors
Network
Cloud or Server
User App

Fast Revision

What to remember before the exam

Embedded System

A special-purpose computer built inside a larger product to control a specific task.

IoT

A network of physical things that sense data, process it, communicate it, and support remote action.

Raspberry Pi

A low-cost single-board computer useful for Linux based IoT projects, GPIO control, and web servers.

MQTT

A lightweight publish-subscribe protocol commonly used for IoT messaging.

Unit 1

Introduction to Embedded Systems for IoT

Goal: understand what embedded systems are, where they are used, how they are designed, and how they become part of an IoT architecture.

Embedded System

An embedded system is a computer system designed to perform a fixed function inside a larger electrical or mechanical system. Unlike a desktop computer, it is usually hidden inside the product and is optimized for reliability, cost, power, size, and response time.

  • Input: buttons, sensors, switches, camera, microphone, network data.
  • Processing: microcontroller, microprocessor, SoC, memory, firmware.
  • Output: display, motor, relay, buzzer, LED, actuator, cloud message.
  • Control: the system repeatedly reads inputs, applies logic, and produces output.

Applications

Embedded systems are everywhere because modern products need sensing, control, communication, and automation.

Smart watch Washing machine Car ABS Medical monitor Traffic light Smart meter Drone Home automation

Characteristics of Embedded Systems

Characteristic Meaning Example
Dedicated function Designed for one main job instead of many general tasks. A thermostat controls room temperature.
Real-time response Output must be produced within a fixed time limit. Airbag controller reacts immediately during collision.
Low power Often runs on battery or limited power source. Wearable health band.
Small size Hardware is compact and product-specific. Sensor node inside a smart farm.
High reliability Must work for long periods with minimum failure. Industrial motor controller.
Cost optimized Uses only the required hardware and software features. TV remote control.

Processor and Hardware Units

Sensor Input
ADC
CPU or MCU
Memory
Communication
Actuator Output

The processor executes instructions. Memory stores firmware and temporary data. Timers help with delay and periodic tasks. GPIO pins connect digital devices. ADC converts analog sensor voltage into digital values. Communication modules transfer data using UART, SPI, I2C, Wi-Fi, Bluetooth, Ethernet, or cellular networks.

Embedded Software

Embedded software is the program stored in the device. It may be bare-metal firmware, an RTOS based application, or a Linux based program. It controls hardware registers, reads sensors, handles interrupts, performs calculations, and communicates data.

loop forever:
  read sensor value
  compare value with limit
  if value is unsafe:
    turn on alarm
    send alert message
  wait for next sample time

Embedded System Design Steps

  1. Define requirements and constraints.
  2. Select processor, memory, sensors, and communication modules.
  3. Design hardware circuit and power supply.
  4. Write firmware and driver code.
  5. Test timing, safety, accuracy, and power consumption.
  6. Deploy, maintain, and update when required.

Block Diagram of IoT

Architecture and Layers of IoT

Exam tip: In diagrams, always show data flowing upward from sensors to application and control commands flowing downward from application to actuator.

Unit 2

System on Chip, NoC, Embedded Hardware Modelling and Design

Goal: learn how modern chips integrate many blocks and how engineers model and develop embedded hardware.

System on Chip (SoC)

A System on Chip is an integrated circuit that contains several computer components on one chip. A typical SoC may include CPU cores, GPU, memory controller, I/O controllers, timers, ADC, security blocks, communication interfaces, and power management.

  • Reduces board size because many functions are inside one chip.
  • Reduces power consumption by optimizing internal communication.
  • Improves speed because internal buses are faster than external wiring.
  • Used in mobile phones, Raspberry Pi boards, routers, cameras, and IoT gateways.

SoC Internal Blocks

Network on Chip (NoC)

Network on Chip is a communication architecture used inside complex chips. Instead of connecting all internal blocks with a single shared bus, NoC uses routers and links, similar to a small network inside the chip. It improves scalability when many cores or hardware modules must communicate.

Shared Bus Network on Chip
Simple and low cost for small systems. Better for many cores and many IP blocks.
Only one or few transfers happen at a time. Multiple data transfers can happen in parallel.
Performance decreases as blocks increase. Scales better for complex SoCs.
Easy to design and debug. Needs routing, arbitration, and traffic management.

Levels of Hardware Modelling

Embedded Hardware Design

Embedded hardware design means selecting electronic components and connecting them so that the system meets functional, timing, power, size, and cost requirements.

  1. Choose MCU, MPU, or SoC based on processing need.
  2. Select sensors, actuators, display, and communication interface.
  3. Design power supply, voltage regulation, and protection.
  4. Create schematic and PCB layout.
  5. Prototype, measure signals, and correct faults.

Embedded Hardware Development

Hardware development is iterative. Engineers build prototypes, test with instruments, update circuits, and validate final boards before mass production.

Simple RTL Snippet

This example shows how a register can store input data on the rising edge of a clock.

module simple_register(
  input wire clk,
  input wire reset,
  input wire [7:0] data_in,
  output reg [7:0] data_out
);
  always @(posedge clk) begin
    if (reset)
      data_out <= 8'b00000000;
    else
      data_out <= data_in;
  end
endmodule

Exam tip: Remember that RTL describes what happens between registers during clock cycles.

Unit 3

Overview of Raspberry Pi

Goal: understand Raspberry Pi models, SoC architecture, GPIO pins, and on-board components.

Introduction to Raspberry Pi

Raspberry Pi is a small, affordable single-board computer. It runs Linux, supports USB, HDMI, Wi-Fi, Ethernet on many models, and provides GPIO pins for connecting sensors and actuators. It is useful when an IoT project needs more processing power than a microcontroller.

  • Runs a full operating system such as Raspberry Pi OS.
  • Can host a web server, database, dashboard, and automation tools.
  • Supports Python, C, Node.js, PHP, shell scripts, and many IoT libraries.
  • Can connect to external circuits through GPIO, I2C, SPI, UART, PWM, and USB.

When to Use Raspberry Pi

Use Raspberry PiImage processing, web server, Linux tools, Node-RED, database, multimedia.
Use MicrocontrollerVery low power, instant boot, simple control, low cost, hard real-time tasks.

Comparison of Raspberry Pi Models

Model Best Use Connectivity Notes
Raspberry Pi Zero 2 W Small IoT nodes, compact projects. Wi-Fi, Bluetooth, micro USB. Low cost and small size.
Raspberry Pi 3 Model B+ Basic IoT gateway and learning. Wi-Fi, Bluetooth, Ethernet, USB. Good for classroom labs.
Raspberry Pi 4 Model B Web server, dashboard, database, media. Wi-Fi, Bluetooth, Gigabit Ethernet, USB 3. More RAM options and better performance.
Raspberry Pi 5 High performance edge computing. Wi-Fi, Bluetooth, Gigabit Ethernet, USB 3, PCIe connector. Faster CPU and improved I/O performance.
Raspberry Pi Pico W Microcontroller style IoT tasks. Wi-Fi, GPIO, ADC, PWM. Does not run Linux like main Raspberry Pi boards.

SoC Architecture Used in Raspberry Pi

Most Raspberry Pi boards use Broadcom SoCs. The SoC combines CPU cores, GPU, memory interface, multimedia blocks, USB controller, GPIO controller, and communication peripherals. This integration is the reason a Raspberry Pi can be a complete computer on one small board.

Pin Description of Raspberry Pi

Raspberry Pi boards commonly provide a 40-pin GPIO header. Pins include power, ground, digital GPIO, I2C, SPI, UART, and PWM functions. Important rule: Raspberry Pi GPIO uses 3.3 V logic. Applying 5 V directly to a GPIO pin can damage the board.

On-board Components

  • SoC: main processor and internal controllers.
  • RAM: temporary memory for programs and OS.
  • MicroSD slot: stores operating system and files.
  • USB ports: keyboard, mouse, storage, camera, adapters.
  • HDMI: connects display or monitor.
  • Ethernet and Wi-Fi: network connection for IoT data.
  • GPIO header: connects external electronics.

Useful Commands

# update package list
sudo apt update

# check GPIO command availability
pinout

# show network address
hostname -I

# enable common interfaces
sudo raspi-config

Exam tip: Raspberry Pi is a single-board computer. Raspberry Pi Pico is a microcontroller board. This difference is commonly asked.

Unit 4

Sensors Interfacing

Goal: connect common sensors to Raspberry Pi, read values through GPIO, and send data to a database or server.

Sensor Interfacing Basics

Interfacing means connecting a sensor or actuator to a processor so that data can be read or control can be performed. Before connecting any sensor, check voltage level, pin type, current requirement, communication protocol, and library support.

Temperature and Humidity Sensor: DHT11

DHT11 is a low-cost digital sensor that measures temperature and relative humidity. It uses one data pin. It is slower and less accurate than DHT22, but it is common in beginner IoT labs.

DHT11 PinConnect To Raspberry Pi
VCC3.3 V or 5 V depending on module
DATAAny GPIO input pin, commonly GPIO4
GNDGround
import time
import board
import adafruit_dht

dht = adafruit_dht.DHT11(board.D4)

while True:
    temperature = dht.temperature
    humidity = dht.humidity
    print(temperature, humidity)
    time.sleep(2)

Motion Sensor: PIR

PIR means Passive Infrared sensor. It detects motion by sensing changes in infrared radiation from warm objects such as humans. It is widely used in security lights, automatic doors, and room occupancy detection.

  • VCC: usually 5 V on common PIR modules.
  • OUT: digital signal, HIGH when motion is detected.
  • GND: ground connection.
  • Delay and sensitivity: adjustable on many modules.
from gpiozero import MotionSensor
from signal import pause

pir = MotionSensor(17)

pir.when_motion = lambda: print("Motion detected")
pir.when_no_motion = lambda: print("No motion")

pause()

Obstacle Detection Using Ultrasonic Sensor

HC-SR04 ultrasonic sensor measures distance by sending a sound pulse and measuring the echo time. Raspberry Pi GPIO is 3.3 V, so the echo pin often needs a voltage divider because many HC-SR04 modules output 5 V.

Distance = (Echo time x Speed of sound) / 2
from gpiozero import DistanceSensor
from time import sleep

sensor = DistanceSensor(echo=24, trigger=23)

while True:
    print("Distance:", round(sensor.distance * 100, 2), "cm")
    sleep(1)

Communicating Using GPIO Interfacing

GPIO pins can work as digital input or output. They can also support special functions.

InterfaceUseExample
Digital GPIOSimple HIGH or LOW signal.LED, relay, switch.
PWMVariable duty cycle output.LED brightness, servo control.
I2CTwo-wire serial bus.LCD, RTC, sensors.
SPIFast serial interface.ADC, display, RFID.
UARTSerial communication.GPS, GSM, Bluetooth module.

Accessing On-board Wi-Fi

On-board Wi-Fi connects Raspberry Pi to a router or hotspot. After connection, the Pi can send sensor data to a server, cloud dashboard, or local web page.

# scan visible Wi-Fi networks
nmcli dev wifi list

# connect to Wi-Fi
sudo nmcli dev wifi connect "NetworkName" password "Password"

# test internet connectivity
ping -c 4 ashishvegan.com

Connecting Database with Raspberry Pi

A Raspberry Pi can store sensor readings in SQLite, MySQL, MariaDB, or a simple JSON file. SQLite is useful for small local projects because it stores data in one file and does not need a separate database server.

import sqlite3
from datetime import datetime

db = sqlite3.connect("sensor_data.db")
db.execute("""CREATE TABLE IF NOT EXISTS readings (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  created_at TEXT,
  temperature REAL,
  humidity REAL
)""")

db.execute(
  "INSERT INTO readings(created_at, temperature, humidity) VALUES (?, ?, ?)",
  (datetime.now().isoformat(), 30.5, 62.0)
)
db.commit()
db.close()

Exam tip: For every sensor answer, write pin connection, working principle, code logic, and one application.

Unit 5

IoT Design Using Raspberry Pi

Goal: design Raspberry Pi based IoT applications using web servers, GPIO control, databases, Node-RED, and MQTT.

IoT Applications Based on Raspberry Pi

Raspberry Pi can act as a sensor gateway, automation controller, web server, data logger, camera system, or MQTT client. It is useful when the project needs Linux services, networking, graphical tools, or storage.

Smart HomeLights, fan, door lock, energy monitor.
Smart FarmSoil moisture, temperature, irrigation control.
Health MonitorWearable gateway, alert system, dashboard.
Industrial IoTMachine status, vibration, predictive maintenance.
Smart ClassroomAttendance, air quality, display control.
SecurityPIR alarm, camera, remote notifications.

LAMP Web Server

LAMP means Linux, Apache, MySQL or MariaDB, and PHP. On Raspberry Pi, LAMP allows students to create local web dashboards that read data from sensors and display it in a browser.

sudo apt update
sudo apt install apache2 php mariadb-server
sudo systemctl enable apache2
sudo systemctl start apache2

GPIO Control Over Web Browser

A browser button can send a request to a server script. The script can run safe GPIO code to switch a relay, LED, or appliance. For real projects, add authentication and electrical isolation before controlling high voltage loads.

<button onclick="fetch('/relay.php?state=on')">ON</button>
<button onclick="fetch('/relay.php?state=off')">OFF</button>

Creating Custom Web Pages for LAMP

A custom IoT page usually contains live sensor values, control buttons, status indicators, charts, and logs. Keep pages simple on mobile because most users monitor IoT devices from phones.

Communicating Data Using On-board Module

Raspberry Pi can use on-board Wi-Fi, Ethernet, and Bluetooth for data communication. Common protocols are HTTP for web APIs, MQTT for lightweight messaging, and WebSocket for live dashboards.

Home Automation Using Raspberry Pi

Home automation uses sensors, relays, and software rules to control electrical devices. Raspberry Pi can provide schedules, web control, voice assistant integration, and remote monitoring.

  • Use relay modules with opto-isolation for mains devices.
  • Separate low-voltage electronics from high-voltage wiring.
  • Add manual override and emergency shutdown.
  • Use authentication for web control pages.

Node-RED

Node-RED is a visual programming tool for wiring together hardware devices, APIs, and online services. It uses nodes connected by flows. On Raspberry Pi, students can create IoT dashboards without writing large programs.

MQTT Protocol

MQTT is a lightweight messaging protocol based on publish and subscribe. Devices publish data to topics. Other devices or dashboards subscribe to topics and receive messages through a broker.

import paho.mqtt.publish as publish

publish.single(
  "home/room1/temperature",
  payload="30.5",
  hostname="localhost"
)

Using Node-RED Visual Editor

  1. Install or open Node-RED on Raspberry Pi.
  2. Open the editor in a browser using port 1880.
  3. Drag input, function, output, MQTT, and dashboard nodes.
  4. Connect nodes to create a flow.
  5. Deploy the flow and test messages.
# start Node-RED
node-red-start

# open in browser
http://raspberrypi.local:1880

Exam tip: In MQTT answers, define publisher, subscriber, broker, topic, and payload.

Quiz Portal

Unit-wise Practice Quiz

Each unit has 10 questions. Options are shuffled every time. If you choose a wrong answer, the correct answer appears immediately.

Unit 1 Quiz Question 1 of 10

Loading question...

Score: 0 Best: 0/10