IoT NPTEL Notes - PDF
Document Details
Uploaded by WellIntentionedHeliotrope380
Tags
Summary
This document provides an introduction to the Internet of Things (IoT). It details the evolution of IoT, its fundamental components and architecture, and offers real-world examples. The document touches upon various aspects of IoT and its application across various industries like smart homes, manufacturing, transportation, and healthcare.
Full Transcript
NEMESIS IOT NPTEL Introduction to IoT The Internet of Things (IoT) is a network of physical objects embedded with sensors, software, and connectivity, enabling data collection and exchange. Unlike traditional digital devices, IoT connects physical objects like appliances, vehicles, and wearables, tr...
NEMESIS IOT NPTEL Introduction to IoT The Internet of Things (IoT) is a network of physical objects embedded with sensors, software, and connectivity, enabling data collection and exchange. Unlike traditional digital devices, IoT connects physical objects like appliances, vehicles, and wearables, transforming them into "smart" devices for autonomous interactions and automation. Evolutionary Phases Leading to IoT 1. Connectivity Phase: Early internet allowed human interactions through email and web services. 2. Network Economy Phase: Digitalized businesses and advanced e-commerce. 3. Immersive Experiences Phase: Enhanced user engagement through media and social platforms. 4. Internet of Things Phase: Focus on connecting physical objects to enable smarter interactions. How IoT Works 1. Collection: Devices gather data via sensors. 2. Communication: Data transmitted to cloud platforms using protocols like Zigbee, Bluetooth, or Wi-Fi. 3. Analysis: Data is processed for meaningful insights. 4. Action: Based on analysis, actions are taken (e.g., adjusting temperature, turning on lights). Applications of IoT 1. Smart Homes: Automation of lighting, HVAC, and security. 2. Manufacturing: Enhancing efficiency with smart sensors. 3. Transportation: Self-driving cars and traffic management. 4. Agriculture: Monitoring livestock health. 5. Healthcare: Wearable devices for health tracking. 6. Security: Smart locks and surveillance. 7. Industrial IoT (IIoT): Automation in industrial processes IoT Working Groups and Standards Various organizations and working groups are pivotal in developing IoT standards and promoting interoperability: IETF (Internet Engineering Task Force): Develops IoT protocols and standards. Open Connectivity Foundation (OCF): Focuses on device interoperability. IoT Security Foundation: Enhances IoT security measures. Industrial Internet Consortium (IIC): Promotes Industrial IoT adoption and standards. History of IoT 1945: Barcode invented by Norman Joseph Woodland. 1973: RFID technology developed and patented by Mario Cardo. 1990s: Kevin Ashton coins "Internet of Things" while implementing RFID at Procter & Gamble. 2004-Present: Expansion of IoT applications. Architecture of IoT 1. Sensing Layer: Devices, sensors, and RFID tags collect data. 2. Network Layer: Communication via Zigbee, Bluetooth, Wi-Fi, managing latency and security. 3. Application Support Layer: Provides data analytics, security, and machine learning. 4. Application Layer: User-facing apps process real-time data and connect physical and digital worlds. Building Blocks 1. Devices: Sensors and hardware for data collection. 2. Gateways: Facilitate communication between devices and networks. 3. Communication: Connectivity via Wi-Fi, Bluetooth, Zigbee. 4. Cloud: Data storage and processing infrastructure. Case Studies Mirai Botnet (2016): Used default credentials to launch large-scale DDoS attacks. Jeep Cherokee Hack (2015): Hackers remotely controlled vehicle functions. Medical Device Hacks: Compromised pacemakers highlighted vulnerabilities in healthcare IoT. Introduction to Sensors and Actuators In IoT, sensors detect physical quantities (e.g., temperature, humidity) and convert them into digital data for analysis, while actuators receive digital signals and trigger physical actions, such as adjusting systems or moving devices. Understanding Sensors Definition: Sensors measure physical quantities and convert them into digital signals. Types: o Active: Generate their own energy (e.g., radar sensors). o Passive: Require external power (e.g., light sensors). o Invasive: Embedded within objects (e.g., sensors in pipes). o Non-Invasive: Operate externally (e.g., optical sensors). Understanding Actuators Definition: Actuators convert control signals into physical actions. Types: o Linear: Produce straight-line motion. o Rotary: Generate rotational movement. o Mechanical: Used in devices like stepper motors and DC motors. o Electromagnetic: Found in solenoids and relays. Differences Between Sensors and Actuators Function: Sensors collect data (input); actuators perform actions (output). Signal Flow: Sensors convert physical phenomena into electrical signals; actuators convert signals into physical actions. Control Systems: Sensors monitor and provide feedback; actuators modify the environment or system state. Practical Example: Sensor to Actuator Workflow 1. Sensor: Measures temperature and sends data. 2. Control Center: Analyzes the data and decides to activate a sprinkler. 3. Actuator: Receives the command and activates the sprinkler, cooling the environment. Diagrammatic Representation Sensors: Temperature (LM35), IR, proximity. Actuators: Linear actuators (valves), rotary actuators (motors), solenoids (locks). Introduction to IoT Communication Protocols IoT communication protocols are vital for enabling devices to exchange data seamlessly. These protocols extend internet infrastructure to support low-power, resource-constrained devices, making various IoT applications functional and efficient. Understanding Communication Protocols A communication protocol defines the rules for data exchange between devices in a network, covering aspects like data format, timing, and error checking. In IoT, standardized protocols ensure interoperability, allowing diverse devices to communicate and function together. Why Existing Protocols Are Insufficient for IoT Traditional internet protocols were designed for powerful systems, making them inefficient for IoT, where devices have limited processing power and memory. Issues include: Large headers High energy consumption Inefficient communication in low-bandwidth environments Core Requirements for IoT Protocol Stack IoT protocols must meet these needs: Low Power Consumption: To extend device battery life. High Reliability: Ensure consistent communication. Internet Enabled: Seamless integration with internet systems. Open and Standardized: Enable interoperability Standardized IoT Protocol Stack The IoT protocol stack is tailored to meet the unique needs of IoT: Link Layer: IEEE 802.15.4 for low-power communication. Internet & Routing Layer: IPv6 for address space, RPL for efficient routing. Adaptation Layer: Compresses IPv6 packets for low-power networks. Transport Layer: Uses UDP for efficiency. Application Layer: CoAP for lightweight communication. Key Standardized IoT Protocols 1. SixLoWPAN (IPv6 over Low-Power Wireless Personal Area Networks) o Compresses IPv6 headers to fit IEEE 802.15.4. o Supports energy-efficient routing and mesh networking. o Challenges: Limited security and vulnerability to fragmentation attacks. 2. RPL (Routing Protocol for Low-Power and Lossy Networks) o Energy-efficient, adaptive routing for constrained networks. o Challenges: Vulnerable to routing attacks like black hole and selective forwarding. 3. CoAP (Constrained Application Protocol) o Web-like communication for low-power devices, operating over UDP. o Advantages: Lightweight headers, energy-efficient. o Challenges: Resource-intensive DTLS handshakes and limited key management. Protocol Comparisons SixLoWPAN vs. Conventional Protocols: SixLoWPAN supports low-power, low- bandwidth networks, unlike Ethernet/Wi-Fi, which are too resource-heavy. RPL vs. Traditional Routing: RPL optimizes routing for low-power networks, while traditional protocols (like RIP) are resource-intensive. CoAP vs. HTTP: CoAP is more efficient for IoT with small headers and UDP, whereas HTTP is resource-heavy. Introduction to Arduino Arduino is an open-source platform designed for building interactive electronic projects. It consists of hardware (a microcontroller) and software (Arduino IDE), allowing users to control sensors, actuators, and other devices. Its low cost, ease of use, and versatility make it ideal for hobbyists, educators, and professionals alike. Key Features of Arduino: Open-Source: Both hardware and software are freely available, fostering community development. Low-Cost: Affordable, making it accessible for all levels of users. Ease of Use: The Arduino IDE and simplified programming language make it beginner-friendly. Versatility: Supports a wide range of sensors, actuators, and communication modules. Understanding Microcontrollers A microcontroller is the core of Arduino, responsible for executing instructions and processing data. It includes: CPU: Handles processing tasks. Memory: RAM for temporary data storage and Flash/EEPROM for storing programs. Peripherals: Interfaces like GPIO pins, ADCs (Analog-to-Digital Converters), and communication modules (SPI, I²C, UART). In Arduino, the microcontroller acts as the brain, interacting with sensors and actuators to perform tasks. Types of Arduino Boards Arduino offers various boards for different needs: 1. Arduino Uno: Based on the ATmega328P microcontroller, ideal for beginners and prototyping. 2. Arduino Nano: Smaller and breadboard-friendly, based on the ATmega328P, suitable for compact projects. 3. Arduino Leonardo: Features the ATmega32U4, great for human interface devices like keyboards. 4. Arduino Micro: A compact version of the Leonardo, suitable for USB applications. 5. Arduino Zero: Based on the ATSAMD21G18 (ARM Cortex-M0+), for high- performance tasks like advanced IoT. Key Features of Arduino Boards Modular Design: Stackable with shields for expanded functionality (e.g., motor control, wireless communication). Programming Environment: Uses the Arduino IDE with C/C++ for easy programming. Connectivity Options: SPI, I²C, and UART for device communication. Power Supply: Powered via USB, external adapters, or batteries. I/O Pins: Digital, analog, and PWM pins for versatile input/output tasks. Detailed View: Arduino Uno The Arduino Uno is the most popular and versatile board. Key specifications include: Microcontroller: ATmega328P Digital I/O Pins: 14 (6 PWM pins) Analog Pins: 6 Memory: 32 KB Flash, 2 KB SRAM, 1 KB EEPROM Clock Speed: 16 MHz Voltage: 5V, 7-12V input Built-in LED: Pin 13 for testing/debugging Pin Diagram of Arduino Uno Digital Pins (0-13): For general I/O operations. Analog Pins (A0-A5): For reading analog sensors. Power Pins: 5V, 3.3V, GND, VIN. USB Port: For programming and power. SPI Pins (10-13): For high-speed communication. I²C Pins (A4 & A5): For multi-master, multi-slave communication. Introduction to Arduino IDE The Arduino Integrated Development Environment (IDE) is an open-source platform designed for writing, compiling, and uploading code to Arduino boards. It serves as the interface between the user and the Arduino hardware, facilitating experimentation with sensors, actuators, and various IoT applications. Purpose: To allow users to program Arduino boards, experiment with sensors, and develop interactive projects. Compatibility: Available for Windows, macOS, and Linux operating systems. Programming Languages: Primarily supports C and C++ for coding. Terminology: Sketch: The term used for Arduino programs. Features of Arduino IDE 1. User Interface: o Menu Bar: Provides options for File, Edit, Sketch, Tools, and Help. o Toolbar: Contains buttons for verifying, uploading, creating, opening, and saving sketches. o Text Editor: The main area for writing and editing code, with setup() and loop() functions. o Status Bar: Displays the compilation and upload status, along with any error messages. o Serial Monitor: Allows you to view real-time data from sensors and debug information from the board. 2. Key Functions: o Verify: Compiles the code and checks for errors. o Upload: Compiles and uploads the code to the Arduino board. o New/Open/Save: Used for managing sketch files. o Serial Monitor: Displays sensor outputs or debug information in real-time. Understanding the Sketch Structure 1. setup() Function: o Runs once when the Arduino board is powered on or reset. o Used to initialize settings, such as defining pin modes and setting up serial communication. 2. loop() Function: o Runs continuously after setup() finishes. o Contains the main logic of the program, allowing repetitive tasks such as reading sensor data and controlling actuators. Managing Libraries in Arduino IDE 1. Library Manager: o Accessed via Sketch > Include Library > Manage Libraries. o Allows you to search for, install, and update libraries for various sensors and modules. 2. Adding Libraries: o Built-in Libraries: Pre-installed libraries available within the IDE. o Custom Libraries: ▪ ZIP Method: Download library files as ZIPs from sources like GitHub and install them via Sketch > Include Library > Add.ZIP Library. Selecting Boards and Ports 1. Board Selection: o Navigate to Tools > Board to select the specific Arduino board you're using (e.g., Arduino Uno, Nano, Leonardo). 2. Port Selection: o Navigate to Tools > Port to select the communication port the Arduino is connected to, ensuring proper communication between the IDE and the board. Concise Notes on Interfacing LCD via I2C Module and MQ7 Sensor with Arduino 1. Interfacing LCD via I2C Module with Arduino Objective: Simplify LCD connections using an I2C module to reduce the number of pins required. Components Needed: Arduino board (e.g., Arduino Uno) I2C module 16x2 LCD display Potentiometer (for contrast control) Jumper wires, breadboard Understanding Components: LCD Display (16x2): o Pins: VCC, GND, VO (contrast), RS, RW, E, D4-D7 (data), LED+ (backlight). I2C Module: o Pins: VCC, GND, SDA (data), SCL (clock). o Function: Allows the LCD to communicate with Arduino using only 4 pins (GND, VCC, SDA, SCL). Wiring Connections: I2C Module to Arduino: o GND → GND, VCC → 5V, SDA → A4 (Uno), SCL → A5 (Uno). LCD to I2C Module: o VCC → VCC, GND → GND, SDA → SDA, SCL → SCL. Adjust Contrast: Use the potentiometer on the I2C module to set the LCD contrast. Code: Libraries: Wire and LiquidCrystal_I2C (Install via Sketch > Include Library > Manage Libraries). I2C Address: Use an I2C Scanner sketch to find the address (e.g., 0x27). Interfacing MQ7 Sensor with Arduino Objective: Measure CO levels using the MQ7 sensor and display readings on Serial Monitor and LCD. Components Needed: Arduino board (e.g., Arduino Uno) MQ7 gas sensor I2C module and 16x2 LCD (optional) Jumper wires, breadboard Understanding the MQ7 Sensor: Pins: o VCC: 5V o GND: Ground o AOUT: Analog output (CO concentration) o DOUT: Digital output (threshold-based) Functionality: o AOUT: Analog data proportional to CO concentration. o DOUT: Digital signal based on a predefined threshold. Interfacing Techniques: I2C LCD: o Saves pins (only 4 pins used). o Simplifies wiring, especially for multiple devices. o Easily expandable (add more I2C devices). MQ7 Sensor: o Measures CO levels in various environments. o Dual outputs (analog and digital) for flexibility. o Real-time monitoring with Serial Monitor and/or LCD. Interfacing DHT11 Sensor with Arduino Objective: Measure temperature and humidity and display the readings on the Serial Monitor and an LCD (via I2C). Wiring: o DHT11 connected to digital pin 7 on the Arduino. o I2C LCD for displaying data. Steps: 1. Code for Reading Data: ▪ Use the DHT library to read temperature and humidity from the DHT11 sensor. ▪ Print values on the Serial Monitor for debugging. ▪ Display readings on the I2C LCD. DHT11 Sensor Pinout VCC: Powers the sensor (5V). GND: Grounds the sensor (connected to Arduino GND). DATA: Sends temperature and humidity data to the Arduino (connected to Arduino pin 7). NC: Not connected in most cases. Water Level Sensor Pinout VCC: Powers the sensor (5V). GND: Grounds the sensor (connected to Arduino GND). AOUT: Sends analog water level data to Arduino (connected to pin A0 for analog reading). Interfacing Water Level Sensor with Arduino Objective: Monitor water levels and activate a buzzer when the water level surpasses a set threshold. Wiring: o Water Level Sensor connected to analog pin A0. o Buzzer connected to a digital pin (e.g., pin 9). Steps: 1. Code for Reading Sensor Data: ▪ Use analogRead() to get the water level data from the sensor connected to A0. ▪ Display the water level on the Serial Monitor. ▪ Trigger a buzzer when the water level exceeds a set threshold (e.g., 600).. Interfacing Soil Moisture Sensor with Arduino Objective: Measure soil moisture and display readings. Components: Arduino board, Soil Moisture Sensor, LED, Buzzer (optional), Resistor, Jumper wires, Breadboard. Sensor Pins: Sensor+ ↔ Sensor- (on the reader module) Reader Module Pins: o VCC → 5V, GND → GND o A0 → Analog Pin A0 on Arduino o D0 → Optional digital output Wiring: Connect LED and Buzzer to Arduino pins (LED to pin 2, Buzzer to pin 10). Code: Read analog values (soil moisture) using analogRead(). Control LED/Buzzer based on moisture level (Threshold at 300 for dry soil). Interfacing Flame Detector with Arduino Objective: Detect flames and alert using LED/Buzzer. Components: Arduino board, Flame Detector Sensor, LED/Buzzer, Potentiometer (for sensitivity), Resistor, Jumper wires. Sensor Pins: VCC → 5V, GND → GND A0 → Analog Pin A0 on Arduino D0 → Digital Pin 4 (for flame detection) Wiring: LED to pin 2, Buzzer to pin 10. Code: Use digitalRead() to check flame state. Alert when flame is detected (HIGH signal). 3. Interfacing Sound Sensor with Arduino Objective: Detect sound levels and control LED. Components: Arduino board, Sound Sensor, LED, Resistor, Potentiometer (for sensitivity), Jumper wires. Sensor Pins: VCC → 5V, GND → GND A0 → Analog Pin A0 on Arduino D0 → Digital Pin 3 (for sound threshold detection) Wiring: LED to pin 2. Code: Use digitalRead() to detect sound. Control LED based on sound levels. Interfacing IR Sensor with Servo Motor and Arduino Objective: Detect obstacles using an IR sensor to control a servo motor and LED. Components Needed: o Arduino Uno, Servo Motor, IR Sensor Module, LED, Resistor, Jumper Wires, Breadboard Wiring: o Servo Motor: Digital Pin 3 o IR Sensor: Digital Pin 5 o LED: Digital Pin 2 Code Logic: o Read the IR sensor to detect obstacles. o Control the servo motor and LED based on the obstacle state. o Example behavior: If an obstacle is detected (IR state LOW), the LED lights up and the servo moves to 90°. If no obstacle, the LED turns off, and the servo returns to 0°. Applications: Parking management, security systems, automation projects. 2. Interfacing ESP8266 Module with Arduino Uno and Sending Data to ThingSpeak Objective: Connect the ESP8266 Wi-Fi module to Arduino Uno to send sensor data (e.g., DHT11 for temperature and humidity) to ThingSpeak. Components Needed: o Arduino Uno, ESP8266 Module, DHT11 Sensor, Jumper Wires, Breadboard Wiring: o ESP8266: Connect to 3.3V, GND, and use level shifting for RX/TX communication. o DHT11: Digital Pin 7 on Arduino. Setup: o Install ESP8266 board and libraries (SoftwareSerial, DHT sensor, ThingSpeak). Code Logic: o Read sensor data from DHT11. o Send data to ThingSpeak using the ESP8266 module. o Use AT commands for configuring the ESP8266 and for sending HTTP requests to ThingSpeak. Applications: Environmental monitoring, smart home systems, IoT projects. Comprehensive Notes on Indoor Air Pollution Management Using Arduino and Multiple Sensors 1. Introduction to the Case Study Objective: Develop an Indoor Air Pollution Management system by interfacing multiple sensors with an Arduino Uno to monitor environmental parameters and send data online for real-time monitoring. Key Components: Arduino Uno: Central microcontroller for data processing and sensor integration. DHT11 Sensor: Measures temperature and humidity. ESP8266 Module: Provides Wi-Fi connectivity to send data to the internet. CCS811 Sensor: Detects Volatile Organic Compounds (VOCs) and Carbon Dioxide (CO₂) levels. SDS011 Sensor: Measures particulate matter (PM10 and PM2.5) in the air. Multi-Gas Sensor (Groove Misk 6814): Detects multiple gases; utilized for measuring Carbon Monoxide (CO) and Nitrogen Dioxide (NO₂) in this project. LED: Visual indicator for system status or alerts. Breadboard and Jumper Wires: Facilitates connections between components. Customized Connection Chip: Provides common VCC and GND connections for multiple sensors. 2. Required Libraries To make the project easier to implement, we will use several libraries: DHT Sensor Library: For DHT11 sensor to read temperature and humidity. Adafruit CCS811 Library: To interact with the CCS811 VOC and CO₂ sensor. SoftwareSerial: To create additional serial ports for communication with sensors like the SDS011 and ESP8266. ThingSpeak Library: To send data to the ThingSpeak platform for online monitoring. Wire Library: For I²C communication, especially for CCS811. Servo Library: To control a servo motor. Integrating multiple sensors with Arduino Uno and utilizing the ESP8266 module for Wi-Fi connectivity provides a robust foundation for developing comprehensive IoT solutions. This Indoor Air Pollution Management system demonstrates how diverse environmental parameters can be monitored in real-time and accessed remotely, offering valuable insights and enabling proactive measures for maintaining healthy living spaces. Key Takeaways: Comprehensive Monitoring: Combining multiple sensors allows for a holistic view of indoor air quality. Real-Time Data Transmission: ESP8266 enables seamless data sharing to online platforms like ThingSpeak. Scalable Architecture: The modular design supports future expansions and integrations with additional sensors or systems. Practical Applications: Useful in smart homes, environmental research, and health monitoring systems. Indoor air quality (IAQ) is essential for health, as poor IAQ is linked to respiratory and cardiovascular diseases and contributes to around 7 million deaths annually. Given that people spend about 90% of their time indoors, maintaining good IAQ is crucial for preventing illnesses and improving productivity and overall well-being. Historically, concerns about air quality date back to ancient times. Figures like Hippocrates and Pliny the Elder recognized the health risks associated with poor air, especially in mining environments. In the 19th century, industrial advances led to the development of ventilation standards, with pioneers like Florence Nightingale advocating for good air exchange in hospitals to prevent infections. Common indoor air pollutants include biological contaminants like dust mites, mold, and pet dander, as well as emissions from combustion appliances (gas stoves, wood stoves), building materials, and tobacco smoke. Radon, a naturally occurring radioactive gas, can also accumulate in buildings, especially in basements. Poor ventilation and the use of high- emission fuels further exacerbate IAQ issues. The World Health Organization (WHO) recommends cleaner technologies, such as solar or biogas for cooking and heating, to reduce harmful emissions. WHO also emphasizes proper ventilation and the elimination of high-emission fuels, like kerosene and unprocessed coal, in indoor environments. Poor IAQ can lead to both short-term effects like headaches, fatigue, and respiratory infections, and long-term health issues such as asthma, heart disease, and cancer. People exposed to solid fuels or kerosene in poorly ventilated spaces face particular health risks. In conclusion, improving IAQ requires a combination of source control, better ventilation, moisture management, and air cleaning technologies. By understanding the sources and impacts of indoor pollutants, individuals and communities can take steps to enhance health and well-being. Arduino-Based Greenhouse Monitoring System: A Comprehensive Guide 1. Introduction o Objective: Build an Arduino-based system to monitor greenhouse conditions by interfacing multiple sensors, enabling real-time data collection and automation of irrigation, ventilation, and other systems. o Significance: The system optimizes plant growth, prevents diseases, and conserves resources by automating responses based on sensor data. 2. Components Required o Microcontroller: Arduino Uno (central controller). o Connectivity: ESP8266 Wi-Fi module for remote monitoring. o Sensors: ▪ DHT11: Measures temperature and humidity. ▪ MQ135: Detects CO₂ and VOCs. ▪ SDS011: Measures particulate matter (PM10 and PM2.5). ▪ Soil Moisture Sensor: Monitors soil moisture. ▪ Water Level Sensor: Tracks water reservoir levels. ▪ LDR: Measures light levels. ▪ IR Motion Sensor: Detects motion. o Actuators: ▪ LEDs: Display status alerts. ▪ Buzzer: Alerts for specific conditions (e.g., low water levels). ▪ LCD: Displays real-time data. ▪ Relay (optional): For controlling larger systems like pumps or fans. Hardware Connections Sensors and actuators are connected to Arduino Uno via a breadboard, using wires for power (VCC) and ground (GND). Use digital and analog pins to read sensor data and control actuators. Software Implementation Libraries: Import necessary libraries for sensor interfacing and communication (e.g., DHT.h, LiquidCrystal_I2C.h). Pin Definitions: Assign specific pins for each component to prevent conflicts. Sensor Readings: Continuously read data from sensors and process it. Actuator Control: Use sensor data to activate LEDs, buzzers, or other systems based on thresholds. Display: Show real-time data on the LCD and Serial Monitor. Key Takeaways: Real-time Monitoring: Continuous data collection for informed decision-making. Automation: Reduced manual intervention, optimizing resources. Scalability: The system is flexible for future enhancements. Data-Driven Decisions: Access to detailed data helps improve agricultural practices.