Introduction to IoT: Architectural Overview
The Internet of Things (IoT) is a system of interconnected devices that communicate over the internet or
private networks to collect, analyze, and act upon data. It enables automation, smart decision-making, and
seamless device-to-device communication.
IoT Architecture
IoT architecture consists of multiple layers, each serving a crucial function:
1. Perception Layer (Sensing Layer)
o
Consists of sensors and actuators that collect real-world data.
o
Sensors detect parameters like temperature, pressure, humidity, motion, gas leaks, GPS
location, etc.
o
Actuators convert electrical signals into physical actions (e.g., opening valves, turning on
lights).
2. Network Layer
o
Responsible for transmitting collected data from perception layer to the cloud or edge
servers.
o
Communication can be wired (Ethernet, Modbus) or wireless (Wi-Fi, Zigbee, Bluetooth,
LoRaWAN, 5G).
o
Uses protocols like MQTT, CoAP, HTTP, AMQP for efficient data exchange.
3. Edge/Fog Computing Layer
o
Processes data close to the source, reducing latency and bandwidth usage.
o
Essential for real-time applications like autonomous vehicles, industrial automation, and
healthcare monitoring.
o
Reduces the load on cloud servers by performing computations locally.
4. Cloud Layer (Data Management & Analytics)
o
Stores, processes, and analyzes IoT data at scale.
o
Provides AI-driven insights, predictive analytics, and business intelligence.
o
Examples: AWS IoT Core, Microsoft Azure IoT, Google Cloud IoT.
5. Application Layer
o
The user interface that allows interaction with IoT devices.
o
Examples: Mobile apps, web dashboards, smart assistants.
o
Used in smart homes, healthcare monitoring, industrial control systems.
Design Principles and Needed Capabilities
Designing an IoT system requires several key principles:
1. Scalability
o
The system should be able to support millions of devices without performance degradation.
2. Interoperability
o
Devices and platforms from different manufacturers should be compatible and work
seamlessly together.
3. Security and Privacy
o
IoT systems are vulnerable to cyber threats like data breaches, unauthorized access, and
malware.
o
Security measures include data encryption, multi-factor authentication, intrusion
detection systems.
4. Low Power Consumption
o
Many IoT devices run on batteries; therefore, energy efficiency is critical.
o
Low-power wireless technologies like Zigbee, LoRaWAN, and NB-IoT are used.
5. Reliability
o
Ensuring minimal latency, downtime, and transmission errors is essential for real-time
applications.
IoT Applications
IoT is transforming multiple industries, including:
1. Smart Homes
o
Voice-controlled assistants (e.g., Amazon Alexa, Google Assistant).
o
Smart thermostats, lighting, security systems.
o
Energy efficiency optimization.
2. Healthcare (IoT in Medicine - IoMT)
o
Wearable devices for heart rate, blood pressure, glucose monitoring.
o
Smart pills with ingestible sensors for real-time tracking.
o
Remote patient monitoring for elderly care.
3. Industrial IoT (IIoT)
o
Predictive maintenance of machinery using sensors.
o
Smart factories with robotic automation.
o
Asset tracking and fleet management.
4. Smart Cities
o
Intelligent traffic control to reduce congestion.
o
Smart waste management with IoT-enabled bins.
o
Pollution monitoring and air quality analysis.
5. Agriculture & Farming
o
Smart irrigation systems that optimize water usage.
o
Soil health monitoring and weather prediction.
o
Livestock tracking using GPS-enabled wearables.
6. Retail & Supply Chain
o
Automated inventory tracking using RFID tags.
o
Smart checkout systems without cashiers.
o
Personalized shopping experiences based on AI-driven analytics.
Sensing and Actuation
Sensors in IoT
Temperature Sensors – Measure environmental temperature (used in HVAC, cold storage).
Humidity Sensors – Detect moisture levels (used in greenhouses, weather stations).
Motion Sensors (PIR, IR) – Detect human movement (used in security cameras, automated
lighting).
Gas Sensors – Detect harmful gases like CO, CO₂, and methane (used in industrial safety).
GPS Sensors – Used for real-time location tracking.
Actuators in IoT
Convert electrical signals into physical actions.
Examples: Servo motors, stepper motors, solenoids, relays.
Used in automated door locks, robotic arms, valve controls.
Networking in IoT
Types of IoT Networks
1. Wired Networks – Ethernet, Modbus, CAN Bus.
2. Wireless Networks – Wi-Fi, Zigbee, Bluetooth, LoRaWAN, NB-IoT.
3. Cellular Networks – 4G, 5G, LPWAN technologies like NB-IoT, LTE-M.
IoT Communication Protocols
MQTT (Message Queuing Telemetry Transport) – Lightweight, ideal for low-bandwidth
applications.
CoAP (Constrained Application Protocol) – Used in resource-constrained IoT devices.
AMQP (Advanced Message Queuing Protocol) – Secure and reliable message delivery.
M2M and IoT Technology Fundamentals
Machine-to-Machine (M2M) Communication
Direct communication between machines without human intervention.
Examples: Automated toll collection, smart meters, industrial automation.
IoT vs. M2M
M2M is device-to-device communication without cloud or analytics.
IoT includes cloud storage, data analytics, AI-driven insights, and automation.
Data Management in IoT
Stages of Data Processing
1. Data Collection – From sensors via gateways.
2. Data Storage – Cloud databases (AWS, Azure, Google Cloud).
3. Data Analysis – AI-driven insights, pattern detection.
4. Data Visualization – Dashboards for real-time monitoring.
Business Processes in IoT
IoT automates business processes in multiple industries:
Predictive maintenance – Reducing downtime in manufacturing.
Smart logistics – Real-time tracking of shipments.
Retail analytics – Personalized marketing strategies.
Everything as a Service (XaaS)
IoT enables cloud-based services like:
Infrastructure as a Service (IaaS) – Cloud storage, computing power.
Platform as a Service (PaaS) – IoT development platforms (AWS IoT, Google IoT Core).
Software as a Service (SaaS) – Smart home automation apps.
Role of Cloud in IoT
The cloud provides:
Scalability – Handles vast amounts of IoT data.
Remote Access – Users can monitor devices globally.
AI & Machine Learning – Smart insights for automation.
Security – Data encryption, multi-layer authentication.
Security Aspects in IoT
IoT security challenges include:
Data Breaches – Sensitive information leakage.
Unauthorized Access – Hackers gaining control over devices.
Firmware Vulnerabilities – Outdated software exploited by attackers.
Solutions
Strong authentication (2FA, digital certificates).
End-to-end encryption (TLS, AES-256).
Regular software updates for patching vulnerabilities.
Elements of IoT
IoT (Internet of Things) systems are built using hardware components, software components, and
communication protocols to enable devices to collect, process, and exchange data efficiently.
1. Hardware Components
IoT hardware consists of computing devices, sensors, actuators, and communication modules that form
the foundation of IoT applications.
1.1 Computing Devices (Microcontrollers & Microprocessors)
Computing devices process data, execute commands, and control IoT devices. Two popular computing
platforms in IoT are:
(a) Arduino (Microcontroller-based)
Microcontroller board based on ATmega328/ATmega2560.
Open-source platform with GPIO pins for sensors, actuators, and communication.
Programs written in C/C++ (Arduino IDE).
Best for small-scale embedded applications like smart homes and wearables.
Variants: Arduino Uno, Arduino Mega, Arduino Nano.
(b) Raspberry Pi (Microprocessor-based)
A single-board computer (SBC) with an ARM-based processor, RAM, USB, HDMI, Wi-Fi,
Bluetooth.
Runs Linux-based OS (Raspberry Pi OS, Ubuntu, IoT Core).
Supports programming in Python, C, Node.js.
Best for edge computing, IoT gateways, AI-based applications.
Variants: Raspberry Pi 4, Raspberry Pi Zero.
1.2 Communication Components
IoT devices communicate using wireless or wired interfaces.
Wi-Fi (802.11) – High-speed data transfer for smart homes, IoT hubs.
Bluetooth (BLE - Low Energy) – Used in wearables, smart locks, fitness trackers.
ZigBee – Low-power mesh networking (used in smart lighting, home automation).
LoRaWAN – Long-range communication (used in agriculture, industrial IoT).
Ethernet (Wired) – Reliable for industrial IoT applications.
1.3 Sensing Components
Sensors detect environmental changes and send data to processing units.
Sensor Type
Function
Example Applications
Temperature Sensors
Measures temperature
Smart thermostats, weather monitoring
Humidity Sensors
Detects moisture levels
Greenhouses, food storage
Motion Sensors (PIR, IR)
Detects movement
Security systems, automatic lighting
Gas Sensors (MQ-2, MQ-135) Detects harmful gases
Air quality monitoring, fire alarms
GPS Modules
Tracks location
Fleet management, navigation
Pressure Sensors
Measures air/water pressure Industrial automation, weather stations
1.4 Actuation Components
Actuators convert electrical signals into physical actions.
Actuator Type Function
DC Motors
Example Applications
Converts electrical energy into motion Automated robots, conveyor belts
Servo Motors Precise angular movement
Robotic arms, CNC machines
Solenoids
Electromagnetic switching
Electric door locks, valve control
Relays
Controls high-power devices
Smart switches, industrial automation
1.5 I/O Interfaces
IoT devices interact with sensors and actuators through input/output (I/O) interfaces.
GPIO (General-Purpose Input/Output) – Connects sensors and actuators.
SPI (Serial Peripheral Interface) – Used for high-speed communication between components.
I2C (Inter-Integrated Circuit) – Allows multiple sensors to communicate with a single board.
UART (Universal Asynchronous Receiver/Transmitter) – Used for serial communication.
2. Software Components
IoT software is responsible for data collection, processing, and communication between devices and
cloud platforms.
2.1 Programming Languages for IoT Development
Commonly used languages for IoT programming:
Language
Purpose
Example Usage
Python
High-level scripting
Data processing, AI/ML on Raspberry Pi
C/C++
Low-level programming
Embedded programming for Arduino
Node.js (JavaScript) Event-driven programming Cloud-based IoT applications
2.2 APIs for IoT Communication
APIs (Application Programming Interfaces) help IoT devices interact with cloud servers, databases, and
other IoT platforms.
Python APIs – Used for data collection, processing, and cloud communication (e.g., Flask,
FastAPI).
Node.js APIs – Used for real-time data streaming in IoT dashboards (e.g., Express.js,
WebSockets).
Arduino APIs – Used for controlling sensors and actuators (e.g., Arduino libraries for SPI, I2C,
Serial communication).
3. IoT Communication Protocols
IoT communication relies on various networking protocols for data transfer and device management.
3.1 MQTT (Message Queuing Telemetry Transport)
Lightweight publish-subscribe protocol used for IoT messaging.
Low bandwidth and ideal for low-power devices.
Example: Smart home automation, industrial IoT.
Uses topics and brokers (e.g., Mosquitto, HiveMQ).
3.2 ZigBee
Low-power, short-range mesh networking protocol.
Operates on IEEE 802.15.4 standard.
Example: Smart lighting systems, home automation (Philips Hue, Amazon Echo Plus).
3.3 Bluetooth (BLE - Bluetooth Low Energy)
Short-range, low-energy communication protocol.
Used in fitness trackers, smartwatches, wireless health monitors.
3.4 CoAP (Constrained Application Protocol)
Lightweight protocol for resource-constrained IoT devices.
Works on UDP instead of TCP, making it faster for small data exchanges.
Used in smart metering, industrial IoT, smart agriculture.
3.5 UDP (User Datagram Protocol)
Faster but less reliable than TCP.
Used in real-time streaming, sensor data transmission.
Common in weather stations, video surveillance systems.
3.6 TCP (Transmission Control Protocol)
Reliable and connection-oriented protocol.
Ensures data integrity but consumes more bandwidth.
Used in cloud-based IoT applications (smart grids, industrial monitoring).
Comparison of IoT Communication Protocols
Protocol
Transport
Layer
Best Used For
Advantages
Disadvantages
MQTT
TCP
Low-power devices, cloud
communication
Lightweight, efficient
Requires an MQTT
broker
ZigBee
IEEE 802.15.4 Smart home, industrial IoT
Low power, mesh
networking
Short range
Bluetooth
(BLE)
Wireless
(2.4GHz)
Wearables, healthcare
Low energy
consumption
Limited range
CoAP
UDP
Lightweight IoT applications
Fast, efficient
Less secure
UDP
Transport
Layer
Real-time data streaming
Fast transmission
No error checking
TCP
Transport
Layer
Cloud-based IoT apps
Reliable data transfer
More bandwidth
usage
IoT Application Development
Developing an IoT application requires a structured approach to integrate devices, acquire data, store it
securely, and ensure authentication & authorization. A well-defined solution framework ensures
efficient and scalable IoT applications.
Solution Framework for IoT Applications
An IoT solution framework consists of several key stages, including device integration, data acquisition,
storage, and security mechanisms.
1. Architecture Overview
A complete IoT solution follows a structured framework:
(a) Perception Layer (Device Layer)
Physical layer consisting of sensors, actuators, microcontrollers, IoT devices.
Devices sense environmental parameters and take actions (e.g., a temperature sensor monitoring
room temperature).
(b) Network Layer (Communication Layer)
Transfers data from devices to processing units using wired or wireless protocols.
Uses Wi-Fi, Bluetooth, ZigBee, LoRaWAN, MQTT, HTTP, CoAP, TCP/IP.
(c) Edge/Fog Computing Layer
Local processing near the device to reduce cloud dependency.
Uses Raspberry Pi, NVIDIA Jetson, Edge AI devices.
(d) Cloud Processing & Data Storage Layer
Data is stored in cloud platforms like AWS IoT Core, Google Cloud IoT, Microsoft Azure IoT.
Supports structured & unstructured databases.
(e) Application Layer (User Interface)
Users interact with the system via mobile apps, web dashboards, and APIs.
Uses Node.js, React, Angular, Flask, Django.
2. Implementation of IoT Application Development
Step 1: Device Integration
Device integration involves connecting sensors, actuators, and IoT devices to a computing unit (Arduino,
Raspberry Pi, ESP8266, ESP32).
(a) Hardware Components for Device Integration
Microcontrollers – Arduino, ESP8266, ESP32 for simple applications.
Single Board Computers (SBCs) – Raspberry Pi for AI-based IoT applications.
Sensors & Actuators – Collecting data and performing actions.
IoT Gateways – Intermediate devices for large-scale integration (e.g., Industrial IoT).
(b) Device Communication
Devices communicate using protocols:
Wi-Fi (MQTT, HTTP, WebSockets) – Smart home automation, cloud integration.
LoRaWAN (Long Range IoT) – Smart agriculture, environmental monitoring.
ZigBee (Mesh Network) – Home automation, industrial IoT.
(c) Example: Integrating a Temperature Sensor with Raspberry Pi
python
CopyEdit
import Adafruit_DHT
sensor = Adafruit_DHT.DHT11
pin = 4 # GPIO Pin where the sensor is connected
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
print(f"Temp: {temperature}°C Humidity: {humidity}%")
else:
print("Sensor failure. Check wiring.")
Step 2: Data Acquisition and Integration
Once the device is integrated, sensor data is collected, processed, and transmitted to a cloud/local
storage.
(a) Data Acquisition Process
Sensors collect real-time data (temperature, humidity, GPS, etc.).
Data is processed at the edge (using Raspberry Pi, ESP32, NVIDIA Jetson).
Data is transmitted to cloud servers via MQTT, HTTP, CoAP.
(b) Edge Processing vs Cloud Processing
Feature
Edge Processing
Cloud Processing
Latency
Low
Higher
Bandwidth
Saves bandwidth
Requires high bandwidth
Security
Higher (localized data) Lower (more exposed)
Processing Power Limited
High-performance computing
(c) Example: Sending Sensor Data via MQTT
python
CopyEdit
import paho.mqtt.client as mqtt
import time
import random
mqtt_broker = "broker.hivemq.com"
topic = "iot/sensor/temperature"
client = mqtt.Client("Temperature_Sensor")
client.connect(mqtt_broker)
while True:
temp = random.uniform(20.0, 30.0) # Simulating sensor data
client.publish(topic, f"Temperature: {temp:.2f}°C")
print(f"Data sent: {temp:.2f}°C")
time.sleep(5) # Sending data every 5 seconds
Step 3: Device Data Storage
Collected data must be stored securely for further analysis.
(a) Types of IoT Data Storage
Storage Type
Description
Examples
Local Storage Data stored in IoT gateways or edge devices Raspberry Pi, Industrial IoT Controllers
Cloud Storage Data stored on cloud for analytics
AWS IoT, Google Cloud IoT, Firebase
Hybrid Storage Edge computing with cloud backup
Azure IoT Edge, AWS Greengrass
(b) Structured vs Unstructured Data Storage
Structured Data (SQL databases) – Relational databases like MySQL, PostgreSQL, used for
organized storage.
Unstructured Data (NoSQL, Cloud Storage) – JSON, XML, used in cloud-based IoT platforms.
(c) Example: Storing IoT Data in Firebase (NoSQL)
python
CopyEdit
import firebase_admin
from firebase_admin import credentials, db
cred = credentials.Certificate("serviceAccountKey.json")
firebase_admin.initialize_app(cred, {'databaseURL': 'https://your-database.firebaseio.com/'})
ref = db.reference('iot/data')
ref.set({
'temperature': 25.5,
'humidity': 60
})
print("Data stored successfully!")
Step 4: Authentication & Authorization of Devices
Security is critical in IoT applications to prevent unauthorized access.
(a) Authentication in IoT
Username/Password – Basic authentication (not secure for large-scale IoT).
OAuth 2.0 & JWT Tokens – Secure API authentication for IoT services.
TLS/SSL Encryption – Used in MQTT, HTTPS, CoAP for secure communication.
(b) Authorization in IoT
Role-Based Access Control (RBAC) – Different levels of access for devices and users.
Device Identity Management – Unique IDs for each device to track interactions.
Blockchain-Based Security – Decentralized authentication to prevent hacking.
(c) Example: IoT Device Authentication using JWT Tokens
python
CopyEdit
import jwt
import datetime
secret_key = "your_secret_key"
payload = {
"device_id": "IoT_001",
"exp": datetime.datetime.utcnow() + datetime.timedelta(days=1)
}
token = jwt.encode(payload, secret_key, algorithm="HS256")
print(f"JWT Token: {token}")
IoT Case Studies & Mini Projects
Here are real-world IoT case studies and mini projects across different domains, including Industrial
Automation, Transportation, Agriculture, Healthcare, and Home Automation.
1. Industrial Automation – Smart Factory Monitoring System
Case Study: Siemens MindSphere (Industrial IoT Platform)
Problem:
Traditional factories face machine downtime, inefficient maintenance, and high energy
consumption.
Lack of real-time monitoring leads to delays in production.
Solution:
Siemens MindSphere connects industrial machines to an IoT cloud platform.
Sensors collect machine health data (temperature, vibration, load).
AI-based predictive maintenance helps reduce downtime.
Cloud dashboard provides real-time analytics to plant managers.
Impact:
20% reduction in machine failures.
15% increase in energy efficiency.
Faster decision-making based on real-time data.
Mini Project: Smart Factory Monitoring System
A Raspberry Pi-based system to monitor industrial machines using temperature and vibration sensors.
Components Needed:
Raspberry Pi or ESP32
DHT11 (Temperature Sensor)
Vibration Sensor (SW-420)
Cloud Database (Firebase / AWS IoT)
Python Code (Sending Data to Firebase)
python
CopyEdit
import firebase_admin
from firebase_admin import credentials, db
import random
import time
cred = credentials.Certificate("serviceAccountKey.json")
firebase_admin.initialize_app(cred, {'databaseURL': 'https://your-database.firebaseio.com/'})
sensor_ref = db.reference('factory/machine1')
while True:
temperature = random.uniform(30, 70) # Simulating machine temp
vibration = random.uniform(0, 5) # Simulating vibration levels
sensor_ref.set({'temperature': temperature, 'vibration': vibration})
print(f"Data Sent: Temp={temperature}°C, Vibration={vibration}")
time.sleep(5)
2. Transportation – Smart Traffic Management System
Case Study: Singapore’s Smart Traffic System
Problem:
Singapore faced heavy traffic congestion during peak hours.
Accidents and delays due to inefficient traffic control.
Solution:
IoT-based Smart Traffic Lights adjust timing based on real-time traffic conditions.
CCTV & AI-based vehicle tracking to manage congestion.
GPS & IoT sensors track public transport delays and suggest optimal routes.
Impact:
30% reduction in traffic congestion.
25% improvement in public transport efficiency.
Fewer accidents due to AI-driven predictions.
Mini Project: IoT-based Smart Traffic System
This project controls traffic lights dynamically based on the number of vehicles detected.
Components Needed:
Raspberry Pi
IR Sensors to detect vehicle count
LEDs for traffic lights
NodeMCU (ESP8266) for Wi-Fi communication
Python Code (Traffic Light Control)
python
CopyEdit
import RPi.GPIO as GPIO
import time
red_led = 17
green_led = 18
sensor_pin = 4
GPIO.setmode(GPIO.BCM)
GPIO.setup(red_led, GPIO.OUT)
GPIO.setup(green_led, GPIO.OUT)
GPIO.setup(sensor_pin, GPIO.IN)
while True:
vehicle_count = GPIO.input(sensor_pin)
if vehicle_count > 5:
GPIO.output(red_led, GPIO.HIGH)
GPIO.output(green_led, GPIO.LOW)
else:
GPIO.output(red_led, GPIO.LOW)
GPIO.output(green_led, GPIO.HIGH)
time.sleep(5)
3. Agriculture – Smart Irrigation System
Case Study: Precision Agriculture in India
Problem:
Farmers overuse water, leading to water wastage and low crop yield.
Lack of real-time soil moisture monitoring.
Solution:
IoT-based soil moisture sensors measure water levels.
Automated irrigation systems turn water pumps ON/OFF based on soil moisture.
AI-driven weather prediction helps farmers plan irrigation schedules.
Impact:
30% reduction in water usage.
Higher crop yields due to precise irrigation.
Automated control reduces farmer workload.
Mini Project: IoT-based Smart Irrigation System
A NodeMCU ESP8266-based smart irrigation system that automatically waters plants when soil moisture
is low.
Components Needed:
ESP8266 (NodeMCU)
Soil Moisture Sensor
Water Pump (5V DC)
Relay Module
Arduino Code (Smart Irrigation)
cpp
CopyEdit
#include <ESP8266WiFi.h>
int soilSensorPin = A0;
int pumpPin = D1;
void setup() {
Serial.begin(115200);
pinMode(pumpPin, OUTPUT);
}
void loop() {
int moisture = analogRead(soilSensorPin);
if (moisture < 400) { // Dry soil
digitalWrite(pumpPin, HIGH);
Serial.println("Pump ON");
} else {
digitalWrite(pumpPin, LOW);
Serial.println("Pump OFF");
}
delay(5000);
}
4. Healthcare – IoT-based Patient Monitoring System
Case Study: Remote Patient Monitoring in Hospitals
Problem:
Patients in critical condition require constant monitoring.
Manual checks can be delayed, leading to emergencies.
Solution:
Wearable IoT devices track heart rate, oxygen levels, and temperature.
Data sent to doctors in real time via cloud dashboards.
AI-based predictive alerts warn about sudden health risks.
Impact:
Faster emergency response times.
Remote patient monitoring reduces hospital workload.
Higher survival rates for high-risk patients.
Mini Project: IoT-based Heart Rate Monitor
A Pulse Sensor + ESP32 project that monitors heart rate and sends data to a cloud dashboard.
Components Needed:
ESP32 Wi-Fi Module
Pulse Sensor
ThingSpeak API (for data visualization)
Python Code (Sending Heart Rate Data to ThingSpeak)
python
CopyEdit
import requests
import random
import time
API_KEY = "YOUR_THINGSPEAK_API_KEY"
url = f"https://api.thingspeak.com/update?api_key={API_KEY}"
while True:
heart_rate = random.randint(60, 100) # Simulated heart rate
requests.get(url + f"&field1={heart_rate}")
print(f"Heart Rate: {heart_rate} BPM")
time.sleep(5)
5. Home Automation – Smart Home System
Case Study: Google Nest Smart Home System
Problem:
Homes waste energy due to manual lighting and inefficient heating.
Lack of remote control over home appliances.
Solution:
Smart thermostats adjust temperature based on user behavior.
AI-controlled smart lighting reduces energy consumption.
Voice-controlled assistants (Google Assistant, Alexa) for seamless automation.
Impact:
25% lower electricity bills.
Increased security with smart locks and surveillance.
Convenience with voice and mobile app control.
Mini Project: IoT-based Smart Home Automation
An ESP8266-based smart home project to control appliances via a mobile app.
Components Needed:
ESP8266 (NodeMCU)
Relay Module (for controlling appliances)
Blynk App (for remote control)
Arduino Code (Controlling a Light with a Mobile App)
cpp
CopyEdit
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "YOUR_BLYNK_AUTH_TOKEN";
char ssid[] = "WiFi-Network";
char pass[] = "WiFi-Password";
int lightPin = D2;
void setup() {
Blynk.begin(auth, ssid, pass);
pinMode(lightPin, OUTPUT);
}
void loop() {
Blynk.run();
}
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )