UNIT 2.pptx5tttttttttttttttttttttttttttttttttttttt
sriram37357
11 views
130 slides
Sep 14, 2025
Slide 1 of 130
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
About This Presentation
-
Size: 20.16 MB
Language: en
Added: Sep 14, 2025
Slides: 130 pages
Slide Content
UNIT 2 COMMUNICATION PROTOCOLS AND MODULES
Communication Protocol – Wi - Fi Wireless Fidelity FCC - 1985 to utilize a few bands of wireless spectrum without subjecting them to a license fee . IEEE 802 - set of standards for LAN and MAN IEEE 802.11 – Wireless mode Committee in 1990 with Nokia, Motorola and was headed by Victor Hayes ( Father of Wi-Fi) Wi-Fi in the year 1997 Wi-Fi standard uses the ISM (Industrial, Scientific and Medical) band of frequency which are free to use and require no licensing
Wi - Fi Launched in 2.4GHz with transmission rates of 1-2mbps Wi-Fi now works at 5GHz frequency, transmission rates reaching up to 54mbps Wi-Fi is based on OSI protocol and uses the physical layer and MAC sub-layer of the Data Link Layer .(Others – undefined) MAC layer handling basic transmission functions like channel access , frame handling , and collision avoidance .
Bluetooth Vs Wi Fi Feature Bluetooth Wi-Fi Standard IEEE 802.15.1 IEEE 802.11 (a/b/g/n/ac/ax/be) Range ~10 meters (Classic ) ~50–100 meters (indoors) Speed Up to 3 Mbps (Classic ) Up to 9.6 Gbps (Wi-Fi 6), 46 Gbps (Wi-Fi 7) Power Consumption Low Higher Primary Use Short-range device communication High-speed internet & LAN connectivity Network Type PAN (Personal Area Network) LAN (Local Area Network) Frequency Band 2.4 GHz 2.4 GHz, 5 GHz, 6 GHz Security AES Encryption, Pairing, Authentication WPA2/WPA3, Encryption, Firewalls Examples Wireless headphones, smartwatches, file transfer between phones Browsing, streaming, file downloads, IoT
Communication in Wi- Fi
Wi Fi – Physical Layer It handles modulation, encoding, synchronization, medium selection , and data rate control . Data exchange schemes adopted by physical layer in 802.11 : Frequency Hopping Spread Spectrum Technique and Direct Sequence Spread Spectrum Technique . Spread spectrum - increase reliability , reduce interference , and enhance security of wireless communication FHSS Steps in FHSS : Agree on hopping sequence – Sender and receiver use the same pseudorandom frequency list. Modulate data – Data is modulated on the current carrier frequency (FSK). Transmit data – Signal is sent on that frequency. Hop to next frequency – After a fixed time (dwell time), both hop to the next frequency. Repeat – Continue hopping and transmitting until all data is sent. Receiver stays synchronized – Receiver follows the same hopping pattern to decode data.
Steps in DSSS (Direct Sequence Spread Spectrum) Take input data bit . Multiply with chip code (e.g., 11-bit Barker code ). Modulate (BPSK) and transmit the spread signal . Receiver receives and correlates with same chip code . Original bit is recovered . DSSS is better for high-speed, stable environments . FHSS is better for dynamic, interference-prone, or secure environments . Complementary Code Keying (CCK ) More than 2 Mbps transmission speed – Modulation -> CCK It allows more bits per symbol (QPSK) by using complex spreading codes .
OFDM – Orthogonal Frequency Division Multiplexing High-speed modulation technique in Wi Fi OFDM splits a data stream into many parallel streams , each sent over a separate orthogonal subcarrier Steps Input data is divided into multiple low-rate parallel streams. Each stream is modulated (e.g., BPSK, QPSK, QAM). Modulated streams are transmitted simultaneously on closely spaced subcarriers. The subcarriers are mathematically orthogonal (i.e., no interference between them). At the receiver, the signal is demodulated to extract each stream.
Wi Fi – MAC Layer Ensures reliable data transmission MAC Protocol – CSMA / CA ( Carrier Sense Multiple Access with Collision Avoidance) CCA – Clear Channel Assessment level Network Allocation Vector (NAV ) IFS – Inter Frame Space
Architecture of IEEE 802.11 Wi Fi
Bluetooth
Bluetooth Protocol Stack
BLE - Bluetooth Low Energy 2012 - wireless connection for many of IoT’s most critical applications . consumer electronics, healthcare, and logistics . 97% of all Bluetooth technology-enabled devices incorporating BLE by 2027 targets markets where the demand is for ultra-low power rather than high throughput . A typical LE use case would include periodically turning on the radio, transferring or receiving a few bytes or kilobytes of data, and then turning off and going back to sleep . BLE – Example: a sensor in a temperature-controlled warehouse that you want to set and leave it for months or even years.
BLE Stack Architecture
Layers of peripheral and central devices
Controller T he link layer and the physical layer . physical layer responsible for the actual transmission and reception of the signal over the air. 2.4 GHz ISM band, Gaussian frequency shift keying (GFSK) modulation link layer responsible for scanning, advertising, creating, and maintaining links or connections between devices . The link layer also manages frequency selection for data transmission, utilizing frequency-hopping spread spectrum to mitigate interference . The link layer has different states: standby, advertising, scanning, initiating, and connected
BLE channels
Link layer state transitions
State Transitions 1. Standby Default state when the device is idle — not advertising, scanning, or connected.Example : Your BLE-enabled thermometer is powered on but not actively sending or receiving . 2. Advertising The device sends advertising packets on BLE channels.Goal : Let other devices know it’s available for connection.Example : A BLE smartwatch advertises its presence to nearby phones . 3. Scanning The device listens for advertising packets from advertisers.Example : Your smartphone scans for BLE devices in the area to connect to your fitness band . 4 . Initiating After scanning and selecting an advertiser, the scanner device becomes an initiator to start a connection request.Example : Once your phone detects the BLE smartwatch , it sends a connection request . 5 . Connection A bidirectional communication link is established between two devices (central and peripheral).Data exchange can now happen.Example : Your smartwatch and phone are now connected. Your heart rate data is being sent continuously.
Host Controller Interface
Host L2CAP Logical Link Control and Adaptation Protocol acts as an interface between the higher layer protocols and the lower layers. It is responsible for fragmentation and defragmentation of application data. SMP Security Manager Protocol defines the procedures for pairing, authentication, and encryption between BLE devices.
ATT - Attribute Protocol An attribute is the basic data unit used by the Attribute Protocol (ATT ) Example attributes in smart watch: Heart rate Battery level Step count Time ATT - defines the rules for accessing attributes or data on a device. It enables the discovery, reading, and writing of attributes on a remote device. follows a client-server model Field Example Description Handle 0x0025 Unique ID used to refer to this attribute Type (UUID) 0x2A37 UUID for Heart Rate Measurement characteristic Permissions `Read Notify` Value 0x48 Actual heart rate value (in hex, e.g., 0x48 = 72 bpm)
Different attribute PDU types PDU Type Direction Acknowledgment Example Request → Response Client → Server → Client ✅ Yes Reading heart rate Command Client → Server ❌ No Turning on BLE light Notification Server → Client ❌ No Step count updates Indication → Confirmation Server → Client → Server ✅ Yes Emergency alerts
GATT - Generic Attribute Profile GATT defines how data or attributes are formatted, packaged, and exchanged between connected devices. GATT procedures consist of attribute discovery, read, write, notification, and indication . It provides a standard framework for managing data in a BLE device . Example: Heart Rate Monitoring via GATT GATT handles what data is shared and how Term Explanation Server The device that holds the data (e.g., a smartwatch or sensor) Client The device that requests the data (e.g., a smartphone app) Service A collection of related data (attributes), e.g., Heart Rate Service Characteristic A piece of data with a value, e.g., current heart rate Descriptor Meta info about the characteristic, e.g., format or permissions
Example Scenario: A smartphone app (client) connects to a smartwatch (server) to read the current heart rate . Step-by-step GATT Process: Client connects to the server Client discovers services Finds the Heart Rate Service Client discovers characteristics within the service Finds Heart Rate Measurement Client enables notifications So it can receive live heart rate updates without polling Server pushes notifications Sends heart rate updates (e.g., 78 bpm) as they happen
A GATT profile structure.
GAP - Generic Access Profile . GAP defines how BLE devices access and communicate with each other . It encompasses modes of operation, generic procedures for device discovery, connection establishment, and security. It provides the standard framework for controlling a BLE device . GAP handles how devices find and connect GAP Role Function Peripheral Sends advertising packets , waits for a connection (e.g., smartwatch) Central Scans , initiates connection (e.g., smartphone) Broadcaster Sends advertisements, no connections (e.g., beacon) Observer Scans for ads, doesn't connect (e.g., BLE scanner app)
A broadcaster sends advertising packets to an observer.
Central/peripheral vs. broadcaster/observer.
Scenario: A smartphone connects to a smart watch to read heart rate data securely 1. GAP: Smartwatch advertises → Phone scans → Connection initiated 2. SMP: Secure pairing → Keys exchanged → Link encrypted 3. L2CAP: GATT messages segmented and sent reliably 4. ATT: Phone accesses data via handles (e.g., read battery level) 5. GATT: Services structured for Heart Rate, Battery, Steps 6. Data Link Layer: Manages BLE timing and retry mechanisms 7. PHY: Sends packets wirelessly using BLE modulation
Why Zigbee ?
ZigBee ZigBee is a Personal Area Network. It is a technology of home networking.
Star Topology
Tree Topology
Mesh Topology
ZigBee Devices: Zigbee Coordinator Device: It communicates with routers. This device is used for connecting the devices . Responsibilities: Initializes and maintains the Zigbee network Assigns network addresses Stores information about the network (security keys, routing tables) Zigbee Router: It is used for passing the data between devices. Zigbee End Device : It is the device that is going to be controlled . Cannot relay messages
General Characteristics of Zigbee Standard: Low Power Consumption. Low Data Rate (20- 250 kbps). Short-Range (75-100 meters). Network Join Time (~ 30 msec ). Cost effective Protocol 3 frequency bands with 27 channels. Can be scaled up to 65,000 devices.
Star Topology Consists of a coordinator and several end devices, end devices communicate only with the coordinator . Example: Amazon Echo with Zigbee Hub : Amazon Echo Plus / Echo 4th Gen ( Zigbee built-in) Devices : Zigbee smart plugs, bulbs, sensors
Mesh Topology Mesh topology consists of one coordinator, several routers, and end devices . Example:Large smart home automation system
Tree Topology In this topology, the network consists of a central node which is a coordinator, several routers, and end devices . The function of the router is to extend the network coverage. Example: Smart Agriculture Monitoring System
Architecture of Zigbee : 1. Physical Layer Function : Deals with radio transmission and reception over the air. 2. Medium Access Control (MAC) Layer Function : Controls how devices access the wireless medium; uses CSMA/CA. 3. Network Layer Function : Manages network formation, routing, and addressing. 4. Security Layer Function : Provides encryption, authentication, and secure key management. 5. Application Interface Layer Function : Acts as a bridge between the application and lower layers; contains binding tables and message handlers. 6. Application Layer Function : Contains the actual user application logic and profiles (e.g., lighting) Message handler - Receiving , interpreting, and responding to messages exchanged between Zigbee devices . Identify the message type (command, status, data).
ZIGBEE MODULE Zigbee in Smart Home Lighting Imagine you use a Zigbee -based motion sensor to turn on a Zigbee smart light : Motion detected → Trigger generated in the application layer. Interface Layer prepares message → Maps to correct device. Security Layer encrypts the message. Network Layer routes message via Zigbee mesh (if needed). MAC Layer ensures no collision → Sends data. Physical Layer transmits over air . The smart light receives this data, decrypts it, identifies the command, and turns ON the bulb.
Amazon Echo Plus
Smart Home
SAMSUNG SMART THINGS
Zigbee summary.. operates following the IEEE 802.15.4 standard and employs wireless mesh network technology low cost, low power consumption, and low data rate wireless connectivity . especially suited for smart home and industrial IoT applications.
Advantages of Mesh Topology in Zigbee Extended Range via Multi-Hop Self-Healing Network If one device (node) fails, Zigbee automatically re-routes traffic through another path . Scalability Efficient Power Usage (for End Devices ) No Need for Direct Line of Sight Why Zigbee Is Not Popular? No Native Support in Smartphones (BLE is built into almost all smartphones, tablets, and laptops .) Consumers face incompatibility issues
Advanced Message Queuing Protocol (AMQP) application layer protocol It is an open standard protocol used for sending and receiving messages between systems in a reliable, secure, and asynchronous way . AMQP helps two applications talk to each other by passing messages through a central system called a message broker , even if they are built in different languages or run at different times . Example: E-Commerce Order Processing System (e.g., Amazon, Flipkart )
E-Commerce Order Processing System Order Received Order service publishes a message like:{ " order_id ": 123, "item": "Phone", " qty ": 1 } It sends this to a message broker (e.g., RabbitMQ ) using AMQP . Message Queued The broker routes this message to: Inventory Queue Billing Queue Shipping Queue Other Services React Inventory service reads the message from its queue, checks stock, and updates inventory. Billing service reads the same message , processes payment. Shipping service schedules dispatch once payment is confirmed.
Advanced Message Queuing Model
Example Producer sends a message like this : Binding
Exchange types: 1.Direct Exchange 2. Fanout Exchange 3. Topic Exchange 4. Headers Exchange 3. A message is published to the exchange : Routing Key: sensor.livingroom.temp Message: {"value": 26.5, "unit": "C"} It matches : temperature_queue (sensor.*.temp ) livingroom_queue ( sensor.livingroom .*) all_sensor_queue (sensor .#) So all three queues get the message. 4. Header exchange { "headers": { "type": "pdf", "department": " hr " } } Queue Name Header Conditions (Match All) pdf_hr_queue {type: "pdf", department: " hr "} all_pdf_queue {type: "pdf"} hr_docs_queue {department: " hr "}
A smart farming company is deploying an IoT solution to monitor and manage multiple greenhouses. The system includes: Soil moisture sensors , temperature sensors , and irrigation controllers in each greenhouse Drones used for aerial monitoring of crop health Mobile devices used by farmers to receive alerts and control actuators BLE-enabled wristbands worn by field workers for real-time location and safety tracking A central Wi-Fi hub in each greenhouse for internet connectivity A cloud-based dashboard that uses AMQP to collect sensor data, issue commands, and trigger alerts Question: Analyze the agricultural setup and: Categorize the different IoT components based on the communication protocol used (Wi-Fi, BLE, Zigbee , Bluetooth) and justify the selection for each. Compare Zigbee and BLE in terms of scalability, energy efficiency, and range in the context of field-level deployments. Demonstrate how AMQP helps in reliable message delivery between greenhouses and the central cloud dashboard. Design a message routing strategy using AMQP exchanges where the system must: Trigger an irrigation alert if soil moisture is below threshold Send location updates of workers to a safety monitoring queue Broadcast weather warnings to all greenhouses
Message Queuing Telemetry Transport (MQTT) L ightweight publish/subscribe messaging protocol optimized for machine-to-machine (M2M) communication in IoT environments.
Example MQTT Brokers: Mosquitto , HiveMQ and AWS IoT Core.
Key Components of MQTT Architecture Publishers Publishers establish connections with the broker and send messages using MQTT protocol commands like CONNECT, PUBLISH and DISCONNECT . Subscribers Subscribers register subscriptions with the broker and receive messages using protocol commands like CONNECT, SUBSCRIBE and UNSUBSCRIBE . Broker Accepting incoming network connections using TCP/IP or WebSockets Authenticating clients and authorizing access Receiving published messages and dispatching them to subscribed clients Maintaining session information and subscriptions for connected clients Queueing messages offline until clients reconnect Communicating with other brokers to form a federated network
MQTT Messages MQTT Topics Example for topic: “home/kitchen/ candle_flame_detector ” Topics can use wildcards like # and + for broader subscriptions: home/kitchen /# – Receive all messages under kitchen +/ candle_flame_detector – Receive all flame detector messages Message Payloads actual data being transmitted in the MQTT message content ranging from a few bytes to kilobytes of data . Quality of Service ( QoS ) level when publishing messages: QoS 0 – No guarantee of delivery. Message sent only once(max). QoS 1 – Message delivered at least once. May receive duplicates. QoS 2 – Message delivered exactly once. Uses a 4 step handshake.
Benefits of Adopting MQTT for IoT Applications Lightweight Low Bandwidth Usage Reliable Message Delivery Scalability Flexibility Security Open Standard Integration with AI/ML MQTT is a natural fit to support emerging AI/ML technologies in the IoT space: MQTT streams high frequency data from IoT devices to feed AI models MQTT delivers inferences and directives from AI systems back to operational equipment During model training, MQTT efficiently transmits datasets from distributed sensors to the cloud Anomaly alerts are published based on real-time deviations detected by AI agents
CoAP client/server protocol and provides a one-to-one “request/report” interaction model
Z Wave Secure , low-power, mesh-based protocol designed specifically for reliable smart home automation , Proprietary and requires a gateway for internet access . Owned by Silicon labs
Z wave components Controllers Control of devices, Security Routers Continuous powered e.g., Light bulb Relays control signals to distant devices Slaves Battery powered Communication Flow Controller sends a command to a Z-Wave device (e.g., turn on light). If the device is in direct range , it responds directly. If not in range , the message hops through intermediate Z-Wave nodes (up to 4 hops). The device executes the command and may send a status update back . Device Inclusion (Pairing) Devices are added to the network via the controller. Each device gets a Node ID . Secure devices require secure inclusion using AES encryption
Benefits Security Local control Power consumption Reliability Limitations Proprietary protocol (controlled by Silicon Labs) Not compatible with IP networks without a gateway Region-specific frequencies (US devices won't work in EU)
Feature / Protocol Z-Wave CoAP MQTT AMQP BLE Bluetooth Wi-Fi Type Full-stack wireless Application protocol Application protocol Messaging protocol Wireless protocol Wireless protocol Wireless protocol OSI Layer Physical–App Layer 7 Layer 7 Layer 7 Layer 1–2 Layer 1–2 Layer 1–2 Frequency Band Sub-GHz (868/908) IP-based IP-based IP-based 2.4 GHz 2.4 GHz 2.4 / 5 GHz Network Type Mesh Request/response Publish / subscribe Message queuing Point-to-point, Mesh Point-to-point star Power Consumption Very low Low Low Medium Very low Medium High Range 30–100 m Depends on transport Depends on transport Depends on transport ~10–50 m ~10 m ~50 m indoors Interoperability Certified by Z-Wave Alliance Open standard Open standard Open standard Industry standard Industry standard Universal standard Use Case Smart home control Constrained IoT devices Sensor networks Enterprise messaging Health, wearables Audio, file transfer High-speed data, video Throughput ~100 kbps App-dependent App-dependent App-dependent 1 Mbps (BLE 4.x), 2 Mbps (BLE 5) ~2–3 Mbps 100+ Mbps Proprietary? ✅ Yes ❌ No ❌ No ❌ No ❌ No (standardized) ❌ No ❌ No
Which protocol is most suitable for real-time sensor updates in a smart factory — MQTT or AMQP? Why ? For a wearable fitness tracker, would you choose BLE or Wi-Fi? Why ? You are designing a battery-powered temperature sensor for home automation. Which is better: Zigbee or Wi-Fi? Why ? In a smart home lighting system, would Z-Wave or Zigbee be more suitable? Justify . For controlling IoT devices via a smartphone app over the internet, would you use CoAP or MQTT? Why ? In a smart irrigation system in a large farm, would Zigbee or Wi-Fi work better? Why ? For a home security camera system with HD video, should you use Wi-Fi or BLE? Why ? Would you choose Bluetooth Classic or BLE for wireless headphones? Justify . For a constrained device that sends periodic environmental data to a remote server, would you use CoAP or AMQP? Why?
LoRaWAN Low Power Wide Area Network (LPWAN) protocol star-of-stars topology LoRa Physical layer - LoRa modulation ideal for applications that transmit small chunks of data with low bit rates. provides long-distance communication between smart devices, gateways, and end-user. coverage range can be up to 15 km LoRaWAN Media Access Control (MAC) layer protocol built on top of LoRa modulation Manages how devices communicate in a network
Architecture
LoRaWAN Architecture in Smart Cities Sensor in bin detects fill level . Sends LoRa signal to multiple gateways . Gateways forward it to the network server . Network server processes, removes duplicates, and forwards data . Application server visualizes and triggers actions . Optionally , the server sends a downlink message (e.g., change sensor interval).
Near Field Communications wireless personal area network (PAN) technology connects two compatible devices in very close proximity of each other, in order to enable slow but reliable data transfer . Range: about 4 cm or less 13.56 MHz radio frequency Mode: Active communication mode target and initiator devices – have power source they can alternately generate a field through which they can communicate An active device deactivates its radio frequency (RF) field while waiting to receive data . Examples include transferring files between two NFC-compatible smartphone
Passive communication mode lacks power and has to draw its power from the electromagnetic field of the initiator device . For instance, a smartphone can be used as a keycard to access entry into office buildings. The electromagnetic field that is produced by the smartphone supplies the tag with the electricity it needs to function. It also enables the smartphone to read the data contained in the NFC tag, and if the user is allowed to access that office, the door automatically unlocks to allow them entry.
Hardware interfaces physical or logical connection point that allows different hardware components or systems to communicate, exchange data, or control signals . Interface Type Examples Used For Serial UART , USART , SPI, I²C Sensor communication, microcontrollers Parallel GPIO, old printer ports Controlling LEDs, motors Network Ethernet, Wi-Fi Internet or LAN connectivity Audio/Video HDMI, VGA, 3.5mm Jack Display and sound Storage SATA, USB Connecting hard drives, pen drives Power Barrel jack, USB, PoE Supplying power to devices
Serial Interface
SPI – Serial Peripheral Interface . It is a serial communication protocol that is used to connect low-speed devices . The main advantage of the SPI is to transfer the data without any interruption . In this protocol, devices are communicated in the master-slave relationship. The master device controls the slave device, and the slave device takes the instruction from the master device. The simplest configuration of the Serial Peripheral Interface (SPI) is a combination of a single slave and a single master. But, one master device can control multiple slave devices.
Pin out Configuration of SPI
MOSI: MOSI stands for Master Output Slave Input . It is used to send data from the master to the slave . MISO: MISO stands for Master Input Slave Output . It is used to send data from the slave to the master . SCK or SCLK (Serial Clock): to synchronize data transfer between devices. SS/CS (Slave Select / Chip Select): It is used by the master to send data by selecting a slave.
SPI is used at 4MHz speed which is faster than I2C interface. So SPI is used where output from any sensor is required at high speed in order to process that data and take action as early as possible . SPI allows only one master .
Arduino + Node MCU Application: Remote Temperature Monitoring NodeMCU (Master): Collects temperature data from Arduino and uploads it to a cloud service (like ThingSpeak ). Arduino Uno (Slave): Reads temperature from a DHT11 sensor and sends it to NodeMCU via SPI.
Disadvantages Usually, it supports only one master. It does not check the error like the UART. It uses more pins than the other protocol. It can be used only from a short distance. It does not give any acknowledgment that the data is received or not.
I2C Communication Protocol Inter-Integrated Circuit synchronous, multi-master, multi-slave, serial communication protocol SDA (Serial Data Line) – carries the data . SCL (Serial Clock Line) – generated by the master to synchronize the data transfer.
I2C Configuration How It Works: Master initiates communication by sending a start signal on the bus. It sends the address of the slave it wants to communicate with. Slave acknowledges and sends/receives data. Master ends communication with a stop condition .
Supports Multiple Masters and slaves
I2C Message format Part Description Start Initiated by the master; signals beginning of transmission (SDA ↓ while SCL ↑). Address 7 or 10-bit address of the slave device. R/W Bit 1 bit: 0 = Master Write , 1 = Master Read . ACK/NACK Acknowledge bit from the slave (ACK = 0, NACK = 1). Data Byte 8-bit data sent by master or slave. Repeated ACK Master sends ACK after each byte if more data is expected. Stop Master ends the communication (SDA ↑ while SCL ↑).
Feature SPI I2C Wires Needed 4 (MISO, MOSI, SCLK, SS) + 1 per slave 2 (SDA, SCL) Speed Very high (up to 50+ Mbps in some cases) Lower (100 kbps standard, 400 kbps fast, up to 3.4 Mbps high speed) Number of Devices Limited (each needs a separate SS line) Many (up to 127 devices with unique addresses) Data Transfer Full duplex (send and receive at same time) Half duplex Complexity Simple protocol; straightforward to implement Slightly complex (start/stop, ACK/NACK handling) Error Checking No built-in ACK/NACK ACK/NACK after every byte Distance Short (PCB-level, ~few cm) Slightly better (~20–30 cm, depending on speed) Use in Noisy Environment Not very robust More robust due to addressing and acknowledgment Cost More pins needed → higher PCB complexity Fewer pins → simpler design, cost-effective Slave Addressing Controlled by SS line Fixed addresses per device Typical Use Case High-speed, high-data-rate, low device count Low-speed, low-data-rate, high device count Examples SD card reader with Arduino, SPI OLED display MPU6050 sensor, DS3231 RTC module, EEPROM
UART - Universal Asynchronous Receiver/Transmitter It converts parallel data from the microcontroller into serial form for transmission, and vice versa for reception . In UART communication, the transmitter wire of the first device is connected with the receiver wire of the second device, and the transmitter wire of the second device is connected with the receiver wire of the first device.
UART ARCHITECTURE
UART Frame format
Best Feature Simple , low-cost , minimal wires (just Tx , Rx, GND ). Reliable over short distances . Asynchronous → no clock signal needed . Example: Bluetooth module HC 05
Sender Code: char mystr [12] = "Hello World!"; //String data void setup() { // Begin the Serial at 9600 Baud Serial.begin (9600); } void loop() { Serial.write (mystr,12); //Write the serial data delay(1000); }
Receiver Code char mystr [20]; //Initialized variable to store recieved data void setup() { // Begin the Serial at 9600 Baud Serial.begin (9600); } void loop() { Serial.readBytes (mystr,5); //Read the serial data and store in var Serial.println ( mystr ); //Print data on Serial Monitor delay(1000); }
USART - Universal Synchronous Asynchronous Receiver Transmitter Feature UART (Universal Asynchronous Receiver/Transmitter) USART (Universal Synchronous/Asynchronous Receiver/Transmitter) Mode of Communication Asynchronous only (no clock line) Synchronous and Asynchronous (supports both) Clock Signal Not used Used in synchronous mode (shared clock between devices) Data Transfer Speed Slower (limited by baud rate) Faster in synchronous mode Wiring Requires only TX , RX , and GND In synchronous mode, requires TX , RX , CLK , and GND Complexity Simpler hardware and software Slightly more complex (due to synchronous features) Usage Common in simple serial communication (e.g., Arduino, GPS) Used where higher speed or clock synchronization is needed
GSM (Global System for Mobile Communications) Digital mobile communication standard used for transmitting voice, SMS, and data over cellular networks . Used for 2G services like basic voice calls and SMS, especially in: Rural areas where 4G coverage is weak or absent. Feature phones (basic phones without full internet access). IoT devices like GPS trackers, and payment terminals that only need low-speed data via GPRS( General Packet Radio Service) /EDGE . BSNL-had launched 4G but continue offering 2G for users with basic voice needs and remote places. Private operators like Airtel – retained 2G for backup in areas with poor data coverage
Example – Voice call Power On & Registration Your phone searches for the nearest BTS with the strongest signal. Sends IMSI to the network. Network authenticates using AuC and stores location in VLR . Call Setup When you dial a number, the request goes from your phone → BTS → BSC → MSC. MSC checks if the receiver is in the same network or another one. Routing If in the same network, MSC connects directly. If in another network, routes via PSTN (Public Switched Telephone Network) or another MSC. Voice/Data Transmission GSM uses TDMA : The frequency is split into time slots. Each user gets a slot for sending and receiving data. Voice is digitized, compressed, encrypted, then transmitted. Handover If you move, BSC/MSC transfer your call to the next BTS without dropping the connection. Call Termination When you hang up, resources are released and billing data is recorded.
Case 1: Calling a Friend within Coimbatore Assumption: Both of you use the same operator (say Airtel). Connection to Local Tower (BTS): Your mobile connects to the nearest Airtel Base Transceiver Station (BTS) — one of the cell towers in Coimbatore. Forward to BSC: Signal goes to Airtel’s Base Station Controller (BSC) in Coimbatore (manages multiple BTSs). Routing via MSC: BSC sends it to Airtel’s Mobile Switching Center (MSC) — also in Coimbatore or a nearby major hub. HLR/VLR Lookup: MSC checks the VLR (Visitor Location Register) to find your friend’s current location (which BTS he’s connected to). Direct Local Connection: Since your friend is in Coimbatore, the MSC routes the call directly to his BTS through the BSC. Voice/Data Transfer: TDMA time slots are assigned, and the voice is digitized, encrypted, and transmitted both ways.
Case 2: Calling a Friend in Bangalore (Another State) Assumption: You’re on Airtel; your friend is also on Airtel. Connect to BTS: Your phone → nearest Airtel BTS in Coimbatore. To Local BSC: BTS sends to BSC in Coimbatore. To MSC (Tamil Nadu Circle): BSC forwards to Tamil Nadu MSC (could be in Coimbatore or Chennai). HLR Check: MSC queries HLR (likely in Airtel’s central data center , e.g., Chennai/Mumbai) to locate your friend. Finds that the friend is in Karnataka Circle (Bangalore). Inter-MSC Handover: Call is routed from Tamil Nadu MSC to Karnataka MSC over national telecom backbone ( fiber links or microwave backbone). To Bangalore BSC & BTS: Karnataka MSC sends call to BSC in Bangalore, then to your friend’s BTS. Voice Transmission: Voice travels back the same way, using dedicated time slots.
Scenario: how an IoT device on a farm in a rural village could send a temperature reading or control a motor from a basic mobile phone of a farmer (without internet/cloud).
1. Setup on the Farm IoT Hardware: Microcontroller ( Arduino /ESP32) Temperature sensor and motor relay GSM module with SIM card (e.g., SIM800L) 2. Sending SMS Data Measurement Microcontroller reads temperature or motor status. GSM Connection GSM module registers with the nearest 2G BTS (BSNL/Airtel tower in the village). Send SMS Command The microcontroller sends AT commands to GSM module: The GSM module sends the SMS through the operator’s MSC → SMSC (Short Message Service Center) . Delivery SMSC delivers the message to the farmer’s phone, even if it’s a basic feature phone. 3. Motor Control via SMS Farmer sends SMS like “MOTOR ON” to IoT device’s SIM number. IoT device receives SMS, parses it, and triggers relay to start motor.
RF Module SAW - Surface Acoustic Wave - generate a stable carrier frequency for modulation ASK Modulation Transmitter Receiver
DC voltage between 3.5V and 12V. the receiver specifically needs a 5V supply voltage
Setting up transmitter Transmitter Arduino VCC 5V Data 12 GND GND
Setting up receiver Receiver Arduino VCC 5V Data 11 GND GND
Radio Head Packet On the transmitter side, the library takes the data you want to send and packages it into a structured data packet, known as a RadioHead Packet. This packet includes a CRC checksum, along with a preamble and a header, to ensure smooth communication. Once the packet is properly structured, it is transmitted wirelessly to the receiving Arduino .
On receiver side On the receiver side, the RadioHead library continuously listens for incoming packets. When a packet is received, the library recalculates the CRC checksum to verify whether the data has arrived correctly. If the CRC check passes, the receiving Arduino is notified that new data is available for processing. However , if the CRC check fails, meaning the data was corrupted during transmission, the packet is automatically discarded to prevent corrupted data from being used.
Improving 433MHz RF module range with an antenna
Machine-to-Machine (M2M) Communication E nable devices and machines to communicate and exchange data without human intervention. Various standards and protocols facilitate M2M communication, such as MQTT (Message Queuing Telemetry Transport) , CoAP (Constrained Application Protocol) , LwM2M (Lightweight M2M) , HTTP (Hypertext Transfer Protocol ) , Zigbee , and Z-Wave.
Aspect IoT M2M Definition A broad concept where physical objects (“things”) are connected to the internet to collect, send, and act on data. A communication method where devices exchange information directly without human intervention. Scope Includes M2M, cloud computing, data analytics, mobile apps, AI, etc. Primarily focuses on direct device-to-device communication. Connectivity Often uses IP-based networks (Wi-Fi, 4G/5G, LoRaWAN, NB-IoT). Often uses non-IP or proprietary protocols (GSM, SMS, RF). Data Use Data is typically sent to the cloud for processing and remote monitoring. Data is often processed locally or sent to a dedicated server without full internet integration. Example A smart agriculture system where sensors send soil data to a cloud dashboard, and farmers check via an app. A vending machine automatically sending stock levels to a supplier’s system over GSM.
Elements of M2M System Things/Devices Connectivity Network Infrastructure Gateway Central Server Analytics and Other Apps User Interface