0% found this document useful (0 votes)
2 views9 pages

Module 5

description

Uploaded by

anybodycanbe173
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views9 pages

Module 5

description

Uploaded by

anybodycanbe173
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

IoT Ecosystem & Connectivity


Communication Patterns
 Point-to-Point
o This is direct communication between two devices, just like
one phone calling another phone.
o It is simple and fast but only works for two devices at a time.
 Point-to-Multipoint
o One sender communicates with many receivers, like a group
voice call.
o Useful when you need to broadcast the same data to many
devices.
 Circle Pattern
o Messages move in a loop from one device to the next; each
device only talks to its neighbours.
o If one device fails, the chain may break.
 Chain Pattern
o Devices are linked in a straight line, but the leader cannot
check if the last device got the message correctly.
o This creates reliability issues because errors cannot be easily
detected.
 Y Pattern
o A branching structure where all communication goes through
a central leader (like a hub).
o Good for organizing data but depends heavily on the leader.
 Wheel Pattern
o A central leader connects directly to every member, making it
the fastest and most efficient structure.
o Reduces delays because everyone talks to the leader directly.

IoT Gateway
 Definition
o An IoT gateway is a bridge that connects small sensor
networks to the Internet. It can be a device or software.
o It acts like a translator between low-power devices and cloud
systems.

 Why It Is Required
o IoT sensors use low-power protocols such as ZigBee or BLE to
save battery, and the gateway converts these into Internet-
friendly protocols like WiFi or cellular.
o Without a gateway, small IoT sensors cannot communicate
with cloud servers.
 Key Functions
o Protocol Translation: Converts formats like ZigBee to MQTT.
 Extra: Ensures devices using different technologies can
communicate.
o Data Filtering: The gateway handles some processing
locally.
 Extra: This reduces unnecessary data sent to the cloud.
o Security Management: Protects the network and manages
connected devices.
 Extra: Prevents unauthorized access and keeps devices
updated.

2. Standard Internet Protocols


Wireless Standards
 Wi-Fi (IEEE 802.11)
o Provides high-speed internet using radio waves. Easy to set up
but uses a lot of power.
o Best for devices with constant power supply like smart TVs or
laptops.
 Bluetooth (IEEE 802.15.1)
o Works for short-distance communication and forms small
networks called "piconets" with 1 master and up to 7 slave
devices.
o Common in wireless headphones and keyboards.
 BLE (Bluetooth Low Energy)
o Designed for low-power devices, uses a star topology, and
cannot communicate with classic Bluetooth.
o Used in fitness bands and IoT trackers because it saves
battery.

 ZigBee (IEEE 802.15.4)


o Low-power and low-cost mesh network used for sensors;
includes End Devices, Routers, and Coordinators.
o Mesh structure allows long-distance communication through
multiple hops.
 6LoWPAN
o Allows tiny devices to send IPv6 packets efficiently using
header compression.
o Useful when connecting many small sensors directly to the
Internet.
 LoRa (Long Range)
o A low-power protocol used to connect devices over long
distances using spread-spectrum modulation.
o Often used in smart cities and agriculture.
 NFC (Near Field Communication)
o Very short-range technology that works without pairing;
devices act as reader or tag.
o Used in contactless payments like Google Pay and Metro
cards.

3. Networking: Socket Interface


Sockets Concept
 Definition
o Sockets allow two programs on different devices to send and
receive data over a network.
o They are like virtual communication ports in networking.
 Python Implementation
o On SBCs like Raspberry Pi, the socket library handles network
communication.
o Python makes socket programming easier for IoT developers.

Socket Types
 Stream Sockets (TCP)
o They create a reliable connection and ensure data arrives in
order.
o Used in banking, websites, and file downloads.
 Datagram Sockets (UDP)
o They do not require a connection and are faster but may lose
data.
o Used in live video streaming and gaming.

Key Socket Functions


 socket()
o Creates a new socket.
o Think of it as opening a new communication port.
 bind()
o Assigns an IP address and port to a socket.
o Required by servers to listen on a specific port.
 listen()
o Tells the server to wait for client connections.
o The server enters “listening mode.”
 accept()
o Accepts a connection from a client.
o Creates a new socket for communication with that client.
 connect()
o The client uses this to contact a server.
o Like dialling a phone number.
 send() / recv()
o Used to send and receive data.
o These form the actual communication between devices.
4. MQTT Networking
Definition
 MQTT is a lightweight messaging protocol based on publish–
subscribe, ideal for slow networks or low-power devices.
 Perfect for IoT because it reduces network usage.

Architecture
 Broker
o Acts as the main server managing all messages.
o Without a broker, MQTT cannot work.
 Publisher
o A device that sends data to the broker.
o Sensors like temperature or humidity nodes are publishers.
 Subscriber
o A device that receives data from the broker.
o A mobile app that shows sensor readings is a subscriber.
 Topics
o Labels like "home/kitchen/temp" that organize data.
o Subscribers only get data for topics they choose.

Quality of Service (QoS)


 QoS 0 – At Most Once
o No delivery guarantee: message might be lost.
o Used for non-important updates.
 QoS 1 – At Least Once
o Message is delivered but may be sent more than once.
o Requires acknowledgment (ACK).
 QoS 2 – Exactly Once
o Guarantees a message arrives only once using a 4-step
handshake.
o Used for highly critical data.
5. COAP Networking
Definition
 COAP is a lightweight version of HTTP designed for IoT and machine-
to-machine communication.
 Uses less data than normal HTTP.
 Runs on UDP and supports asynchronous messages.
 This makes it faster and better for small devices.

Message Types
 Confirmable (CON)
o Needs an ACK from the receiver.
o Ensures delivery.
 Non-confirmable (NON)
o No ACK is required; used for repeating sensor data.
o Saves time and bandwidth.
 Reset (RST)
o Sent when a message cannot be processed.
o Helps handle errors clearly.

Key Features
 Resource Discovery
o Devices can list their available services using
"/.well-known/core".
o Helps new devices understand what a node can do.
 Observation
o Allows clients to get automatic updates when a resource
changes.
o Works like a “subscribe” system for state changes.

6. Cloud Public APIs and SDKs


Concept
 SBCs use APIs to communicate with cloud platforms like AWS,
Google Cloud, or ThingSpeak.
 APIs simplify sending sensor data to the cloud.

SDKs
 SDKs provide ready-made code functions to avoid writing protocols
manually.
 Makes development faster and error-free.

Common Protocols
 REST API
o Uses simple HTTP methods like GET and POST to send data.
o Easy but consumes more bandwidth.
 WebSocket
o Provides two-way communication over one connection.
o Used for real-time dashboards.

7. Social Network APIs


Concept
 IoT devices send alerts via platforms people already use, like Twitter
or Telegram.
 Makes IoT systems user-friendly.

Mechanism
 The SBC authenticates using OAuth and posts messages using REST
API.
 Secure login ensures no unauthorized posting.

Examples
 Twitter API
o A weather station can tweet temperature updates.
o Useful for public information systems.
 Twilio API
o Used for sending SMS or WhatsApp alerts, such as intrusion
alerts.
o Works well for security systems.
 Implementation
o Uses Python libraries like “tweepy” and API keys to send
updates.
o You just call functions like api.update_status().

8. Interfacing Sensors and Actuators & Pi Camera


Servo APIs
Interfacing Sensors
 GPIO, I2C, and SPI
o SBCs connect sensors using GPIO pins or communication buses.

o Extra: Each protocol fits different types of sensors.

 Data Conversion
o Python libraries read sensor bytes and convert them into real-world
values like temperature.
o Extra: Raw data is usually in hex and needs conversion.

Pi Camera API
 CSI Port
o Raspberry Pi uses a special port called CSI for connecting the
camera.
o Extra: Gives better performance than USB cameras.
 picamera Library
o camera.start_preview() shows the camera output.
o [Link]("[Link]") takes a picture.
o camera.start_recording("video.h264") records video.
o Extra: Very efficient for IoT surveillance.

Servo Motor API


 Hardware
o Servos work using PWM; the pulse duration decides the angle.
o Extra: Shorter pulses = smaller angles; longer = bigger
angles.
 Python Control
o Libraries like [Link] or gpiozero set the frequency (e.g.,
50Hz) and duty cycle to control angle.
o Extra: Perfect for camera movement and small robots.

You might also like