MTech IoT Lab
MTech IoT Lab
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.
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.
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
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.
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.)
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.
What is UART?
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
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 )***********/
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.
Source Code
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 }
Source Code
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 }
What are the disadvantages of a part time M.Tech over full time?
REPLY
https://bldeacsvj.blogspot.com/p/mtech-iot-lab.html?m=1 10/01/2025 12 14
Page 13 sur 16
: