Module - 4
1. Explain what an IoT device is. Describe the generic block diagram of an IoT device.
What is an IoT Device?
● An IoT (Internet of Things) device is a physical object that can:
○ Sense data from its environment
○ Process the data
○ Communicate the data over the internet or a network
● IoT devices work with minimal or no human intervention.
● Examples: temperature sensor, smart bulb, smart meter, Raspberry Pi–based
system.
Generic Block Diagram of an IoT Device
A typical IoT device consists of the following basic building blocks:
1. Sensing Block
● Consists of sensors and actuators.
● Sensors collect data such as:
○ Temperature
○ Humidity
○ Light
○ Motion
● Sensors can be:
○ Onboard
○ Externally connected
● Example: temperature sensor sensing room temperature.
2. Data Processing Block
● Includes a processor or microcontroller.
● Responsible for:
○ Processing sensor data
○ Making decisions
○ Running control logic
● Converts raw sensor data into useful information.
3. Communication Block
● Enables the IoT device to:
○ Send data to cloud/server
○ Receive control commands
● Uses communication technologies like:
○ Wi-Fi
○ Ethernet
○ Bluetooth
○ Cellular
● Acts as the link between device and internet.
4. Storage / Memory Block (optional but common)
● Stores:
○ Program code
○ Temporary sensor data
● Includes RAM and flash memory.
5. Power Supply Block
● Provides power to the device.
● Can be:
○ Battery
○ Power adapter
○ Energy harvesting source
Example: Raspberry Pi as an IoT Device
● Raspberry Pi is a single-board computer (SBC) commonly used for IoT.
● It includes:
○ CPU – performs computation
○ GPU – handles graphics
○ Memory (RAM) – for processing
○ Storage interface – SD card
○ Connectivity – USB, Ethernet
○ Interfaces – UART, SPI, I2C, CAN
● Used because it is:
○ Low cost
○ Easily available
○ Well documented
2. Explain Raspberry Pi architecture with its features and specifications.
Raspberry Pi Architecture
The architecture of Raspberry Pi is based on a single-board computer (SBC) design where
all major components are integrated on one board.
Main Architectural Components:
● ARM-based Processor (CPU) – Performs all computations and control operations.
● GPU – Handles graphics and video output.
● RAM – Used for running programs and OS.
● Storage Interface – SD card used for OS and data storage.
● Connectivity Interfaces – USB, Ethernet, GPIO, HDMI.
● Peripheral Interfaces – UART, SPI, I2C, CSI, DSI.
Features and Specifications of Raspberry Pi
1. Processor and RAM
● Built on ARM architecture.
● Model B (Revision 2.0):
○ 700 MHz ARM1176JZF-S processor
○ 512 MB SDRAM
2. USB Ports
● Two USB 2.0 ports.
● Provide a combined current of 100 mA.
● Powered USB hub can be used for high-power devices.
3. Ethernet
● 10/100 Mbps Ethernet port for wired networking.
● Wireless connectivity can be added using a USB Wi-Fi adapter.
4. HDMI Output
● Provides high-quality video and audio output.
● Can be connected to monitors or TVs.
● Supports DVI displays using an adapter.
5. Composite Video Output
● Supports RCA composite video output.
● Useful for older TVs without HDMI support.
6. GPIO Pins
● General Purpose Input/Output pins.
● Used to interface external hardware such as:
○ Sensors
○ LEDs
○ Motors
● Essential for IoT applications.
7. DSI (Display Serial Interface)
● Used to connect a dedicated Raspberry Pi LCD touchscreen.
8. Camera Serial Interface (CSI)
● Supports Raspberry Pi Camera Module.
● Used for image and video capture.
9. Audio Output
● 3.5 mm audio jack for analog audio output.
● Compatible with headphones and speakers.
10. LED Indicators
● Status LEDs indicate:
○ Power supply
○ SD card activity
11. SD Card Slot
● No onboard storage.
● SD card required to boot the OS and store data.
● Minimum 8 GB SD card recommended.
12. Power Input
● Powered using a 5V micro-USB connector.
● Can be supplied using a mobile charger or power adapter.
[Link] various Raspberry Pi interfaces (GPIO, USB, HDMI, UART, I2C, SPI)
1. GPIO (General Purpose Input/Output)
● GPIO pins are used to connect external hardware such as LEDs, sensors, motors,
and relays.
● Each pin can be configured as input or output using software.
● GPIO supports digital signals and special functions like PWM, I2C, SPI, and UART.
● Widely used in IoT and embedded applications.
2. USB (Universal Serial Bus)
● USB ports allow connection of keyboard, mouse, USB storage, camera, Wi-Fi
adapters, etc.
● Raspberry Pi typically supports USB 2.0.
● USB ports can act as both host and power supply for peripherals.
● Enables easy plug-and-play functionality.
3. HDMI (High-Definition Multimedia Interface)
● HDMI provides high-quality digital video and audio output.
● Used to connect Raspberry Pi to monitors, TVs, or projectors.
● Supports HD video resolutions.
● Useful for graphical user interface (GUI) and multimedia applications.
4. UART (Universal Asynchronous Receiver Transmitter)
● UART is a serial communication interface.
● Used for communication between Raspberry Pi and external devices like GPS,
GSM modules, and microcontrollers.
● Uses two lines:
○ TX (Transmit)
○ RX (Receive)
● Commonly used for debugging and console access.
5. I2C (Inter-Integrated Circuit)
● I2C is a two-wire serial communication protocol.
● Uses:
○ SDA (Serial Data)
○ SCL (Serial Clock)
● Supports multiple slave devices using unique addresses.
● Used to connect sensors like temperature sensors, RTCs, and displays.
● Ideal for low-speed communication.
6. SPI (Serial Peripheral Interface)
● SPI is a high-speed synchronous communication protocol.
● Uses four main lines:
○ MOSI (Master Out Slave In)
○ MISO (Master In Slave Out)
○ SCLK (Clock)
○ CS (Chip Select)
● Faster than I2C.
● Used for ADC/DAC, displays, memory devices, etc.
4. Explain Linux operating system on Raspberry Pi.
Linux Operating System on Raspberry Pi
The Raspberry Pi is a small, low-cost single-board computer that runs Linux-based
operating systems. Linux on Raspberry Pi is widely used in education, programming, IoT
applications, and system prototyping. Using Linux helps users learn basic system
administration, networking, and scripting.
Linux Distributions Supported by Raspberry Pi
Raspberry Pi supports several Linux operating systems, including:
1. Raspbian (Raspberry Pi OS)
○ A Debian-based Linux optimized for Raspberry Pi
○ Recommended and most widely used OS
○ Provides desktop and command-line interface
2. Arch Linux
○ Lightweight and flexible Linux distribution
○ Allows users to customize the system as needed
3. Pidora
○ Fedora-based Linux optimized for Raspberry Pi
4. RaspBMC
○ Media-center distribution based on XBMC
5. OpenELEC
○ Fast and user-friendly media-center OS
6. RISC OS
○ Very fast and compact operating system
Raspbian Linux Environment
● Raspbian provides a graphical desktop, file explorer, terminal (console), and
web browser.
● It supports programming languages like Python, C, and Shell scripting.
● Users can interact with the Raspberry Pi using HDMI display, keyboard, and
mouse.
Raspberry Pi Configuration using raspi-config
● Raspberry Pi uses a configuration tool called raspi-config.
● It can be launched from the terminal using:
$ raspi-config
● Using this tool, users can:
○ Expand the root filesystem to use full SD card space
○ Change password
○ Set keyboard layout, locale, and time zone
○ Enable or disable SSH
○ Change boot options and memory split
● Expanding the root filesystem is recommended to utilize full SD card storage.
Remote Access using Linux
● Raspberry Pi can be accessed remotely using:
○ SSH (Secure Shell) for command-line access
○ VNC (Virtual Network Computing) for graphical desktop access
● This eliminates the need for a separate monitor, keyboard, and mouse.
Basic Linux Commands
Linux on Raspberry Pi supports common commands used for:
● File management
● System monitoring
● Networking
● Software installation
ls – Lists files and folders
pwd – Shows current directory path
cd <directory> – Changes directory
mkdir <name> – Creates a new directory
rmdir <name> – Deletes an empty directory
rm <file> – Deletes a file
rm -r <dir> – Deletes a directory with contents
cp <src> <dest> – Copies files
mv <src> <dest> – Moves or renames files
These commands are essential for managing IoT and embedded applications.
5. Explain IoT-based home automation system with architecture.
IoT-Based Home Automation System
An IoT-based home automation system allows users to monitor and control home
appliances remotely using the Internet. Devices such as lights, fans, and sensors are
connected to a controller (like Raspberry Pi) and can be controlled automatically or manually
through a web or mobile application.
Architecture of IoT-Based Home Automation System
The architecture consists of the following main components:
1. User Interface (Web / Mobile Application)
● Allows the user to turn appliances ON or OFF remotely.
● Sends user commands through the Internet.
● Supports manual mode and auto mode.
2. Cloud / Application Server
● Hosts RESTful web services (Mode service and State service).
● Stores data in databases:
○ Mode database – auto or manual
○ State database – appliance ON/OFF status
● Processes GET and PUT requests from users.
3. IoT Controller (Raspberry Pi)
● Acts as the central control unit.
● Runs a controller native service.
● Communicates with sensors, actuators, and the cloud server.
4. Sensors
● Example: LDR (Light Dependent Resistor).
● Measures environmental conditions like light intensity.
● Used in auto mode to decide appliance operation.
5. Actuators
● Example: Relay switch.
● Physically turns the appliance (light) ON or OFF based on controller commands.
Working of the System
Auto Mode:
● Sensor measures light level.
● If it becomes dark, the controller automatically switches ON the light.
● Status is updated in the database.
Manual Mode:
● User sends ON/OFF command via web application.
● Controller retrieves state from database.
● Light is switched ON or OFF accordingly.
6. Describe an IoT application in agriculture or smart cities .
IoT Application in Agriculture (Smart Agriculture)
Smart agriculture uses IoT technology to improve farming efficiency, reduce resource
usage, and increase crop yield. Sensors, controllers, and cloud platforms are used to
monitor field conditions and automate farming activities.
Architecture / Components
1. Sensors
● Soil moisture sensor – measures water content in soil
● Temperature and humidity sensors – monitor climate conditions
● Light sensor – measures sunlight intensity
2. IoT Controller
● Devices like Raspberry Pi or Arduino
● Collect data from sensors and send it to the cloud
3. Communication Network
● Uses Wi-Fi, cellular, or LoRa to transmit data to the server
4. Cloud Platform
● Stores sensor data
● Performs data analysis and generates alerts
5. User Interface
● Web or mobile application
● Farmers can monitor field conditions remotely
6. Actuators
● Water pumps, sprinklers, or fertilizer systems
● Controlled automatically or manually
Working
● Sensors continuously collect soil and weather data.
● Data is sent to the cloud through the IoT controller.
● Cloud analyzes the data and decides actions.
● If soil moisture is low, the irrigation system is turned ON automatically.
● Farmers can also manually control systems using a mobile app.
Advantages
● Efficient water usage
● Reduced manual labor
● Increased crop productivity
● Real-time monitoring
● Cost savings
Applications
● Smart irrigation systems
● Greenhouse monitoring
● Crop health monitoring
● Weather-based farming decisions
7. Explain the GPIO pins of Raspberry Pi device with neat diagram.
GPIO Pins of Raspberry Pi
GPIO (General Purpose Input/Output) pins are programmable pins on the Raspberry Pi
used to connect external hardware like sensors, LEDs, relays, motors, and displays. These
pins allow the Raspberry Pi to read input signals and send output signals.
Functions of GPIO Pins
1. Digital Input
● Reads signals from sensors or switches
● Example: Button press detection
2. Digital Output
● Sends signals to control devices
● Example: Turning ON/OFF an LED
3. Power Pins
● Provide power to external components
● Available as 3.3V, 5V, and Ground (GND)
4. Special Communication Pins
● UART – Serial communication
● I2C – Two-wire communication (SDA, SCL)
● SPI – High-speed communication (MOSI, MISO, SCLK, CE)
● PWM – Used for motor speed and brightness control
GPIO Pin Numbering
Raspberry Pi supports two numbering systems:
● Physical numbering – Based on pin position (1–40)
● BCM numbering – Based on Broadcom chip GPIO numbers (used in programming)
Important GPIO Features
● Operates at 3.3V logic level
● Not 5V tolerant (can damage Pi)
● Supports interrupts and PWM
● Fully programmable using Python and other languages
Applications of GPIO Pins
● Reading sensor data (temperature, motion, light)
● Controlling LEDs, motors, relays
● Home automation systems
● Robotics and IoT projects
8. Explain the Domain model and Information model for Home Intrusion detection IoT
system.
Home Intrusion Detection IoT System
The home intrusion detection system uses sensors such as PIR motion sensors and
door sensors to detect intrusions and generate alerts. Each room has a PIR sensor and
each door has a door sensor. The system periodically reads sensor data and updates the
system state.
1. Domain Model for Home Intrusion Detection System
The domain model describes what entities exist in the system and how they are
related.
Components of the Domain Model:
1. Physical Entities
○ Room – Physical space in the house
○ Door – Entry or exit point
2. Virtual Entities
○ Room Virtual Entity
■ Represents the digital version of a physical room
■ Linked to a PIR motion sensor
○ Door Virtual Entity
■ Represents the digital version of a physical door
■ Linked to a door sensor
3. Devices
○ A single-board computer (e.g., Raspberry Pi)
○ Connected to PIR sensors and door sensors
○ Reads sensor values at regular intervals
4. Services
○ Motion detection service (room)
○ Door state monitoring service
○ Alert generation service
Purpose of Domain Model:
● Maps real-world objects (rooms, doors) to digital representations
● Shows interaction between devices, sensors, and services
● Helps in identifying system components clearly
2. Information Model for Home Intrusion Detection
System
The information model defines data attributes and possible values for each virtual entity.
Room Virtual Entity:
● Attribute: motion
● Possible values:
○ yes – Motion detected
○ no – No motion detected
Door Virtual Entity:
● Attribute: state
● Possible values:
○ open – Door opened
○ closed – Door closed
Purpose of Information Model:
● Defines what data is stored
● Specifies allowed values
● Helps in designing databases and services