CS3691 - EMBEDDED SYSTEMS & IOT
UNIT – 1
2 MARKS
1. What are the flags in 8051?
The 8051 microcontroller has five flags in the Program Status Word (PSW):
   1.   Carry (CY)
   2.   Auxiliary Carry (AC)
   3.   Overflow (OV)
   4.   Parity (P)
   5.   User-defined flag (F0)
2. List out the addressing modes of 8051.
The 8051 supports the following addressing modes:
   1.   Immediate
   2.   Register
   3.   Direct
   4.   Indirect
   5.   Indexed
3. What is the use of PSW?
The Program Status Word (PSW) holds status bits such as flags and register bank select bits.
It is used to reflect the status of the ALU and to control certain operations in the 8051.
4. Name the interrupts available in 8051.
The 8051 microcontroller has five interrupts:
   1.   External Interrupt 0 (INT0)
   2.   Timer 0 Overflow (TF0)
   3.   External Interrupt 1 (INT1)
   4.   Timer 1 Overflow (TF1)
   5.   Serial Communication (RI/TI)
5. Define JUMP and CALL.
JUMP is used to transfer program control to a different address within the program.
CALL is used to invoke a subroutine, storing the return address on the stack for later return
using the RET instruction.
13 MARKS
1.8051 Microcontroller Architecture and Components
1. 8051 Microcontroller – Overview
The 8051 is an 8-bit microcontroller developed by Intel. It contains:
   •   4 KB on-chip ROM
   •   128 Bytes RAM
   •   32 I/O lines
   •   2 Timers
   •   Serial communication port
   •   5 interrupt sources
It is widely used in embedded systems due to its simplicity and efficient instruction set.
2. Architecture of 8051 Microcontroller
The 8051 architecture consists of the following main components:
   •   Central Processing Unit (CPU)
   •   Internal RAM and ROM
   •   Input/Output Ports (P0–P3)
   •   Timers/Counters
   •   Serial Communication
   •   Interrupt Control
   •   Oscillator & Clock Circuit
   •   Special Function Registers (SFRs)
   •   Data Bus and Address Bus
3. Central Processing Unit (CPU)
The CPU is the brain of the microcontroller. It fetches, decodes, and executes instructions.
The CPU interacts with internal memory and peripherals using buses.
Key CPU components:
   •   ALU (Arithmetic Logic Unit)
   •   Accumulator (A Register)
   •   B Register
   •   Program Counter (PC)
   •   Stack Pointer (SP)
   •   Flags and PSW
   •   Data Pointer (DPTR)
4. A and B CPU Registers
   •   A Register (Accumulator):
          o 8-bit register used for arithmetic, logic, and data transfer operations.
          o Most operations involve the accumulator.
   •   B Register:
          o   Used with the A register in multiplication and division instructions.
          o   Also used as a general-purpose register in some instructions.
5. Data Pointer (DPTR)
   •   DPTR is a 16-bit register used to access external memory.
   •   It consists of two 8-bit registers:
           o DPH (Data Pointer High)
           o DPL (Data Pointer Low)
   •   Used in indirect addressing to point to data or code memory.
6. Program Counter (PC)
   •   PC is a 16-bit register.
   •   Holds the address of the next instruction to be executed.
   •   Automatically increments after each instruction.
   •   Enables sequential execution of instructions.
7. 8051 Flag Bits and the PSW Register
🔷 Program Status Word (PSW)
   •   The PSW is an 8-bit register that contains flag bits and register bank select bits.
   •   PSW Format:
                         CY AC F0 RS1 RS0 OV — P
                         7  6  5  4   3   2  1 0
🔷 Flags Description:
   •   CY (Carry Flag): Set if there is a carry in arithmetic operations.
   •   AC (Auxiliary Carry): Used in BCD operations.
   •   F0: User-defined general-purpose flag.
   •   RS1, RS0: Register bank select bits (00–11 selects banks 0–3).
   •   OV (Overflow): Set if result exceeds 8 bits.
   •   P (Parity): Set if number of 1’s in Accumulator is even (even parity).
8. Special Function Registers (SFRs)
  •   SFRs are memory-mapped registers used to control the operation of 8051.
  •   Located from address 80H to 0FFH.
Summary Table
                 Component                     Description
                CPU              Executes instructions
                A, B Registers   A for main operations, B for MUL/DIV
                DPTR             16-bit data address register
                PC               Holds address of next instruction
                PSW              Status register with flags
                Flags            CY, AC, OV, P, etc.
                SFRs             Special registers to control peripherals
2.8051 Microcontroller – Pin Diagram and Block Diagram
1. Pin Diagram of 8051 Microcontroller
You must draw a 40-pin DIP (Dual Inline Package) layout as shown below:
        ____________________________
2. Pin Description
   •   Pins 1-8 (Port 1): General-purpose I/O port.
   •   Pin 9 (RST): Reset input; active high.
   •   Pins 10–17 (Port 3): I/O port with alternate functions:
          o RXD, TXD (Serial)
          o INT0, INT1 (Interrupts)
          o T0, T1 (Timers)
          o WR, RD (External memory access)
   •   Pins 18-19 (XTAL1, XTAL2): Crystal oscillator connections.
   •   Pin 20 (GND): Ground.
   •   Pins 21–28 (Port 2): High-order address byte (A8–A15) for external memory.
   •   Pin 29 (PSEN): Program Store Enable; used to read external program memory.
   •   Pin 30 (ALE): Address Latch Enable; latches lower byte of address.
   •   Pin 31 (EA): External Access; tied to GND for external ROM, Vcc for internal.
   •   Pins 32–39 (Port 0): Multiplexed address/data bus (AD0–AD7).
   •   Pin 40 (Vcc): Power supply +5V.
3. Block Diagram of 8051 Microcontroller
           +---------------------+
           |   4 KB ROM          |
           +---------------------+
           |   128 Bytes RAM     |
           +---------------------+
           | Accumulator (A)     |
           | B Register          |
           +---------------------+
           | Arithmetic Logic Unit|
           +---------------------+
           | Program Counter     |
           | Stack Pointer       |
           +---------------------+
           | Timer 0 | Timer 1 |
           +---------------------+
           | Serial Port (TXD/RXD)|
           +---------------------+
           | Interrupt Control   |
           +---------------------+
           | I/O Ports (P0–P3)   |
           +---------------------+
           | Oscillator & Clock |
           +---------------------+
4. Explanation of Block Diagram
   •   ROM & RAM: 8051 has 4KB on-chip ROM and 128B RAM.
   •   ALU: Performs arithmetic and logical operations.
   •   A & B Registers: Special function registers used in operations.
   •   Program Counter (PC): Holds address of the next instruction.
   •   Stack Pointer (SP): Points to top of the stack in internal RAM.
   •   Timers: Two 16-bit timers/counters for delay or event counting.
   •   Serial Port: Enables serial communication using TXD and RXD.
   •   Interrupt Control: Handles five interrupt sources (INT0, INT1, TF0, TF1, Serial).
   •   Ports P0–P3: Each is 8-bit wide and used for input/output operations.
   •   Oscillator: Provides system clock, typically using a 12 MHz crystal.
3.Timer Modes and Interrupt Handling in 8051
Microcontroller
Timer Modes of 8051
Introduction to Timers
The 8051 microcontroller has two timers/counters:
   •   Timer 0
     •   Timer 1
         Each timer is 16-bit and can be used as a timer (for internal clock-based delays) or a
         counter (to count external events).
Registers Used
     •   TMOD (Timer Mode Register) – Selects timer mode
     •   TCON (Timer Control Register) – Starts/stops the timers
TMOD Register Format (8-bit)
 Bit No.           7       6     5       4        3      2      1      0
 Name         GATE        C/T   M1    M0     GATE      C/T    M1     M0
 For          T1          T1    T1    T1     T0        T0     T0     T0
🚦 Timer Modes
 Mode                      Description                                Operation
 0         13-bit timer                                TLx = 5 bits, THx = 8 bits
 1         16-bit timer                                TLx + THx = 16 bits (full range)
 2         8-bit auto-reload                           TLx = 8 bits; reload from THx
 3         Split Timer Mode (T0 splits to 2x 8-bit)    T0 → TL0 and TH0 act as two timers
Usage Example:
Timer mode 1 (16-bit) is commonly used for generating delays or baud rate timing for serial
communication.
Interrupt Handling in 8051
Introduction
8051 supports five interrupt sources with vector addresses:
     Interrupt            Source           Vector Address
 INT0                  External 0        0003H
 TF0                   Timer 0           000BH
 INT1                  External 1        0013H
 TF1                   Timer 1           001BH
 Serial (RI/TI)        UART              0023H
Interrupt Process (Handling Steps)
   1.   Interrupt occurs
   2.   Current program execution is suspended
   3.   Program jumps to ISR (Interrupt Service Routine)
   4.   ISR executes
   5.   RET or RETI returns control to main program
Registers Used
   •    IE (Interrupt Enable Register) – Enables/disables interrupts
   •    IP (Interrupt Priority Register) – Sets priority among interrupts
IE Register Format
 EA — ET2 ES ET1 EX1 ET0 EX0
 7  6 5   4  3   2   1   0
   •    EA – Global enable/disable
   •    EX0, ET0, EX1, ET1, ES – Enables respective interrupts
Interrupt Priority (IP Register)
 — — PT2 PS PT1 PX1 PT0 PX0
   •    Priority bits:
            o High priority = 1
            o Low priority = 0
   •    Allows nesting of interrupts
                                     UNIT – 2
2 MARKS
1. What is RTOS?
RTOS stands for Real-Time Operating System.
It is an operating system designed to process data and respond to inputs within a guaranteed
time, making it suitable for time-critical applications like embedded systems, robotics, and
medical devices.
2. What is Kernel?
A kernel is the core part of an operating system that manages system resources, such as
CPU, memory, and I/O devices.
It handles task scheduling, interrupt handling, and inter-process communication.
3. What is Priority Scheduling?
Priority scheduling is a CPU scheduling algorithm where each process is assigned a
priority.
The CPU is allocated to the process with the highest priority (lowest number or highest
rank), either preemptively or non-preemptively.
4. Differentiate Preemptive and Non-Preemptive Scheduling
           Preemptive Scheduling                       Non-Preemptive Scheduling
 CPU can be taken away from a running            Once a process starts, it runs to
 process                                         completion
 More responsive to high-priority tasks          Simpler and less overhead
5. What do you mean by LED Interfacing?
LED interfacing refers to the process of connecting and controlling an LED using a
microcontroller or processor.
It typically involves configuring a GPIO pin as output and sending logic high or low
signals to turn the LED ON or OFF.
13 MARKS
1.RTOS (Real-Time Operating System)
1. What is RTOS?
An RTOS (Real-Time Operating System) is a special type of operating system designed to
process and respond to external inputs within a guaranteed time constraint.
It is used in embedded systems, robotics, medical instruments, automotive systems, and
aerospace where timing is critical.
2. Qualities of a Good RTOS
A good RTOS should meet the following requirements:
              Quality                                 Description
 Determinism                         Predictable task execution time
 Minimal Latency                     Quick interrupt and context switch
 Multitasking Support                Run multiple tasks with efficiency
 Low Memory Footprint                Works with limited memory/resources
 Scalability & Portability           Works across hardware platforms
 Robust Synchronization              Semaphores, mutexes, message queues
 Reliability & Fault Tolerance       Stable under failure conditions
3. Characteristics of RTOS
         Characteristic                          Explanation
 Predictable Timing               Meets strict deadlines
 Priority-Based Scheduling        Executes high-priority tasks first
 Fast Context Switching              Quickly switches between tasks
 Real-Time Clock Support             Time-stamped operations
 Efficient Interrupt Handling        Minimal ISR latency
 Task Synchronization                Avoids conflicts with shared resources
 Minimal Jitter                      Consistent task execution intervals
4. How to Choose an RTOS?
Criteria to select the right RTOS:
   1. Application Requirements:
         o Real-time needs (hard or soft?)
         o Timing constraints and precision
   2. Hardware Compatibility:
         o CPU architecture and memory support
   3. Performance Metrics:
         o Latency, context switching time, throughput
   4. Footprint & Scalability:
         o Minimal ROM/RAM usage
         o Modularity for scaling
   5. Toolchain Support:
         o IDE, compiler, debugger availability
   6. Vendor Support & Licensing:
         o Open-source vs commercial
         o Technical documentation and community support
5. Difference Between Hard and Soft Real-Time Systems
       Feature              Hard Real-Time System                 Soft Real-Time System
 Timing Constraint      Strict and must be met               Desirable but not mandatory
 Deadline Miss          System failure or hazardous          Reduced performance or quality
 Impact
 Examples               Pacemakers, airbags, industrial      Audio/video streaming, online
                        robots                               gaming
 Tolerance to Delay     No tolerance                         Some tolerance allowed
 Complexity & Cost      Higher                               Moderate to low
2.Priority-Based Scheduling Algorithm and Scheduling
Problems
1. Introduction to CPU Scheduling
CPU scheduling is the process of determining which process in the ready queue should be
allocated the CPU next. Among various algorithms, Priority Scheduling selects processes
based on assigned priorities.
2. What is Priority-Based Scheduling?
In Priority Scheduling, each process is assigned a priority number. The CPU is allocated
to the process with the highest priority.
     •    Priorities can be static (fixed at design time) or dynamic (change during execution).
     •    A lower number often indicates higher priority (conventionally).
3. Types of Priority Scheduling
     Type                                               Description
 Preemptive              If a new process with higher priority arrives, it preempts the running
                         process.
 Non-                    Once a process starts, it runs to completion—even if a higher priority
 Preemptive              process enters.
4. Example: Priority Scheduling (Non-Preemptive)
    Process         Arrival Time             Burst Time       Priority
 P1             0                        10               2
 P2             0                        5                1
 P3             0                        8                3
✅ Execution Order: P2 → P1 → P3
(P2 has the highest priority)
5. Gantt Chart
|    P2    |        P1       |      P3        |
0          5                15               23
6. Advantages of Priority Scheduling
     •    ✅ Efficient for real-time systems
  •   ✅ Quick response for critical tasks
  •   ✅ Supports differentiated service levels (high-priority tasks handled first)
7. Comparison: Priority vs Other Scheduling Algorithms
    Feature         Priority Scheduling      FCFS       Round Robin
Fairness           Low (starvation risk)     High      High
Preemption         Optional                  No        Yes
Real-Time Use      Yes                       No        Limited
8. Use Cases
  •   Embedded systems
  •   Real-time operating systems
  •   Multimedia applications
  •   Critical safety applications (e.g., airbags, pacemakers)
                                     UNIT – 3
2 MARKS
1. What is IoT?
IoT (Internet of Things) refers to a network of physical objects embedded with sensors,
software, and connectivity to exchange data with other devices or systems over the internet.
Example: Smart home devices, smart watches.
2. What is Arduino?
Arduino is an open-source electronics platform based on simple microcontroller boards
and a development environment.
It is used for building digital devices and interactive systems for IoT, automation, and
robotics.
3. What is Arduino Toolchain?
The Arduino toolchain is a set of software tools used for writing, compiling, and
uploading code to an Arduino board.
It includes the Arduino IDE, compiler (AVR-GCC), loader (AVRDUDE), and libraries.
4. What are Sketches?
A sketch is a program written using the Arduino IDE.
It consists of two main functions: setup() (runs once) and loop() (runs continuously), and
is uploaded to the Arduino board.
5. Differentiate Actuators and Sensors
                 Sensors                                     Actuators
 Detect physical changes (input)             Cause physical movement (output)
 Convert physical signals to electrical      Convert electrical signals to physical
 Example: Temperature sensor                 Example: Motor, Relay
13 MARKS
1.Explain the Structure of Arduino Programming
1. Introduction to Arduino Programming
Arduino is an open-source electronics platform used for prototyping embedded systems.
Arduino programs are written in a simplified form of C/C++, using the Arduino IDE. The
structure of an Arduino program is very simple and includes two primary functions:
setup() and loop().
2. Basic Structure of Arduino Sketch
void setup() {
  // Code that runs once when the program starts
}
void loop() {
  // Code that runs repeatedly in a loop
}
3. Main Components of Arduino Programming
a) Setup Function
   •   Function: void setup()
   •   Executes once when the microcontroller starts or resets.
   •   Used for initializing variables, pin modes, libraries, and serial communication.
void setup() {
  Serial.begin(9600);        // Start serial communication
  pinMode(13, OUTPUT);       // Set digital pin 13 as output
}
b) Loop Function
   •   Function: void loop()
   •   Runs continuously after setup() is complete.
   •   It forms the core logic of your program, repeatedly executing the code.
void loop() {
  digitalWrite(13, HIGH);         //   Turn   LED on
  delay(1000);                    //   Wait   1 second
  digitalWrite(13, LOW);          //   Turn   LED off
  delay(1000);                    //   Wait   1 second
}
4. Other Elements in Arduino Programming
c) Variable Declarations
Variables can be declared globally (before setup()) or locally (inside functions).
int ledPin = 13;       // Global variable
d) Functions
User-defined functions can be created to organize and reuse code.
void blinkLED() {
  digitalWrite(13, HIGH);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
}
e) Libraries
Libraries extend the functionality of Arduino (e.g., sensors, displays).
#include <Servo.h>       // Include Servo library
Servo myServo;
f) Comments
Used for documentation and ignored during compilation.
// This is a single-line comment
/* This is a
   multi-line comment */
5. Example: Complete Sketch
int ledPin = 13;
void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}
6. Compilation Process (Toolchain Overview)
   1. Preprocessing – The sketch is prepared for compilation.
   2. Compilation – Code is converted to machine code using AVR-GCC.
   3. Uploading – AVRDUDE uploads the compiled code to the Arduino board.
2.Integration of Sensors and Actuators with Arduino
1. Introduction
Arduino is a microcontroller platform widely used in embedded systems and IoT projects.
One of its core applications is the interfacing of sensors and actuators to collect data from
the environment and control physical devices.
2. What are Sensors and Actuators?
 Component                                        Description
 Sensor         A device that detects physical input from the environment (e.g., temperature,
                light, motion) and converts it into electrical signals.
 Actuator       A device that converts electrical signals into physical action (e.g., motors,
                LEDs, buzzers).
3. Types of Sensors and Actuators Commonly Used with Arduino
🔹 Sensors:
   •   Temperature Sensor (e.g., LM35, DHT11)
   •   Light Sensor (LDR)
   •   Ultrasonic Sensor (HC-SR04)
   •   IR Sensor
   •   Gas Sensor (MQ2)
🔹 Actuators:
   •   LED
   •   DC Motor
   •   Servo Motor
   •   Buzzer
   •   Relay
4. Interfacing Sensors with Arduino
Example: LM35 Temperature Sensor
int tempPin = A0; // Analog input pin
void setup() {
  Serial.begin(9600);
}
void loop() {
  int value = analogRead(tempPin);
  float voltage = value * (5.0 / 1023.0);
  float temperature = voltage * 100;
  Serial.println(temperature);
  delay(1000);
}
   •   Analog signal from sensor is read using analogRead().
   •   Processed and displayed using Serial Monitor.
5. Interfacing Actuators with Arduino
Example: Controlling LED
int ledPin = 13;
void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  digitalWrite(ledPin, HIGH); // Turn ON
  delay(1000);
  digitalWrite(ledPin, LOW); // Turn OFF
  delay(1000);
}
    •    Uses digitalWrite() to control actuator state.
6. Combined Example: Sensor-Controlled Actuator
Automatic Fan Control using Temperature Sensor + DC Motor
int tempPin = A0;
int motorPin = 9;
void setup() {
  pinMode(motorPin, OUTPUT);
}
void loop() {
  int temp = analogRead(tempPin);
  float voltage = temp * 5.0 / 1023.0;
  float temperature = voltage * 100;
    if (temperature > 30) {
      digitalWrite(motorPin, HIGH); // Fan ON
    } else {
      digitalWrite(motorPin, LOW); // Fan OFF
    }
}
    •    Sensor input is used to control an actuator dynamically.
7. Communication Methods
        Method                      Use                               Function
Digital I/O           LEDs, switches                      digitalRead(), digitalWrite()
Analog Input          Sensors like LM35                   analogRead()
PWM Output            Motors, dim LEDs                    analogWrite()
I2C/SPI               Advanced sensors/modules            Wire.h, SPI.h
8. Applications
    •    Smart Homes (motion sensors + light control)
    •    Weather Stations (temperature, humidity)
•   Smart Agriculture (moisture sensors + water pumps)
•   Industrial Automation
•   Health Monitoring Devices
                                     UNIT – 4
2 MARKS
1. Write the use of Raspberry Pi in IoT
Raspberry Pi is a low-cost, credit-card-sized computer used in IoT for data processing,
device control, cloud connectivity, and edge computing. It supports multiple sensors,
cameras, and communication protocols for building smart and autonomous systems.
2. What is ZigBee?
ZigBee is a low-power, wireless communication protocol based on the IEEE 802.15.4
standard. It is used for short-range communication in IoT applications such as home
automation, industrial control, and smart lighting.
3. What are IoT Communication Protocols?
IoT communication protocols enable data exchange between devices. Examples include:
   •   MQTT (Message Queuing Telemetry Transport)
   •   CoAP (Constrained Application Protocol)
   •   HTTP/HTTPS
   •   AMQP (Advanced Message Queuing Protocol)
       These protocols help devices communicate efficiently and securely over networks.
4. List out the GSM Modules
Common GSM modules used in IoT are:
   •   SIM800
   •   SIM900
   •   SIM808
   •   Quectel M95
       These modules support SMS, voice, and GPRS for remote communication in IoT
       applications.
5. What are the states of Bluetooth devices and WiFi?
🔹 Bluetooth States
   •   Idle
   •   Inquiry
   •   Page
   •   Connected
   •   Sniff/Hold/Park (low-power modes)
🔹 Wi-Fi States
   •   Disconnected
   •   Connecting
   •   Connected
   •   Obtaining IP address
   •   Roaming
   •   Idle
13 MARKS
1.How to Access, Send, and Receive Signals Using GPIO
Pins?
1. Introduction to GPIO
GPIO stands for General Purpose Input/Output. These are programmable pins available
on microcontrollers (like Arduino, Raspberry Pi, ESP32) used for reading input signals
from sensors or sending output signals to actuators.
2. GPIO Pin Modes
Each GPIO pin can be configured in two modes:
   •   Input Mode – To receive data from external devices (e.g., switches, sensors)
   •   Output Mode – To send data to external devices (e.g., LEDs, motors)
3. Accessing GPIO Pins
GPIO access involves:
   •   Pin number identification (e.g., D0, GPIO17)
   •   Pin configuration (input or output mode)
   •   Data reading or writing
4. Using GPIO in Arduino (Example)
a) Configure GPIO Pin
pinMode(7, OUTPUT); // Configure pin 7 as output
pinMode(2, INPUT); // Configure pin 2 as input
b) Send Signal (Output)
digitalWrite(7, HIGH); // Set pin 7 to HIGH (5V)
digitalWrite(7, LOW); // Set pin 7 to LOW (0V)
c) Receive Signal (Input)
int value = digitalRead(2); // Read input from pin 2 (HIGH or LOW)
5. Using GPIO in Raspberry Pi (Python Example)
Required Library:
import RPi.GPIO as GPIO
import time
a) Setup
GPIO.setmode(GPIO.BCM)              # Use BCM pin numbering
GPIO.setup(17, GPIO.OUT)            # Set GPIO17 as output
GPIO.setup(18, GPIO.IN)             # Set GPIO18 as input
b) Sending Signal
GPIO.output(17, GPIO.HIGH)          # Send HIGH signal
GPIO.output(17, GPIO.LOW)           # Send LOW signal
c) Receiving Signal
if GPIO.input(18) == GPIO.HIGH:
    print("Input is HIGH")
d) Cleanup
GPIO.cleanup()      # Releases all GPIO pins
6. GPIO-Based Applications
    Sensor/Input              GPIO Input
 Push Button           Detect HIGH/LOW
 PIR Motion Sensor     Detect motion
   Actuator/Output            GPIO Output
 LED                        Turn ON/OFF
 Relay/Motor                Drive control
7. Precautions When Using GPIO
   •   Avoid Overvoltage (Exceeding 3.3V or 5V can damage pins)
   •   Use resistors with LEDs to limit current
   •   Debouncing may be needed for mechanical switches
   •   Don't connect input pins to power without grounding
8. Real-Time Example
IoT Door Monitoring System
   •   Sensor (Magnetic Switch) connected to GPIO input
   •   LED/Buzzer connected to GPIO output
   •   When door opens (switch opens), buzzer is triggered.
2.Architecture of Raspberry Pi, Board Overview, Linux
OS, and Comparison with Desktop Computer
1. Introduction to Raspberry Pi
Raspberry Pi is a low-cost, credit card-sized single-board computer (SBC) developed by
the Raspberry Pi Foundation. It is widely used in IoT, robotics, embedded systems, and
educational projects.
2. Architecture of Raspberry Pi
Raspberry Pi is based on the ARM architecture. Its major architectural components include:
 a) System-on-Chip (SoC)
   •   Contains the ARM CPU, GPU, and other components integrated in a single chip
       (e.g., Broadcom BCM2711 in Raspberry Pi 4).
 b) Central Processing Unit (CPU)
   •   Typically a Quad-Core ARM Cortex-A72 @ 1.5 GHz in Raspberry Pi 4.
   •   Executes instructions and controls system operation.
 c) Graphics Processing Unit (GPU)
   •   VideoCore IV GPU (in most models).
   •   Handles graphics rendering, especially for HDMI output and video processing.
d) Memory (RAM)
   •   Varies by model: 1 GB to 8 GB LPDDR4 RAM (in Raspberry Pi 4).
e) Storage
   •   Uses microSD card as primary storage.
   •   Can also boot from USB drives (on newer models).
f) Power Supply
   •   5V DC via USB Type-C or micro-USB depending on model.
3. Raspberry Pi Board Components
       Component                                  Function
 GPIO Pins               40 pins for input/output with sensors, actuators
 USB Ports               Connect mouse, keyboard, and USB drives
 HDMI Port               Display interface for monitor/TV
 CSI Camera Port         Interface for Pi Camera Module
 DSI Display Port        For official Pi touchscreen
 Ethernet Port           Wired network access
 Wi-Fi/Bluetooth         Wireless communication
 Audio Jack                Audio output
 MicroSD Slot              Operating system and file storage
4. Linux on Raspberry Pi
a) Raspberry Pi OS (formerly Raspbian)
   •   Official Linux distribution based on Debian.
   •   Optimized for Raspberry Pi hardware.
b) Other Supported OS
   •   Ubuntu Server
   •   Kali Linux
   •   LibreELEC (for media)
   •   Windows 10 IoT Core (for IoT apps)
c) Linux Features on Raspberry Pi
   •   Command Line & GUI (LXDE desktop)
   •   Python & C/C++ programming
   •   Package Manager (APT)
   •   Multitasking and network capabilities
5. Differences Between Raspberry Pi and Desktop Computer
       Feature                    Raspberry Pi                       Desktop Computer
 Processor               ARM-based (mobile class)              x86/x64-based (Intel/AMD)
 Size                    Credit card-sized                     Large tower or laptop
 Power Consumption       Low power (5V, ~3W)                   High power (>150W)
 Performance             Limited performance                   High-performance CPU & GPU
 Expandable              GPIO, camera, HATs                    PCIe, SATA, RAM slots, GPUs
 Operating System        Linux-based (Raspberry Pi OS)         Windows/macOS/Linux
 Storage                 MicroSD or USB                        HDDs/SSDs
Price                     Low-cost (~₹3500–₹6000)   Expensive (₹30,000+)
6. Applications of Raspberry Pi
   •    Home automation
   •    Weather monitoring
   •    Media center
   •    IoT gateway
   •    Robotics
   •    Educational coding kits
                                    UNIT – 5
2 MARKS
1. What is Smart City?
A Smart City uses IoT, sensors, and data analytics to improve urban services such as
traffic management, waste disposal, water supply, and public safety, aiming to enhance
the quality of life for citizens.
2. What is Smart Healthcare?
Smart Healthcare involves the use of IoT-enabled medical devices, wearables, and health
monitoring systems to provide real-time patient data, remote diagnosis, and automated
alerts for better medical care and treatment.
3. What is Smart Agriculture?
Smart Agriculture uses IoT technologies like soil sensors, weather stations, and
automated irrigation systems to monitor crop conditions, optimize farming practices, and
increase productivity and sustainability.
4. What is the use of developing IoT applications in Home Automation
System?
IoT in home automation allows for remote control and monitoring of appliances, lighting,
security, and climate. It improves energy efficiency, convenience, and safety in smart
homes.
5. List the Design Metrics of Embedded System.
Key design metrics of an embedded system include:
   •   Performance
   •   Power consumption
   •   Cost
   •   Size
   •   Reliability
   •   Time-to-market
13 MARKS
1.Smart Agriculture, Smart Irrigation, Greenhouse
Control, Smart Healthcare, and Health & Fitness
Monitoring
1. Introduction
The Internet of Things (IoT) enables automation, monitoring, and control of various real-
world applications. Smart agriculture and smart healthcare are two major domains using
IoT for improving productivity and quality of life.
SMART AGRICULTURE SYSTEMS
2. Smart Agriculture
Smart Agriculture uses sensors and IoT devices to monitor crop health, soil conditions, and
environmental factors in real time.
Technologies Involved:
   •   Soil moisture and pH sensors
   •   Weather monitoring systems
   •   Drones for crop surveillance
   •   GPS and data analytics
Benefits:
   •   Higher crop yields
   •   Reduced manual labor
   •   Efficient resource use
3. Smart Irrigation
Smart irrigation automates water supply using soil data and environmental inputs.
Working:
   •   Sensors monitor soil moisture
   •   Microcontroller (like Arduino or Raspberry Pi) decides when to water
   •   Water pump is turned on/off automatically
   •   Data can be monitored via cloud/mobile apps
Advantages:
   •   Water conservation
   •   Reduced human intervention
   •   Improves crop health
4. Greenhouse Monitoring and Control
Greenhouse systems maintain controlled conditions for plant growth.
Monitored Parameters:
   •   Temperature
   •   Humidity
   •   Light
   •   CO₂ levels
IoT Actions:
   •   Fans, misters, and lights are automatically controlled
   •   Alerts for abnormal conditions via SMS or app
   •   Data stored and analyzed over time
Benefits:
   •   Improved plant growth
   •   Year-round farming
   •   Reduced labor cost
SMART HEALTHCARE SYSTEMS
5. Smart Healthcare
Smart Healthcare uses IoT for patient monitoring, diagnostics, and emergency alerts.
Key Features:
   •   Real-time tracking of heart rate, BP, oxygen levels
   •   Remote diagnosis by doctors
   •   Emergency alerts in case of anomalies
Devices Used:
   •   Wearable health trackers (smartwatches, patches)
   •   Smart beds and monitoring systems in hospitals
   •   Cloud platforms for health records
Advantages:
   •   Early detection of illness
   •   Remote care for elderly or chronically ill
   •   Improved hospital efficiency
6. Health and Fitness Monitoring
Wearables and smart fitness devices track body parameters for wellness.
Common Features:
   •   Step counter (pedometer)
   •   Heartbeat sensor
   •   Calorie tracker
   •   Sleep monitoring
IoT Integration:
   •   Data synced to mobile or cloud
   •   Personalized fitness recommendations
   •   Goal tracking with visual dashboards
Benefits:
   •   Promotes healthy lifestyle
   •   Real-time feedback on fitness
   •   Easy to share reports with healthcare providers
2.Three Levels of Home Automation System with
Applications
1. Introduction
Home Automation refers to the use of IoT and smart devices to automate and control home
functions like lighting, security, and appliances. It enhances comfort, energy efficiency,
safety, and convenience.
Home automation can be classified into three levels:
2. Levels of Home Automation
Level 1: Monitoring
   •   The system monitors the state of devices or the environment.
   •   User is notified but cannot take direct control automatically.
Examples:
   •   Temperature sensor shows room temperature on a mobile app.
   •   Security camera sends live feed to the user.
Level 2: Control
   •   The user can remotely control the devices via mobile apps or voice assistants.
Examples:
   •   Turn ON/OFF lights using a smartphone.
   •   Adjust AC temperature remotely.
Level 3: Automation / Intelligence
   •   Devices act automatically based on conditions or schedules.
   •   Uses AI, timers, sensors, and rules.
Examples:
   •   Light turns ON when motion is detected.
   •   Water heater turns ON at 6 AM daily.
3. Applications of Home Automation
A. Smart Lighting System
   •   Uses motion sensors, LDRs (Light Dependent Resistors), and Wi-Fi modules.
   •   Lights turn ON when someone enters the room.
   •   Brightness is adjusted based on ambient light.
Benefits:
   •   Energy-saving
   •   Remote operation
   •   Mood lighting and scheduling
B. Smart Appliances
Appliances like TVs, ACs, refrigerators, washing machines can be connected to the
internet.
Features:
   •   Controlled via smartphone or voice assistants (Alexa, Google Home)
   •   Scheduled operation (e.g., coffee machine at 7 AM)
   •   Alerts for maintenance or errors
Benefits:
   •   Convenience
   •   Remote access
   •   Efficient energy use
C. Intrusion Detection System
Used for home security. Devices include:
   •   PIR sensors – detect human movement
   •   Door/window sensors – trigger when unauthorized access happens
   •   CCTV/IP cameras – real-time monitoring
   •   Alarms and SMS/email alerts
Benefits:
   •   24/7 home protection
   •   Real-time intrusion alerts
   •   Remote surveillance
D. Smoke and Gas Detection
Ensures fire and gas leak safety.
Components:
   •   Smoke sensors (e.g., MQ-2, MQ-135)
   •   Gas sensors for detecting LPG, methane, CO
   •   Buzzers, LEDs, and SMS alerts
Working:
   •   If gas concentration crosses safe threshold, alarm sounds, and message is sent.
Benefits:
   •   Prevents accidents
   •   Real-time alerting
   •   Ensures home safety
15 MARKS
1.What is Arduino? Explain its Types
1. Introduction to Arduino
Arduino is an open-source electronics platform based on easy-to-use hardware and
software. It consists of a microcontroller (e.g., ATmega328P) and the Arduino IDE for
programming.
Arduino is used in:
   •   Embedded systems
   •   IoT projects
   •   Robotics
   •   Home automation
   •   Sensor-based applications
2. Features of Arduino
   •   Open-source hardware and software
   •   USB interface for programming
   •   Multiple digital and analog I/O pins
   •   Supports C/C++ language
   •   Compatible with sensors, motors, and modules
   •   Easily programmable using Arduino IDE
3. Block Diagram of Arduino UNO
4. Types of Arduino Boards
1. Arduino UNO
   •   Most popular and beginner-friendly
   •   Uses ATmega328P
   •   14 digital I/O pins, 6 analog inputs
   •   USB and DC power supply
Used in: Basic electronics, sensor interfacing, robotics
2. Arduino Mega 2560
   •   Advanced board with more I/O
   •   ATmega2560 microcontroller
   •   54 digital I/O, 16 analog inputs
   •   Suitable for large projects
Used in: 3D printers, complex automation
3. Arduino Nano
   •   Small and compact
   •   ATmega328P or ATmega168
   •   Same features as UNO in mini form
Used in: Wearable tech, mini IoT devices
4. Arduino Leonardo
   •   Uses ATmega32u4
   •   Can emulate a keyboard/mouse via USB
   •   Fewer external components
Used in: HID (Human Interface Device) applications
5. Arduino Due
   •   Based on ARM Cortex-M3 (32-bit)
   •   54 digital pins, 12 analog inputs
   •   More powerful than ATmega-based boards
Used in: High-speed computing tasks, industrial use
6. Arduino Pro Mini
   •   Very compact
   •   No USB port (needs external USB-to-serial)
   •   Low power consumption
Used in: Embedded low-power applications
7. Arduino Lilypad
   •   Washable and sewable
   •   Designed for wearable applications
Used in: E-textiles, smart clothing
2.Explain the Architecture of ZigBee
1. Introduction to ZigBee
ZigBee is a wireless communication protocol based on the IEEE 802.15.4 standard. It is
designed for low power, low data rate, and short-range communication, making it ideal
for IoT and embedded systems such as home automation, industrial control, and smart
agriculture.
2. Features of ZigBee
   •   Operates at 2.4 GHz (global), 868 MHz (Europe), 915 MHz (USA)
   •   Low data rate: 20 kbps to 250 kbps
   •   Low power consumption
   •   Supports up to 65,000+ nodes in a network
   •   Range: 10–100 meters
   •   Mesh, star, and tree topologies supported
3. ZigBee Architecture Overview
The ZigBee architecture consists of four main layers, built on the IEEE 802.15.4 physical
and MAC layers:
4. Layers of ZigBee Architecture
A. Physical (PHY) Layer
   •   Handles modulation, demodulation, transmission, and reception of data.
   •   Defines the frequency, bit rate, and modulation scheme.
   •   Uses O-QPSK (Offset Quadrature Phase Shift Keying) for 2.4 GHz band.
B. MAC (Medium Access Control) Layer
   •   Controls access to the wireless medium.
   •   Responsible for frame validation, acknowledgments, and collision avoidance.
   •   Manages beacon frames in beacon-enabled networks.
C. Network (NWK) Layer
   •   Handles routing, network formation, joining/leaving of devices.
   •   Supports star, mesh, and tree topologies.
   •   Assigns 16-bit network addresses to devices.
D. Application Layer
   •   Includes Application Support Sublayer (APS), ZigBee Device Objects (ZDO), and
       user applications.
▪ Application Support Sublayer (APS)
   •   Provides interface between NWK and application.
   •   Manages data formatting, security, and binding.
▪ ZigBee Device Object (ZDO)
   •   Responsible for device roles, network discovery, and service discovery.
5. ZigBee Device Types
ZigBee has 3 types of devices:
   Device Type                                   Description
 Coordinator         Starts and manages the network. Only one per network.
 (ZC)
 Router (ZR)         Routes data, can allow other devices to join the network.
 End Device          Limited functionality. Sleeps to save power. Communicates through a
 (ZED)               router or coordinator.
6. ZigBee Network Topologies
ZigBee supports:
   •   Star topology
   •   Tree topology
   •   Mesh topology (preferred for reliability and scalability)
Mesh topology allows multiple paths for data transmission, improving fault tolerance.
7. Applications of ZigBee
   •   Home automation (e.g., smart lighting, door locks)
   •   Smart meters and energy monitoring
   •   Industrial automation
   •   Wireless sensor networks
   •   Healthcare monitoring systems