Embedded System
A special-purpose computer built inside a larger product to control a specific task.
Student and Teacher Portal
Complete exam-ready syllabus in simple English
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.
Fast Revision
A special-purpose computer built inside a larger product to control a specific task.
A network of physical things that sense data, process it, communicate it, and support remote action.
A low-cost single-board computer useful for Linux based IoT projects, GPIO control, and web servers.
A lightweight publish-subscribe protocol commonly used for IoT messaging.
Unit 1
Goal: understand what embedded systems are, where they are used, how they are designed, and how they become part of an IoT architecture.
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.
Embedded systems are everywhere because modern products need sensing, control, communication, and automation.
| 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. |
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 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
Exam tip: In diagrams, always show data flowing upward from sensors to application and control commands flowing downward from application to actuator.
Unit 2
Goal: learn how modern chips integrate many blocks and how engineers model and develop embedded hardware.
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.
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. |
Embedded hardware design means selecting electronic components and connecting them so that the system meets functional, timing, power, size, and cost requirements.
Hardware development is iterative. Engineers build prototypes, test with instruments, update circuits, and validate final boards before mass production.
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
Goal: understand Raspberry Pi models, SoC architecture, GPIO pins, and on-board components.
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.
| 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. |
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.
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.
# 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
Goal: connect common sensors to Raspberry Pi, read values through GPIO, and send data to a database or server.
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.
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 Pin | Connect To Raspberry Pi |
|---|---|
| VCC | 3.3 V or 5 V depending on module |
| DATA | Any GPIO input pin, commonly GPIO4 |
| GND | Ground |
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)
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.
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()
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.
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)
GPIO pins can work as digital input or output. They can also support special functions.
| Interface | Use | Example |
|---|---|---|
| Digital GPIO | Simple HIGH or LOW signal. | LED, relay, switch. |
| PWM | Variable duty cycle output. | LED brightness, servo control. |
| I2C | Two-wire serial bus. | LCD, RTC, sensors. |
| SPI | Fast serial interface. | ADC, display, RFID. |
| UART | Serial communication. | GPS, GSM, Bluetooth module. |
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
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
Goal: design Raspberry Pi based IoT applications using web servers, GPIO control, databases, Node-RED, and MQTT.
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.
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
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>
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.
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 uses sensors, relays, and software rules to control electrical devices. Raspberry Pi can provide schedules, web control, voice assistant integration, and remote monitoring.
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 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"
)
# 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
Each unit has 10 questions. Options are shuffled every time. If you choose a wrong answer, the correct answer appears immediately.