Presentation 1
Presentation 1
COMMUNICATION
ESP32 WIFI
COMMUNICATION
ROUTE
R
• Connects local networks to other local
networks or the Internet.
• Connects devices to the network wirelessly,
using radio frequencies.
•No need of physical router or internet connection
• ‘digitalRead(button)==LOW’-
Checks if button is pressed.
• If pressed, commands will be sent
using ‘send_commands()’
function (user defined).
This function
‘send_commands()’ sends
the command to the
server.
• ‘WiFiClient’- creates a
TCP connection.
• ‘client.connect(host,htt
pPort)’- Attempts to
connect to the server.
This part of the code
constructs and sends an
HTTP GET request to the
server, then waits for a
response.
This part of the code reads
the server's response to
the HTTP request and
prints it to the Serial
Monitor
SERVE
R
CODE
CODE
Code to set up an ESP32 as a web server to control an LED via WiFi
Declaration of variables:
• “WiFi.h”- library for handling WiFi functions on the ESP32.
• “Commands_Reply”- Variable to hold the response message sent back to the
client.
• “WiFiServer server(80)”- Initializes a web server on port 80, which is the default
port for HTTP communication.
This part of the code initializes the necessary settings for the ESP32 to function as a
web server and control an LED.
• “server.begin()”- Starts
the web server on port
80.
• “WiFi.localIP()”- returns
the local IP address
assigned to the ESP32.
This part handles client
connection to the web server
and processes their requests.
• “server.available()”- checks
if there is a client
connected to the server.
“client.readStringUntil(‘\r’)”-
Reads the client's request line
until a carriage return
character (‘\r’) is encountered
This part of the code handles a specific command from the client to make
the LED blink.
• “if(req.indexOf(“LED_Blink”)!=-1)”- checks if the received request
‘req’ contains the substring "LED_Blink“.
• If the request is “LED_Blink”, the LED is made to blink 3 times.
• When the server receives a request containing "LED_On", it
turns the LED on, responds to the client with "LED Status : On",
and prints the status to the serial monitor.
• When the server receives a request containing "LED_Off", it
turns the LED off, responds to the client with "LED Status : Off",
and prints the status to the serial monitor.
• If the request does not
contain "LED_Blink",
"LED_On", or "LED_Off",
it is considered invalid.
• “client.stop()”- stops
the connection with the
client.
• “client.flush()”- This
ensures that any
remaining data in the
client’s output buffer is
sent and then cleared.
What is Esp Now?
Peer-to-Peer
Communication
Encryption
Ease of
use
Data Transmission
Operability
HOW DOES IT
WORK?
Setup and Initialize
• Wi-Fi Mode Configuration
ESP-NOW requires WiFi module to be initialized even though it doesn’t
rely on it.
Device is set to station mode for the same (‘WIFI_STA’)
• Registering Callbacks
Callbacks, which are functions that handle events when data is sent or
received, are registered for sending and receiving data
Peer-to-Peer Communication
• MAC Address
Each ESP device has a unique MAC address that can
be obtained using ‘WiFi.macAddress()’ which is used to
identify peers
• Adding Peers
To communicate, devices are to be added as peers by means of their MAC
address and encryption keys
Message Transmission
• Sending data
• Receiving data
Incoming data is handled by the registered callback function
Security
• Send callback
Checks if the message was successfully sent
ADVANTAGES
Low Latency
Cost Effective
Network Management:
• Complexity increases with number of devices
Interference:
NICATION
MS
CLOUD
COMMUNICATION
PLATFORMS
Introduction:
Cloud communication platforms are revolutionizing how
devices and services connect and share data. These
powerful tools enable seamless integration between
microcontrollers, sensors, and online services, unlocking
a world of innovative applications and smart solutions.
How Cloud
Communication platform
works:
How Cloud
Communication platform
works: 1 Data Transmission
Data Ingestion
and processing 2
3 Data Storage
Security and
management 4
Popular platforms:
Exploring User-Friendly and Enterprise-Grade Options
Adafruit IO
Overview:
A cloud service designed to simplify data logging,
visualization, and interaction with IoT devices.
Features:
• Easy to use dashboards for visualizing data.
• Integrates seamlessly with Adafruit hardware.
• Supports MQTT and REST APIs for data communication.
• Includes triggers for automated actions.
BLYNK
Overview:
A platform designed to build mobile and web
applications for the Internet of Things..
Features:
• Drag-and-drop interface for creating custom dashboards.
• Supports a wide range of hardware platforms.
• Provides ready-to-use widgets for various functionalities.
• Real-time data monitoring and control.
THING SPEAK
Overview:
An IoT analytics platform service that allows to visualize,
and analyze live data streams in the cloud , it offers
fundamental features and its configurations can be a bit
difficult.
Features:
• Data storage and visualization in real-time.
• MATLAB integration for advanced data analysis.
• Supports HTTP and MQTT protocols.
• Ability to create public/private channels for data.
AWS IOT CORE
Overview:
A managed cloud service that lets connected devices
easily and securely interact with cloud applications
and other devices.
Features:
• Highly scalable and secure infrastructure.
• Integration with other AWS services (e.g., Lambda, S3).
• Supports Web Sockets and other protocols like http.
• Advanced device management and analytics.
Connecting Microcontrollers to Cloud
Platforms
1 Hardware Setup
Connect your microcontroller to the internet using Ethernet, Wi-
Fi, or cellular connectivity.
2 API Integration
Integrate your microcontroller's code with the cloud platform's
API to enable data exchange.
3 Real-time Monitoring
Leverage the cloud platform's dashboard to visualize sensor data
and control your device remotely.
Merits of using cloud
communication :
1 Remote Monitoring
3 Device Scalability
Security 4
IOT Solution: Simulator
Speed Bump alert system
Problem statement:
High-speed travel can miss speed breakers,
causing accidents.
Solution: Feed
Ultrasonic sensors detect speed breakers and alert
drivers, storing location in the cloud.
Code with API key integration
Model of the detector
Feed created in Adafruit API key:
MQTT Protocol:
Overview:
MQTT (Message Queuing Telemetry
Transport) is a lightweight messaging
protocol designed for small sensors and
mobile devices, optimized for high-latency
or unreliable networks.