0% found this document useful (0 votes)
22 views12 pages

MTech IoT Lab

The Internet of Things (IoT) connects devices to the internet, allowing them to collect and share data. IoT systems use sensors and cloud connectivity to process data and perform actions, enhancing user interaction and automation. The document also discusses the ESP8266 Wi-Fi module, UART communication, and various experiments demonstrating IoT applications and communication methods.

Uploaded by

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

MTech IoT Lab

The Internet of Things (IoT) connects devices to the internet, allowing them to collect and share data. IoT systems use sensors and cloud connectivity to process data and perform actions, enhancing user interaction and automation. The document also discusses the ESP8266 Wi-Fi module, UART communication, and various experiments demonstrating IoT applications and communication methods.

Uploaded by

Youssef Akki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

The Internet of Things is the concept of connecting any device (so long as it has

an on/off switch) to the Internet and to other connected devices. The IoT is a
giant network of connected things and people – all of which collect and share
data about the way they are used and about the environment around them.
That includes an extraordinary number of objects of all shapes and sizes –
from smart microwaves, which automatically cook your food for the right length
of time, to self driving cars, whose complex sensors detect objects in their path,
to wearable fitness devices that measure your heart rate and the number of
steps you’ve taken that day, then use that information to suggest exercise plans
tailored to you. There are even connected footballs that can track how far and
fast they are thrown and record those statistics via an app for future training
purposes.

How does it Work?

An IoT system consists of sensors/devices which “talk” to the cloud through


some kind of connectivity. Once the data gets to the cloud, software processes
it and then might decide to perform an action, such as sending an alert or
automatically adjusting the sensors/devices without the need for the user.
But if the user input is needed or if the user simply wants to check in on the
system, a user interface allows them to do so. Any adjustments or actions that
the user makes are then sent in the opposite direction through the system: from
the user interface, to the cloud, and back to the sensors/devices to make some
kind of change.

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 2 sur 16
:
Why do we need to study IoT?

The powerful IoT platforms can pinpoint exactly what information is useful and
what can safely be ignored. This information can be used to detect patterns,
make recommendations, and detect possible problems before they occur.
According to latest research, the number of IoT devices globally is believed to
have reached 10 billion in 2018. Note that this is higher than the number of
mobile devices in use in the world. With 5G on the horizon and an uptick in IoT
adoption, companies’ plans to invest in IoT solutions seem to be accelerating.
The global IoT market is projected to nearly double in size between 2014 and
2017, passing the $1 trillion mark. By 2019, the global IoT market is forecast to
be valued at more than $1.7 trillion. Consumer electronics is the largest
component of the global IoT market.

Prerequisite for IoT Lab

Brief understanding of IoT and its potential


Arduino or Raspberry Pi or any other interactive electronic objects with
sensors
In this lab we will be working with ESP8266 board
Arduino IDE
Installation Guide: https://randomnerdtutorials.com/how-to-install-

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 3 sur 16
:
esp8266-board-arduino-ide/
Programming language C/C++
Enormous imagination and zeal to explore the horizons

ESP 8266 module

ESP8266 is a Wi-Fi module produced by Espressif. It can be used with most of


the development board and micro-controller like Arduino. It is a popular module
having a good price/performance ratio. ESP8266 contains a built-in 32-bit low-
power CPU, ROM and RAM. It is a complete and self-contained Wi-Fi network
solution that can carry software applications as a stand-alone device or
connected with a microcontroller (MCU). The module has built-in AT Command
firmware to be used with any MCU via COM port.

NodeMCU is an eLua based firmware for the ESP8266 WiFi SOC from
Espressif. The firmware is based on the Espressif NON-OS SDK and uses a file
system based on spiffs.

(Firmware is a software program or set of instructions programmed on a

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 4 sur 16
:
hardware device. It provides the necessary instructions for how the device
communicates with the other computer hardware.

Firmware is typically stored in the flash ROM of a hardware device. While ROM
is "read-only memory," flash ROM can be erased and rewritten because it is
actually a type of flash memory.)

SPIFFS : SPI Flash file Systems

SPI: Serial Peripheral Interface (SPI) is an interface bus commonly used to


send data between microcontrollers and small peripherals such as shift
registers, sensors, and SD cards. It uses separate clock and data lines, along
with a select line to choose the device you wish to talk to.

Interface: In computing, an interface is a shared boundary across which two or


more separate components of a computer system exchange information. The
exchange can be between software, computer hardware, peripheral devices,
humans, and combinations of these.[1] Some computer hardware devices, such
as a touchscreen, can both send and receive data through the interface, while
others such as a mouse or microphone may only provide an interface to send
data to a given system.

A peripheral or peripheral device is "an input or output device used to put


information into and get information out of the computer".

Baud Rate:

The baud rate specifies how fast data is sent over a serial line. It's usually
expressed in units of bits-per-second (bps). If you invert the baud rate, you can
find out just how long it takes to transmit a single bit. This value determines how
long the transmitter holds a serial line high/low or at what period the receiving
device samples its line.

Baud rates can be just about any value within reason. The only requirement is
that both devices operate at the same rate. One of the more common baud
rates, especially for simple stuff where speed isn't critical, is 9600 bps. Other

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 5 sur 16
:
"standard" baud are 1200, 2400, 4800, 19200, 38400, 57600, and 115200. The
higher a baud rate goes, the faster data is sent/received, but there are limits to
how fast data can be transferred. You usually won't see speeds exceeding
115200 - that's fast for most microcontrollers. Get too high, and you'll begin to
see errors on the receiving end, as clocks and sampling periods just can't keep
up.

Baud rates are like the languages of serial communication. If two devices aren't
speaking at the same speed, data can be either misinterpreted, or completely
missed. If all the receiving device sees on its receive line is garbage, check to
make sure the baud rates match up.

Experiment No 1: Transmit a String Using UART

What is UART?

UART stands for Universal Asynchronous Receiver/Transmitter. It’s not a


communication protocol like SPI and I2C, but a physical circuit in a
microcontroller, or a stand-alone IC. A UART’s main purpose is to transmit and
receive serial data.

In UART communication, two UARTs communicate directly with each other. The
transmitting UART converts parallel data from a controlling device like a CPU
into serial form, transmits it in serial to the receiving UART, which then converts
the serial data back into parallel data for the receiving device. Only two wires
are needed to transmit data between two UARTs. Data flows from the Tx pin of
the transmitting UART to the Rx pin of the receiving UART:

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 6 sur 16
:
In this experiment we will learn to transfer the data to controller (ESP 8266)
through UART communication i.e the entered data will be transferred from the
host and converted to HEX, DECIMAL and CHARACTER. We can see the
output in Serial Monitor at the specified COM port. The below source code will
also be able to control the Builtin LED through the input we provide for better
understanding of the experiment.

Source Code

1 /* SerialMonitor_SEND_RCVE<br> - WHAT IT DOES:


2 - Receives characters from Serial Monitor
3 - Displays received character as Decimal, Hexadecimal and Character
4 - Controls LED from Keyboard
5 - SEE the comments after "//" on each line below
6
7
8
9 /*-----( Import needed libraries )-----*/
10 /*-----( Declare Constants and Pin Numbers )-----*/
11
12 /*-----( Declare objects )-----*/
13 /*-----( Declare Variables )-----*/
14 int ByteReceived;
15 void setup() /****** SETUP: RUNS ONCE ******/
16 {
17 Serial.begin(9600);
18 pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an outp
19 Serial.println("--- Start Serial Monitor SEND_RECV ---");
20 Serial.println(" Type in Box above, . ");
21 Serial.println("(Decimal)(Hex)(Character)");
22 Serial.println();
23 }
24 //--(end setup )---
25
26 void loop() /****** LOOP: RUNS CONSTANTLY ******/
27 {
28 while (Serial.available() > 0)

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 7 sur 16
:
29 {
30 ByteReceived = Serial.read();
31 Serial.print(ByteReceived);
32 Serial.print(" ");
33 Serial.print(ByteReceived, HEX);
34 Serial.print(" ");
35 Serial.print(char(ByteReceived));
36
37 if(ByteReceived == '1') // Single Quote! This is a character.
38 {
39 digitalWrite(LED_BUILTIN, LOW);
40 Serial.print(" LED ON ");
41 }
42
43 if(ByteReceived == '0')
44 {
45 digitalWrite(LED_BUILTIN,HIGH);
46 Serial.print(" LED OFF");
47 }
48
49
50 Serial.println(); // End the line
51 }
52 // END Serial Available
53 }
54
55
56 //--(end main loop )---
57
58 /*-----( Declare User-written Functions )-----*/
59
60 /*********( THE END )***********/

SerialUart hosted with by GitHub view raw

Experiment 2: Point-to-Point communication of two Motes over the radio


frequency.

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 8 sur 16
:
In telecommunications, a point-to-point connection refers to a communication
connection between two communication endpoints or nodes. An example is
a telephone call, in which one telephone is connected with one other, and what
is said by one caller can only be heard by the other. Think of a wire that directly
connects two systems. The systems use that wire exclusively to communicate.
The opposite of point-to-point communications is broadcasting, where one
system transmits to many.

In this experiment we will be able to establish a communication between the


host and a controller (ESP8266). We will utilize the Wi Fi module of the
controller and will be able to fetch the static IP address of the Wi-Fi module of
ESP 8266.

Source Code

1 #include <ESP8266WiFi.h> //Required header


2
3 // Replace these with your WiFi network settings
4 const char* hotspot = "hotspot_name"; //replace this with your WiFi network name
5
6 const char* password = "password"; //replace this with your WiFi network passwor
7
8 void setup()
9 {
10 delay(1000);
11 Serial.begin(115200); //set the Baud rate to 115200
12 WiFi.begin(hotspot, password); //command ro begins the Wi-Fi connection to ES
13 Serial.println();
14 Serial.print("Connecting");
15 while (WiFi.status() != WL_CONNECTED) //If connection is not yet establishe
16 {
17 delay(500); //wait in loop till the connection g
18 Serial.print(".");
19 }
20 Serial.println("success!"); //Once the connection is established
21 Serial.print("IP Address is: ");
22 Serial.println(WiFi.localIP()); //Get the IP address of the device

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 9 sur 16
:
23 }
24 void loop()
25 {
26
27 }

p2pcommunication hosted with by GitHub view raw

Experiment 3: Multi-point to single point communication of Motes over the


radio frequency.LAN (Subnetting).

A communication that is accomplished via a distinct type of one-to-many


connection, providing multiple paths from a single location to multiple
locations is termed as Point to Multipoint (PMP)

The point-to-multipoint topology consists of a central base station that


supports several subscriber stations. These offer network access from a
single location to multiple locations, permitting them to use the same
network resources between them. The bridge located at the central
location is known as the base station bridge or root bridge. All data that
passes between the wireless bridge clients should initially go via the root
bridge.
In this experiment we will be able to establish a communication between the
host and a controller (ESP8266). We will utilize the Wi Fi module of the
controller and will be able to fetch the static IP address of the Wi-Fi module of
ESP 8266. A HTTP page is made available via the IP address provided by
ESP8266 by which more than one nodes(smart devices) can communicate to
the host and change the state of the LED

Source Code

1 #include <ESP8266WiFi.h> //Define the WiFi header


2
3 const char* ssid = "user_name";//type your ssid -
4 // | -> Wi Fi
5 const char* password = "password";//type your password -

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 10 sur 16
:
6
7 WiFiServer server(80); //Initialize WiFi Server
8
9 void setup()
10 {
11 Serial.begin(115200); //Set Baud rate
12 delay(10);
13 pinMode(LED_BUILTIN, OUTPUT); //Initialize LED
14 digitalWrite(LED_BUILTIN, LOW); //Initial state of LED is ON
15
16 /*---------------------------------------------- Connect to WiFi network----
17 Serial.println();
18 Serial.println();
19 Serial.print("Connecting to ");
20 Serial.println(ssid);
21 WiFi.begin(ssid, password); //Command to connect the device to Wi Fi
22
23 while (WiFi.status() != WL_CONNECTED) //Wait in loop until the device
24 {
25 delay(500);
26 Serial.print(".");
27 }
28 Serial.println("");
29 Serial.println("WiFi connected");
30
31 /*-----------------------------------------------Start the server-----------
32 server.begin();
33 Serial.println("Server started");
34 /*--------------------------------------------- Print the Local IP address--
35 Serial.print("Use this URL to connect: ");
36 Serial.print("http://");
37 Serial.print(WiFi.localIP());
38 Serial.println("/");
39
40 }
41
42 void loop()
43 {
44 int value = LOW; //Assign a variable to hold the state of LED
45

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 11 sur 16
:
46 /*----------------------------------------------Check if a client has connec
47 WiFiClient client = server.available();
48 if (!client)
49 {
50 return;
51 }
52
53 Serial.println("new client"); // Message to display when client is connect
54
55 while(!client.available())
56 {
57 delay(1);
58 }
59
60 String request = client.readStringUntil('\r'); //Read the data sent by cl
61 Serial.println(request);
62 client.flush();
63
64 /*--------------------------------------Creating a Client Interacting page
65 client.println("HTTP/1.1 200 OK");
66 client.println("Content-Type: text/html");
67 client.println(""); // do not forget this one
68 client.println("<!DOCTYPE HTML>");
69 client.println("<html>");
70
71 client.print("LED pin is now: ");
72
73 client.println("<br><br>");
74 client.println("Click <a href=\"/LED=ON\">here</a> turn the LED on pin 2 ON
75 client.println("Click <a href=\"/LED=OFF\">here</a> turn the LED on pin 2 O
76 client.println("</html>");
77 /*-------------------------------------END of creating a Client Interacting p
78
79 /*-------------------------------------Client Request to turn ON the LED-----
80 if (request.indexOf("/LED=ON") != -1)
81 {
82 digitalWrite(LED_BUILTIN, LOW);
83 value = HIGH; //Set the variable 'value' to HIGH
84 }
85 /*-----------------------------------Client Request to turn OFF the LED-----

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 12 sur 16
:
86 if (request.indexOf("/LED=OFF") != -1)
87 {
88 digitalWrite(LED_BUILTIN, HIGH);
89 value = LOW; //Set the variable 'value' to LOW
90 }
91
92 if(value == HIGH)
93 {
94 client.print("On");
95 } else {
96 client.print("Off");
97 }
98
99 delay(1);
100 Serial.println("Client disonnected");
101 Serial.println("");
102
103 }

multipoint-to-point hosted with by GitHub view raw

Sajjad Ahmed September 7, 2020 at 3:09 AM


Nice Blog. Thanks for sharing with us. Such amazing
information.

What are the disadvantages of a part time M.Tech over full time?

REPLY

tejaswini November 6, 2020 at 12:49 AM


Set aside my effort to peruse all the remarks, however I truly
delighted in the article. It's consistently pleasant when you can
not exclusively be educated, yet in addition, engaged!
360DigiTMG iot classes
REPLY

https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 13 sur 16
:

You might also like