6005IOT
6005IOT
6005IOT
Internet of Things
(3171108)
B.E. Semester 7 (I.T)
Certificate
Place:
Date:
Preface
Main motto of any laboratory/practical/field work is for enhancing required skills as well as
creating ability amongst students to solve real time problem by developing relevant competencies
in psychomotor domain. By keeping in view, GTU has designed competency focused outcome-
based curriculum for engineering degree programs where sufficient weightage is given topractical
work. It shows importance of enhancement of skills amongst the students and it pays attention to
utilize every second of time allotted for practical amongst students, instructors and faculty
members to achieve relevant outcomes by performing the experiments rather than havingmerely
study type experiments. It is must for effective implementation of competency focused outcome-
based curriculum that every practical is keenly designed to serve as a tool to develop and enhance
relevant competency required by the various industry among every student. These psychomotor
skills are very difficult to develop through traditional chalk and board content delivery method in
the classroom. Accordingly, this lab manual is designed to focus on the industry defined relevant
outcomes, rather than old practice of conducting practical to prove concept and theory.
By using this lab manual students can go through the relevant theory and procedure in advance
before the actual performance which creates an interest and students can have basic idea prior to
performance. This in turn enhances pre-determined outcomes amongst students. Each experiment
in this manual begins with competency, industry relevant skills, course outcomes as well as
practical outcomes (objectives). The students will also achieve safety and necessary precautions
to be taken while performing practical.
This manual also provides guidelines to faculty members to facilitate student centric lab activities
through each experiment by arranging and managing necessary resources in order that the
students follow the procedures with required safety and necessary precautions to achieve the
outcomes. It also gives an idea that how students will be assessed by providing rubrics.
This manual is designed to accompany your practical exploration of the exciting and rapidly
evolving field of Internet of Things (IoT) and its practical applications. IoT is revolutionizing the
way we interact with and utilize technology, and this manual will guide you through handson
exercises to deepen your understanding of the subject.
Utmost care has been taken while preparing this lab manual however always there is chances of
improvement. Therefore, we welcome constructive suggestions for improvement and removal of
errors if any.
Internet of Things(3171108) 210160116018(A1)
DTE’s Vision
Institute’s Vision
Institute’s Mission
Department’s Vision
Department’s Mission
• Use various tools and technology supporting modern software frameworks for solving
problems having large volume of data in the domain of data science and machine learning.
Sr. CO CO CO CO CO
Objective(s) of Experiment
No. 1 2 3 4 5
Understanding Arduino UNO, NodeMCU and Raspberry
1. Pi and Arduino IDE. √
Controlling LED ON/OFF using Arduino UNO.
2. √
Measuring Temperature and Humidity using Sensor DHT-
3. 11 and Arduino UNO. √
Measuring object presence using IR Sensor and when
4. present, use buzzer for notification. √
Measuring object distance using Ultrasonic Sensor and
5. Arduino Uno. √
Measuring moving object using PIR Sensor and Arduino
6. Uno. √
Measure temperature using DHT-11 sensor and send it to
7. cloud ThingSpeak using NodeMCU. √
Controlling Led ON/OFF by giving command from mobile
8. phone. (Use cloud ThingSpeak) √
Controlling Led ON/OFF by giving commands using
9. Google Assistant from a mobile phone. (Use cloud √
Adafruit)
Installing Raspbian OS in Raspberry Pi and performing
10. basic practical like LED on/off. √
Internet of Things(3171108) 210160116018(A1)
Index
(Progressive Assessment Sheet)
Sign. of
Sr. Date of
No.
Objective(s) of Experiment Page No.
performance
Teacher with date
Experiment No: 1
Aim: Understanding Arduino UNO, Node MCU and Raspberry Pi and Arduino IDE.
Date:
Objectives:
1. Differentiate between Arduino UNO, Node MCU, and Raspberry Pi in terms of hardware
and applications.
2. Identify and handle the key components of each platform.
3. Install and configure the Arduino IDE for microcontroller programming.
4. Write and upload a basic "Hello, World!" program to Arduino UNO.
5. Understand the basic structure of Arduino code, including setup () and loop () functions.
6. Describe the significance of GPIO pins in microcontroller programming.
7. Explore the Node MCU board and its compatibility with IoT applications.
8. Gain familiarity with the Raspberry Pi as a versatile single-board computer.
9. Describe the role of Raspberry Pi in IoT projects and applications.
10. Recognize the significance of choosing the appropriate hardware platform for specific IoT
projects.
Equipment/Instruments:
1. Arduino UNO microcontroller board.
2. Node MCU development board.
3. Raspberry Pi single-board computer.
4. Laptop or desktop computer with the Arduino IDE installed.
5. USB cables for connecting the microcontroller boards to the computer.
6. Basic electronic components such as LEDs and resistors (if needed for practical
demonstrations).
7. Internet connectivity for software and IDE installation (if required).
Explanation:
Arduino UNO:
1
Internet of Things(3171108) 210160116018(A1)
2
Internet of Things(3171108) 210160116018(A1)
NodeMCU :
NodeMCU is an open-source Lua based firmware and development board specially targeted for
IoT based Applications. It includes firmware that runs on the ESP8266 Wi-Fi SoC from Espressif
Systems, and hardware which is based on the ESP-12 module.
3
Internet of Things(3171108) 210160116018(A1)
Fig 3: Raspberry Pi
Arduino IDE:
The Arduino Integrated Development Environment (IDE) is a cross-platform application (for
Windows, macOS, Linux) that is written in functions from C and C++. It is used to write and upload
programs to Arduino compatible boards, but also, with the help of third-party cores, other vendor
development boards.
4
Internet of Things(3171108) 210160116018(A1)
The source code for the IDE is released under the GNU General Public License, version 2. The
Arduino IDE supports the languages C and C++ using special rules of code structuring. The
Arduino IDE supplies a software library from the Wiring project, which provides many common
input and output procedures. User-written code only requires two basic functions, for starting the
sketch and the main program loop, that are compiled and linked with a program stub main() into an
executable cyclic executive program with the GNU toolchain, also included with the IDE
distribution.The Arduino IDE employs the program avrdude to convert the executable code into a
text file in hexadecimal encoding that is loaded into the Arduino board by a loader program in the
board's firmware. By default, avrdude is used as the uploading tool to flash the user code onto
official Arduino boards.
Arduino IDE is a derivative of the Processing IDE, however as of version 2.0, the Processing IDE
will be replaced with the Visual Studio Code-based Eclipse Theia IDE framework.
With the rising popularity of Arduino as a software platform, other vendors started to implement
custom open source compilers and tools (cores) that can build and upload sketches to other
microcontrollers that are not supported by Arduino's official line of microcontrollers.
Observation:
Arduino UNO, NodeMCU, Raspberry Pi, and Arduino IDE are essential tools for
electronics and IoT development. UNO offers simplicity and versatility, NodeMCU adds WiFi
connectivity for IoT, Raspberry Pi provides computing power, and Arduino IDE simplifies
programming for all.
Conclusion:
In conclusion, Arduino UNO, NodeMCU, Raspberry Pi, and the Arduino IDE form a
powerful ecosystem for electronics and IoT development. Each component offers unique
capabilities, from microcontroller-based prototyping to full-fledged computing and
networking. With these tools, enthusiasts and professionals alike can bring their ideas to life,
explore creative projects, and contribute to the ever-expanding world of technology.
Quiz:
1. Which hardware platform is known for its versatility and use as a single-board computer in
IoT applications?
Answer:
The hardware platform known for its versatility and use as a single-board computer in
IoT applications is the Raspberry Pi.
2. What is the primary function of the Arduino Integrated Development Environment (IDE)?
Answer:
The primary function of the Arduino Integrated Development Environment (IDE) is to
provide a platform for writing, compiling, and uploading code to Arduino
microcontroller boards. It also includes features such as code syntax highlighting,
debugging tools, and libraries to simplify programming tasks.
5
Internet of Things(3171108) 210160116018(A1)
4. Which hardware platform is typically used to create web servers and Wi-Fi-enabled IoT
applications?
Answer:
The hardware platform typically used to create web servers and Wi-Fi-enabled IoT
applications is the ESP8266 or its successor, the ESP32. These microcontroller units
are widely used for their built-in Wi-Fi capabilities and low cost, making them ideal for
IoT projects requiring internet connectivity.
5. Which of the following IoT hardware platforms is primarily based on the use of GPIO pins
for interfacing with sensors and devices?
Answer:
The IoT hardware platform primarily based on the use of GPIO (General Purpose
Input/Output) pins for interfacing with sensors and devices is the Raspberry Pi. While
Arduino boards also utilize GPIO pins, Raspberry Pi's GPIO pins are often employed
for interfacing with sensors, actuators, and other peripherals in IoT projects due to its
versatility and processing power.
References:
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
6
Internet of Things(3171108) 210160116018(A1)
Experiment No: 2
Aim: Controlling LED ON/OFF using Arduino UNO.
Date:
Components:
1. Arduino UNO Microcontroller: This is the central component of the lab session. The
Arduino UNO is a microcontroller board that will be used to control the LED.
2. LED (Light-Emitting Diode): An LED is used as the output device. LEDs come in various
colours and types, but a basic one will suffice for this exercise.
3. Resistor (220-330 ohms): A current-limiting resistor is necessary to prevent excessive
current from flowing through the LED and potentially damaging it.
4. Breadboard: A breadboard is used for easy prototyping and making temporary connections.
It simplifies the setup and makes it easier to modify the circuit.
5. Jumper Wires: These wires are used to make connections between the components on the
breadboard, ensuring electrical continuity.
6. USB Cable: A USB cable is required to connect the Arduino UNO to a computer for
programming.
7. Computer with Arduino IDE: You'll need a computer with the Arduino Integrated
Development Environment (IDE) installed. The Arduino IDE is used to write, compile, and
upload code to the Arduino UNO.
8. Power Source (optional): In some cases, an external power source may be required if you
are working with multiple LEDs or components that draw more current than the Arduino
can provide.
7
Internet of Things(3171108) 210160116018(A1)
Configuration:
Procedure:
8
Internet of Things(3171108) 210160116018(A1)
This setup ensures that when Pin 9 on the Arduino outputs a high-level signal, the LED will light
up due to the current flowing through the current-limiting resistor.
Step 2: Write Code in Arduino IDE:
void setup() {
// Set LED_BUILTIN (usually Pin 13 on Arduino Uno) as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// Turn on the LED by setting Pin 13 (or LED_BUILTIN) to HIGH.
digitalWrite(LED_BUILTIN, HIGH); delay(1000); // Wait
for 1 second (1000 milliseconds).
Observation:
Conclusion:
In conclusion, the project of controlling an LED ON/OFF using Arduino UNO serves
as an excellent starting point for beginners in electronics and programming. It provides hands-
on experience with basic circuitry and digital output control while laying the foundation for
more advanced projects. Through this simple exercise, users gain confidence in interfacing
hardware with software and begin to grasp the principles of microcontroller-based systems.
9
Internet of Things(3171108) 210160116018(A1)
Quiz:
1. In the circuit setup to control an LED with an Arduino Uno, which pin is connected to the
anode (long pin) of the LED?
Answer:
In the circuit setup to control an LED with an Arduino Uno, the pin connected to the
anode (long pin) of the LED can be any digital output pin on the Arduino Uno board.
For example, pin 13 is commonly used for this purpose.
3. In the provided Arduino code, what is the purpose of the pin Mode (LED_BUILTIN,
OUTPUT); line in the setup () function?
Answer:
In the provided Arduino code, the line `pinMode(LED_BUILTIN, OUTPUT);` in the
`setup()` function sets the mode of the built-in LED pin (usually pin 13 on most Arduino
boards) as an output. This line configures the pin to which the built-in LED is connected
so that it can be used to output voltage and control the LED.
4. How long does the LED stay on in the provided Arduino code before turning off in the loop
() function?
Answer:
The provided Arduino code is not specified, so I can't determine the exact duration the
LED stays on in the `loop()` function without seeing the code. Typically, the duration
of LED being on or off is determined by the specific instructions within the `loop()`
function. If you provide the code snippet, I can help you determine the duration.
References:
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
10
Internet of Things(3171108) 210160116018(A1)
Experiment No: 3
Aim: Measuring Temperature and Humidity using Sensor DHT-11 and Arduino UNO.
Date:
Objectives:
1. Identify the components of the DHT-11 sensor, including the temperature and humidity
sensing elements.
2. Build a circuit to connect the DHT-11 sensor to an Arduino UNO.
3. Write Arduino code to read temperature and humidity data from the sensor.
4. Display the sensor data on a connected display (e.g., a serial monitor or an LCD).
5. Understand the calibration and limitations of the DHT-11 sensor.
6. Recognize the importance of temperature and humidity measurements in IoT applications.
Components:
1. Arduino UNO Microcontroller: This is the central component for interfacing with the DHT-
11 sensor and processing data.
2. DHT-11 Sensor: A sensor module that can measure temperature and humidity.
3. Breadboard: Used for easy prototyping and making temporary connections.
4. Jumper Wires: These wires are used to make connections between the components on the
breadboard.
5. Display (e.g., Serial Monitor on a computer or an LCD): Used to display the temperature
and humidity data.
6. Power Source: The Arduino UNO may require a power source to operate the circuit.
Configuration:
11
Internet of Things(3171108) 210160116018(A1)
Procedure:
Step 1: Place the Sensor
• Position the DHT-11 sensor on the breadboard with the blue part of the sensor facing
you. Ensure it is securely placed.
Step 2: Connect Everything 2.1. Identify the pins on the DHT-11 sensor: S (signal), middle pin
(voltage), and the minus sign (ground). 2.2. Connect the sensor to the Arduino UNO as follows:
• Connect the S (signal) pin of the sensor to header A0 on the Arduino.
• Connect the middle pin (voltage) of the sensor to 5V on the Arduino.
• Connect the minus sign (ground) of the sensor to GND on the Arduino. 2.3. Use
coloured cables (e.g., yellow for signal, red for power, black for ground) for the
connections.
Step 3: Adding the DHT Library
• In the Arduino IDE, go to "Sketch" > "Include Library" > "Add ZIP file."
• Locate and select the "DHT_Library.zip" file and add it to the IDE.
12
Internet of Things(3171108) 210160116018(A1)
Code:
#include <dht.h>
#define dht_11_PIN 7
dht DHT;
void setup(){
Serial.begin(9600);
delay(500); // Delay to let the system boot
Serial.println("DHT11 Humidity & Temperature Sensor\n\n"); delay(1000);
// Wait before accessing the sensor
}
void loop(){
DHT.read11(dht_11_PIN);
Serial.print("Current humidity = ");
Serial.print(DHT.humidity);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.println("C "); delay(5000);
}
Step 4: Uploading and Monitoring Data
• Upload the provided code to the Arduino UNO.
• After uploading, open the Arduino IDE's serial monitor byclicking the magnifying glass
button in the top right corner.
• The sensor data (humidity and temperature) should be displayed and updated every 5
seconds in the serial monitor.
13
Internet of Things(3171108) 210160116018(A1)
Output:
Conclusion:
In conclusion, the project of measuring temperature and humidity using the DHT11
sensor and Arduino UNO offers valuable insights into sensor interfacing, data acquisition, and
basic data processing. By connecting the sensor to the Arduino board and writing code to read
its values, users gain practical experience in working with real-world sensor data. This project
serves as an excellent introduction to environmental monitoring and lays the groundwork for
more advanced IoT applications involving sensor networks and data visualization.
Quiz:
1. When placing the DHT-11 sensor on the breadboard, which part of the sensor should be
facing you?
Answer:
When placing the DHT-11 sensor on the breadboard, the side with the grid of holes
should be facing you. This is where you would connect jumper wires to the sensor's
pins.
2. Which of the following correctly identifies the pins on the DHT-11 sensor?
Answer:
The pins on the DHT-11 sensor are typically labeled as VCC, DATA, and GND. VCC is for power
supply, DATA is for data communication, and GND is for ground connection.
14
Internet of Things(3171108) 210160116018(A1)
5. In the serial monitor, how often (In seconds) does the sensor data update in the provided
code?
Answer:
The frequency of sensor data updates in the provided code depends on the value
specified in the `delay()` function after reading the sensor data and printing it to the
serial monitor. Without seeing the specific delay value, I can't determine the exact
update frequency. Typically, the delay is set to a value in milliseconds, so if you provide
the code snippet with the delay value, I can help you calculate the update frequency in
seconds.
References:
Code Understanding
Sensor Placement Connection Setup & Quiz Performance Ethics
Data Display
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
15
Internet of Things(3171108) 210160116018(A1)
Experiment No: 4
Aim: Measuring object presence using IR Sensor and when present, use buzzer for notification.
Date:
Objectives:
1. Identify the key components of an IR sensor, buzzer, and the necessary connections.
2. Build a circuit to connect an IR sensor and a buzzer to an Arduino or microcontroller.
3. Write Arduino code to detect the presence of an object using the IR sensor.
4. Implement logic in the code to activate the buzzer when an object is detected.
5. Understand the practical applications of object detection and notification systems in IoT and
automation.
Components:
1. IR Sensor: A sensor module designed to detect the presence of objects by emitting and
receiving infrared signals.
2. Buzzer: An audible notification device that produces sound when activated.
3. Arduino or Microcontroller: The central control unit used to process sensor data and control
the buzzer.
4. Breadboard: Used for easy prototyping and making temporary connections.
5. Jumper Wires: These wires are used to make connections between the components on the
breadboard.
6. Power Source (if required): Depending on the components used, an external power source
may be needed to operate the circuit.
Configuration:
16
Internet of Things(3171108) 210160116018(A1)
Procedure:
Step 1: Build the Circuit
• Follow the circuit diagram provided to set up the components. Ensure you
connect the IR sensor and buzzer to the appropriate pins on the Arduino or
microcontroller. Double-check your connections to avoid errors.
Step 2: Write and Upload the Arduino Code
• Open the Arduino Integrated Development Environment (IDE) on your
computer.
• Write the following code:
Code:
int irSensor = 12;
int buzzer = 7;
void setup() {
Serial.begin(9600);
pinMode(irSensor, INPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
int value = digitalRead(irSensor);
Serial.println("");
Serial.print("Sensor Value = ");
Serial.print(value); if (value ==
0) {
digitalWrite(buzzer, HIGH);
} else {
digitalWrite(buzzer, LOW);
}
delay(50);
}
Code Explanation:
• The code initializes two variables irSensor (connected to pin 12) and buzzer
(connected to pin 7) to represent the IR sensor and buzzer pins, respectively.
• In the setup () function, it sets up the serial communication for debugging,
configures the IR sensor pin as an input, and the buzzer pin as an output.
• The loop () function reads the value of the IR sensor using digitalRead(irSensor)
and stores it in the value variable.
• It then prints the sensor value to the serial monitor for monitoring.
• If the sensor value is 0 (indicating the presence of an object), it sets the buzzer pin
to HIGH to activate the buzzer. If there is no object detected, it sets the buzzer pin
to LOW to turn off the buzzer.
• There's a delay (50) to introduce a small delay between readings.
Step 3: Test the Circuit
• Upload the code to your Arduino or microcontroller.
• Open the serial monitor in the Arduino IDE.
17
Internet of Things(3171108) 210160116018(A1)
• Observe the sensor value being printed and listen for the buzzer activation when an
object is detected (sensor value is 0).
Observation:
Measuring object presence with an IR sensor and activating a buzzer for notification
demonstrates a practical application of sensor-based detection. The setup effectively alerts
users when an object enters the sensor's range, showcasing the integration of hardware
components with microcontroller logic. This project highlights the importance of reliable
detection accuracy and timely response in real-world sensing applications.
Conclusion:
Quiz:
1. In the provided procedure, which pin is connected to the IR sensor for reading its output
value?
Answer:
In the provided procedure, the pin connected to the IR sensor for reading its output
value is typically labeled as "OUT" or "Signal." This pin outputs a digital signal based
on whether it detects an infrared signal or not.
2. In the provided code, what is the purpose of the digitalWrite(buzzer, HIGH); line?
Answer:
In the provided code, the line `digitalWrite(buzzer, HIGH);` is used to turn on the
buzzer connected to the Arduino. Setting the pin connected to the buzzer to HIGH
applies voltage to it, causing it to produce sound or beep.
18
Internet of Things(3171108) 210160116018(A1)
5. In the procedure, what is the purpose of opening the serial monitor in the Arduino IDE?
Answer:
In the procedure, opening the serial monitor in the Arduino IDE serves the purpose of
displaying the output of the Arduino board. This could include sensor readings,
debugging information, or any other data that the Arduino is programmed to send via
serial communication. Opening the serial monitor allows the user to observe real-time
data and debug potential issues in the code or circuitry.
References:
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
19
Internet of Things(3171108) 210160116018(A1)
Experiment No: 5
Aim: Measuring object distance using Ultrasonic Sensor and Arduino Uno.
Date:
Objectives:
1. Identify the key components of an Ultrasonic sensor and the necessary connections.
2. Build a circuit to connect an Ultrasonic sensor to an Arduino Uno.
3. Write Arduino code to measure object distance using the Ultrasonic sensor.
4. Interpret the distance data and display it on a connected output device (e.g., LCD or serial
monitor).
5. Understand the practical applications of distance measurement in IoT, robotics, and
automation.
Components:
1. Ultrasonic Sensor (HC-SR04): A sensor module designed to measure distances by sending
and receiving ultrasonic sound waves.
2. Arduino Uno: The central control unit used to process sensor data and display distance
information.
3. Breadboard: Used for easy prototyping and making temporary connections.
4. Jumper Wires: These wires are used to make connections between the components on the
breadboard.
5. Display (optional): An output device (e.g., LCD or serial monitor) for displaying the
measured distance.
6. Power Source (if required): Depending on the components used, an external power source
may be needed to operate the circuit.
Configuration:
20
Internet of Things(3171108) 210160116018(A1)
Procedure:
Step 1: Setup the Circuit
1. Place the Ultrasonic sensor on one end of the breadboard so that none of the pins
are connected to each other.
2. Connect the "trigger" pin on the Ultrasonic sensor to pin 10 on the Arduino.
3. Connect the "echo" pin on the Ultrasonic sensor to pin 9 on the Arduino.
4. Connect the Ultrasonic Sensor's 5V pin to the 5V pin on the Arduino.
5. Complete the circuit by connecting the Ultrasonic Sensor's ground pin to the
Arduino's ground pin.
Step 2: Understanding the Ultrasonic Sensor
• The Ultrasonic sensor is capable of non-contact distance measurements in the range
of 2cm to 400cm, with a ranging accuracy of up to 3mm.
• It operates by emitting ultrasonic sound waves and measuring the time it takes for
the waves to bounce back after hitting an object, similar to how bats use
echolocation.
Step 3: Write and Upload the Arduino Code
• Open the Arduino Integrated Development Environment (IDE) on your computer.
• Write the following code:
Code:
const int trigger = 9;
const int echo = 10; long
duration;
21
Internet of Things(3171108) 210160116018(A1)
int distance;
void setup() {
pinMode(trigger, OUTPUT); pinMode(echo,
INPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(trigger, LOW);
delayMicroseconds(2);
digitalWrite(trigger, HIGH);
delayMicroseconds(10);
digitalWrite(trigger, LOW); duration
= pulseIn(echo, HIGH); distance =
duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.println(distance);
}
Code Explanation:
• The code initializes two constants, trigger (connected to pin 9) and echo (connected
to pin 10) to represent the trigger and echo pins of the Ultrasonic sensor.
• In the setup () function, it sets the trigger pin as an OUTPUT and the echo pin as an
INPUT. It also initializes serial communication for monitoring.
• The loop() function sends a trigger signal, measures the echo response, calculates
the distance based on the time it takes for the signal to bounce back, and then prints
the distance to the serial monitor.
Step 4: Testing the Circuit
• Upload the code to your Arduino Uno.
• Open the serial monitor in the Arduino IDE to observe the measured distance values.
Observation:
Measuring object distance with an Ultrasonic Sensor and Arduino Uno showcases the
practical application of distance-sensing technology. By emitting sound waves and
measuring their return time, the sensor provides accurate distance readings. This project
illustrates the seamless integration of hardware components and microcontroller logic,
offering a glimpse into the potential of sensor-based systems for various applications, from
robotics to smart devices.
Conclusion:
In conclusion, the project of measuring object distance using an Ultrasonic Sensor and
Arduino Uno demonstrates the effective implementation of distance-sensing technology. By
leveraging the sensor's ability to emit and detect sound waves, precise distance measurements
are achieved. This project underscores the versatility and practicality of Arduino-based systems
in real-world applications requiring object detection and distance measurement.
22
Internet of Things(3171108) 210160116018(A1)
Quiz:
1. In the provided procedure, which pins on the Arduino are connected to the "trigger" and
"echo" pins of the Ultrasonic sensor?
Answer:
In the provided procedure, the "trigger" pin of the Ultrasonic sensor is typically
connected to a digital output pin on the Arduino, and the "echo" pin is connected to a
digital input pin. These pins are used for sending and receiving ultrasonic pulses,
respectively. The specific pins used can vary depending on how the sensor is wired, but
common choices are pins 2 and 3 on an Arduino Uno.
3. What is the purpose of the "trigger" pin on the Ultrasonic sensor in the code?
Answer:
The purpose of the "trigger" pin on the Ultrasonic sensor in the code is to initiate the
ultrasonic pulse. When the "trigger" pin is set to HIGH, the sensor sends out a short
ultrasonic pulse. This pulse travels through the air and reflects off objects in its path.
By measuring the time it takes for the pulse to return as an echo, the sensor can calculate
the distance to the object.
4. In the code, what value is used to calculate the distance based on the time it takes for the
echo signal to return?
Answer:
In the code, the value used to calculate the distance based on the time it takes for the
echo signal to return is the time elapsed between sending the ultrasonic pulse (triggering
it) and receiving the echo. This time value is typically measured in microseconds (µs).
5. What is the purpose of opening the serial monitor in the Arduino IDE when using the
Ultrasonic sensor?
Answer:
Opening the serial monitor in the Arduino IDE when using the Ultrasonic sensor serves
the purpose of displaying the measured distance readings. This allows the user to
observe real-time distance measurements between the sensor and objects in its path. It
helps in debugging the sensor's performance, verifying its accuracy, and understanding
how the sensor responds to different objects and distances.
References:
23
Internet of Things(3171108) 210160116018(A1)
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
24
Internet of Things(3171108) 210160116018(A1)
Experiment No: 6
Aim: Measuring moving object using PIR Sensor and Arduino Uno.
Date:
Objectives:
1. Identify the key components of a PIR sensor and the necessary connections.
2. Build a circuit to connect a PIR sensor to an Arduino Uno.
3. Write Arduino code to detect and respond to moving objects using the PIR sensor.
4. Interpret the motion data and trigger appropriate actions (e.g., turning on an LED or sending
a notification).
5. Understand the practical applications of motion detection in security systems and
automation.
Components:
1. PIR Sensor (HC-SR501 or similar): A sensor designed to detect motion by measuring
changes in infrared radiation.
2. Arduino Uno: The central control unit used to process sensor data and trigger actions.
3. Breadboard: Used for easy prototyping and making temporary connections.
4. Jumper Wires: These wires are used to make connections between the components on the
breadboard.
5. Output Device (e.g., LED or buzzer): An optional component for demonstrating motion
detection.
6. Power Source (if required): Depending on the components used, an external power source
may be needed to operate the circuit.
Configuration:
25
Internet of Things(3171108) 210160116018(A1)
The design of the PIR Motion Sensor using Arduino is very simple. The PIR Sensor Module has
three pins: VCC, Digital Out and GND. Connect VCC and GND to +5V and GND respectively.
Then connect the Digital Out Pin of the PIR sensor to the digital I/O pin 8 of Arduino.
As we need to indicate the detection of motion by the sensor, connect a buzzer to Pin 11 of the
Arduino.
Procedure:
1. When the system is powered on, the Arduino enters a calibration phase for the PIR sensor.
During this 10-second calibration period, the PIR sensor should not detect any motion.
2. After the calibration period, the PIR sensor is ready to detect any movement in front of it.
3. If the PIR sensor detects motion, its digital output pin (connected to Arduino Pin 8) becomes
HIGH.
4. Arduino detects the HIGH signal from the PIR sensor and activates the buzzer.
5. The buzzer remains active for 3 seconds (3000 milliseconds).
6. After the buzzer has been activated, it turns off when motion is no longer detected by the
PIR sensor. Code:
int buzzer = 11;
int sensor = 8; int
led = 13; void
setup()
{
pinMode(buzzer, OUTPUT);
pinMode(sensor, INPUT);
pinMode(led, OUTPUT);
digitalWrite(buzzer,LOW);
digitalWrite(sensor,LOW);
digitalWrite(led,LOW);
while(millis()<13000){
digitalWrite(led,HIGH);
delay(50);
digitalWrite(led,LOW);delay(50);
}
26
Internet of Things(3171108) 210160116018(A1)
digitalWrite(led,HIGH);
}
void loop()
{
if(digitalRead(sensor)==HIGH)
{
digitalWrite(buzzer,HIGH);
delay(3000);
digitalWrite(buzzer,LOW);
while(digitalRead(sensor)==HIGH);
}
}
Code Explanation:
• The code initializes three variables: buzzer (connected to pin 11), sensor (connected to
pin 8), and led (connected to pin 13).
• In the setup() function, the code sets the pinMode for the buzzer as OUTPUT, the sensor
as INPUT, and the LED as OUTPUT. It also initializes these components with LOW
states.
• During the calibration period, the LED blinks every 100 milliseconds for 13 seconds.
• In the loop() function, the code continuously checks the state of the PIR sensor. If the
PIR sensor detects motion (HIGH signal), it activates the buzzer for 3 seconds and then
turns it off when motion is no longer detected.
Observation:
Detecting motion with a PIR Sensor and Arduino Uno demonstrates practical
application of motion sensing technology. The sensor detects changes in infrared radiation
caused by moving objects, triggering responses from the Arduino Uno. This setup is useful
for applications such as security systems and automation.
Conclusion:
Measuring moving objects with a PIR Sensor and Arduino Uno showcases the practical
implementation of motion detection technology. This setup offers versatility for various
applications, from security systems to automation, by efficiently detecting and responding to
changes in infrared radiation caused by moving objects.
Quiz:
1. In the provided project, how long is the calibration period for the PIR sensor?
Answer:
In the provided project, the calibration period for the PIR sensor is typically around 30
seconds. During this period, the sensor adjusts to the environment and establishes a
baseline for motion detection.
2. What happens when the PIR sensor detects motion in front of it in the provided project?
Answer:
27
Internet of Things(3171108) 210160116018(A1)
When the PIR sensor detects motion in front of it in the provided project, it triggers an
output signal. This signal indicates the presence of motion, which can be used to
activate other components like lights, buzzers, or alarms.
3. Which pin on the Arduino is used to connect the PIR sensor's digital output pin in the
project?
Answer:
In the project, the PIR sensor's digital output pin is typically connected to a digital input
pin on the Arduino. Common choices for this connection include pins 2 or 3 on an
Arduino Uno, but the specific pin used can vary depending on how the sensor is wired.
4. During the calibration period, how often does the LED connected to Pin 13 blink in the
code?
Answer:
During the calibration period in the code, the LED connected to Pin 13 typically blinks
continuously. This blinking pattern indicates that the system is in the calibration phase
and is not yet actively monitoring for motion.
5. In the project's code, for how many milliseconds is the buzzer activated when motion is
detected by the PIR sensor?
Answer:
In the project's code, the buzzer is typically activated for a duration of around 500
milliseconds (0.5 seconds) when motion is detected by the PIR sensor. This activation
period may vary depending on the specific requirements of the project or the
preferences of the programmer.
References:
Signature
28
Internet of Things(3171108) 210160116018(A1)
Experiment No: 7
Aim: Measure temperature using DHT-11 sensor and send it to cloud ThingSpeak using NodeMCU.
Date:
Objectives:
1. Identify the key components of a DHT-11 sensor and NodeMCU.
2. Build a circuit to connect a DHT-11 sensor to a NodeMCU and configure the NodeMCU
for data transmission.
3. Write Arduino code to read temperature data from the DHT-11 sensor.
4. Set up ThingSpeak, a cloud platform for IoT, and create a channel to receive temperature
data.
5. Send temperature data from the NodeMCU to ThingSpeak for cloud-based storage and
visualization.
Components:
1. DHT-11 Sensor: A sensor module for measuring temperature and humidity.
2. NodeMCU (ESP8266): A low-cost open-source IoT platform for WiFi connectivity.
3. Breadboard and Jumper Wires: Used for easy prototyping and making connections.
4. Power Source (if required): Depending on the components used, an external power source
may be needed for the NodeMCU.
5. ThingSpeak Account: An online platform for collecting, visualizing, and analyzing IoT data.
Configuration:
29
Internet of Things(3171108) 210160116018(A1)
#include <ESP8266WiFi.h>
ThingSpeak
const char *ssid = "how2electronics"; // replace with your wifi ssid and wpa2 key
WiFiClient client;
30
Internet of Things(3171108) 210160116018(A1)
void setup()
{
Serial.begin(115200);
delay(10);
dht.begin();
Serial.println("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
delay(500);
Serial.print(".");
Serial.println("");
Serial.println("WiFi connected");
void loop()
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t))
return;
{
31
Internet of Things(3171108) 210160116018(A1)
postStr +="&field1=";
postStr += String(t);
postStr +="&field2=";
postStr += String(h);
postStr += "\r\n\r\n";
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(h);
client.stop();
Serial.println("Waiting...");
delay(1000);
}
32
Internet of Things(3171108) 210160116018(A1)
Observation:
Measuring temperature with a DHT-11 sensor and sending data to ThingSpeak via
NodeMCU demonstrates an IoT application of temperature monitoring. The DHT-11 sensor
accurately measures temperature, while the NodeMCU facilitates connectivity to the internet.
By integrating with ThingSpeak, data can be stored and analyzed in the cloud, enabling remote
monitoring and analysis. This project highlights the seamless integration of sensor data with
IoT platforms for real-time monitoring and data visualization.
Outout:
Output of this practical is seen on Thimgspeak and serial monitor. Open channel at Thingspeak and output
will be shown as mentioned ahead.
Temperature:
33
Internet of Things(3171108) 210160116018(A1)
Humidity:
34
Internet of Things(3171108) 210160116018(A1)
Conclusion:
Quiz:
1. In the provided project, which pin is used to connect the DHT-11 sensor to the NodeMCU?
Answer:
In the provided project, the pin used to connect the DHT-11 sensor to the NodeMCU
can vary depending on how the sensor is wired. Common choices for the data pin
connection include D1, D2, or D4 on a NodeMCU board.
35
Internet of Things(3171108) 210160116018(A1)
2. What is the purpose of the ThingSpeak API key in this
project?Answer:
The purpose of the ThingSpeak API key in this project is to authenticate the NodeMCU
board with the ThingSpeak platform. ThingSpeak is a cloud service that allows users
to collect, analyze, and visualize data from IoT devices. The API key ensures that only
authorized devices can send data to a specific ThingSpeak channel for storage and
analysis.
3. According to the provided code, what is the minimum delay required between data updates
when sending data to ThingSpeak?
Answer:
According to the provided code, the minimum delay required between data updates
when sending data to ThingSpeak is typically around 15,000 milliseconds (15 seconds).
This delay ensures that the NodeMCU board does not exceed ThingSpeak's rate limits
for data updates, preventing potential issues or restrictions imposed by the platform.
4. What should be edited in the code to specify your Wi-Fi network credentials?
Answer:
To specify your Wi-Fi network credentials in the code, you need to edit the following
lines:
const char* ssid = "YOUR_WIFI_SSID";
5. In the code, what method is used to send data to ThingSpeak for cloud storage?
Answer:
In the code, the `ThingSpeak.writeField()` method is used to send data to ThingSpeak
for cloud storage. This method is responsible for sending a single field of data to a
specified ThingSpeak channel. It takes parameters such as the channel number, field
number, data value, and API key to authenticate the data transfer.
References:
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
36
Internet of Things(3171108) 210160116018(A1)
Experiment No: 8
Aim: Controlling Led ON/OFF by giving command from mobile phone. (Use cloud ThingSpeak)
Date:
Objectives:
1. Identify the key components required for cloud-based IoT control using ThingSpeak.
2. Build a circuit that connects an LED to a microcontroller (e.g., Arduino) and configure the
microcontroller for cloud-based control.
3. Set up a ThingSpeak channel to receive control commands from a mobile phone.
4. Write code to receive commands from the ThingSpeak channel and control the LED based
on the commands sent from a mobile phone.
5. Use a mobile phone to send commands to ThingSpeak and observe the real-time control of
the LED.
Components:
1. Microcontroller (e.g., Arduino): Used to control the LED.
2. LED and Resistor: Components for the LED circuit.
3. Breadboard and Jumper Wires: Used for circuit prototyping.
4. ThingSpeak Account: An online platform for IoT data control.
5. Mobile Phone: Used to send control commands to ThingSpeak.
6. Power Source (if required): Depending on the components used, an external power source
may be needed for the microcontroller and LED.
Configuration:
37
Internet of Things(3171108) 210160116018(A1)
Procedure:
Step 1: Setting Up ThingSpeak
1. Log in to the ThingSpeak server (https://thingspeak.com/login).
2. If you are a new user, create a new account.
3. After logging in, create a new channel.
38
Internet of Things(3171108) 210160116018(A1)
4. Enter the channel name, description, and select Field 1. Click the checkbox and save
the channel.
5. Make a note of the Channel ID for later use in the Arduino code.
Step 2: Firmware
1. Write code in the Arduino IDE, selecting the NodeMCU 12E board.
39
Internet of Things(3171108) 210160116018(A1)
2. Use the provided code to configure the NodeMCU for connecting to ThingSpeak.
3. Replace the SSID and password with your Wi-Fi network credentials.
4. Enter the ThingSpeak Channel ID in the code. Channel ID: 1070593, it’s written in
code.
5. Upload the code to the NodeMCU.
Code :
#include<ThingSpeak.h>
#include<ESP8266WiFi.h>
#include<ESP8266WebServer.h>
unsigned long channel_num=1070593;
const char* ssid="shravan"; const
char* password="8905552134"; int
led;
unsigned int value;
WiFiClient client; // make the client of the WiFi which connect to the ThingSpeak webServer
ESP8266WebServer server(80); // make the naother server
{
pinMode(D1,OUTPUT);
digitalWrite(D1,0);
Serial.begin(115200);
WiFi.begin(ssid,password); // connect to the wifi STA connection
while WiFi.status()!=WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println(WiFi.localIP()); // print the wifi local ip
server.on("/",handleonconnect); // in urt type the "/" then call the handle on connect function
40
Internet of Things(3171108) 210160116018(A1)
digitalWrite(D1 ,0);
}
else if(led==0) {
}
{
server.send(200,"text/html",SendHTML());
}
HTML :
String SendHTML(void){
String ptr = "<!DOCTYPE html> <html>\n";
ptr +="<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-
scalable=no\">\n";
ptr +="<title>LED Control</title>\n";
ptr +="<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n";
ptr +="body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;} h3 {color: #444444;margin-
bottom: 50px;}\n";
ptr +=".button {display: block;width: 80px;background-color: #1abc9c;border: none;color: white;padding: 13px
30px;text-decoration: none;font-size: 25px;margin: 0px auto 35px;cursor: pointer;border-radius: 4px;}\n";
ptr +=".button-on {background-color: #1abc9c;}\n";
ptr +=".button-on:active {background-color: #16a085;}\n";
ptr +=".button-off {background-color: #34495e;}\n";
ptr +=".button-off:active {background-color: #2c3e50;}\n";
ptr +="p {font-size: 14px;color: #888;margin-bottom: 10px;}\n";
ptr +="</style>\n";
ptr +="</head>\n";
ptr +="<body>\n";
ptr +="<h1>ESP8266 with ThingSpeak Server</h1>\n";
ptr +="<h3>Using Station(STA) Mode</h3>\n";
ptr +="<h4>Control status For D1</h4>\n";
41
Internet of Things(3171108) 210160116018(A1)
ptr+="<aclass=\"buttonbutton-on\"
href=\"https://api.thingspeak.com/update?api_key=MOHD33LYGVXTG5UF&field1=1\">ON</a>\n";
ptr+="<aclass=\"buttonbutton-off\"
href=\"https://api.thingspeak.com/update?api_key=MOHD33LYGVXTG5UF&field1=0\">OFF</a>\n";
ptr +="</body>\n";
ptr +="</html>\n";
return ptr;
}
That is my HTML code if you are an embedded engineer then do not learn the HTML
and CSS, but knowledge abut the how it work we press the any url.
https://api.thingspeak.com/update?api_key=MOHD33LYGVXTG5UF&field1=0
this url is copy from the thingserver here api_key is different in your case last one
&field1=0 mean we we press this url then send the 0 on your thingspeak server to the
field1 and &field1=1 mean when we press this url then send the 1 on your thingspeak
server to the field1. but we don't press the url using HTML code we only clink on the ON
button to turn on the led and OFF button for turn off the led.
Now go to the thingspeak server click on the API KEYS and copy the Write API KEY
and paste the HTML code code which highlighted on the upper HTML code pic.
42
Internet of Things(3171108) 210160116018(A1)
Step 5: Testing
1. Upload the code to the NodeMCU.
2. Verify that the NodeMCU connects to Wi-Fi, and note the local IP address.
3. Access the local IP address in a web browser.
4. Use the web interface to control the LED by clicking the ON and OFF buttons.
43
Internet of Things(3171108) 210160116018(A1)
Observation:
Controlling an LED's ON/OFF state via mobile phone commands through ThingSpeak
cloud integration demonstrates an IoT application for remote device control. Users can send
commands from their mobile phones to ThingSpeak, which then triggers actions on the
44
Internet of Things(3171108) 210160116018(A1)
connected device. This project highlights the seamless integration of cloud platforms with
hardware components, offering convenience and flexibility for remote control applications.
Additionally, it showcases the potential of IoT technology to enhance connectivity and
automation in everyday devices.
Conclusion:
In conclusion, the project of controlling an LED's ON/OFF state via mobile phone
commands through ThingSpeak cloud integration exemplifies the practical implementation of
IoT technology for remote device control. By leveraging ThingSpeak as an intermediary
platform, users can conveniently issue commands from their mobile phones to control the LED,
demonstrating the seamless integration of cloud platforms with hardware components for
enhanced connectivity and automation.
Quiz:
3. In the HTML code for mobile control, what is the purpose of the "ON" and "OFF" buttons?
Answer:
In the HTML code for mobile control, the "ON" and "OFF" buttons serve the purpose
of controlling the state of the LED connected to the NodeMCU board. When the "ON"
button is clicked, it sends an HTTP request to the NodeMCU server, instructing it to
45
Internet of Things(3171108) 210160116018(A1)
turn on the LED. Similarly, when the "OFF" button is clicked, it sends a request to turn
off the LED. These buttons provide a user-friendly interface for remotely controlling
the LED from a web browser on a mobile device.
4. Which component is responsible for handling HTTP requests and controlling the LED based
on those requests?
Answer:
The NodeMCU board running the server-side code is responsible for handling HTTP
requests and controlling the LED based on those requests. The server-side code
typically listens for incoming HTTP requests, interprets the request parameters (such
as whether to turn the LED on or off), and then takes appropriate action to control the
LED accordingly. This interaction between the NodeMCU board and the client-side
HTML code allows for remote control of the LED via HTTP requests over a local
network or the internet.
References:
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
46
Internet of Things(3171108) 210160116018(A1)
Experiment No: 9
Aim: Controlling Led ON/OFF by giving commands using Google Assistant from a mobile phone. (Use
cloud Adafruit)
Date:
Objectives:
1. To set up an IoT system for controlling an LED using Google Assistant.
2. To integrate a cloud-based platform (Adafruit) into the IoT system for communication.
3. To create an Arduino-based program for controlling the LED.
4. To enable voice commands through Google Assistant for controlling the LED.
5. To provide a seamless user experience by demonstrating the control of the LED via mobile
phone and voice commands.
Components:
1. LED and resistor
2. Arduino or NodeMCU board
3. Google Assistant-enabled mobile phone
4. Adafruit cloud platform
5. Wi-Fi connection
6. Breadboard and connecting wires Configurations:
47
Internet of Things(3171108) 210160116018(A1)
Procedure:
2. After creating an account, you'll be taken to your home screen. Click on "Feeds" from the
menu.
3. Create a new feed by clicking on "New Feed." Name your feed (e.g., "LED_Control"),
provide a description if desired, select "Field 1," and save the channel.
4. Create a new dashboard by going to "Dashboards" from the menu. Give it a name (e.g.,
"LEDSwitch") and create the dashboard.
48
Internet of Things(3171108) 210160116018(A1)
5. Open your new dashboard by clicking on it. Click the blue "+" button to add new UI
components to the dashboard.
6. Add a button to the dashboard by selecting the first option. Choose the feed you created
earlier and keep the default settings.
49
Internet of Things(3171108) 210160116018(A1)
7. During programming, you will require your unique AIO key. Click on the key button at the
right-hand corner of your window to generate your active key for this project.
50
Internet of Things(3171108) 210160116018(A1)
7. Create another applet for turning the LED "OFF" by following the same steps.
8. Both applets will appear under "My Applets" in your account.
51
Internet of Things(3171108) 210160116018(A1)
1. Program your ESP32 using the Arduino IDE. You'll need to include the "Adafruit MQTT"
client library, which can be found by going to "Sketch" > "Include Library" > "Manage
Libraries" and searching for "adafruit mqtt." Install the library.
2. The code provided in the project can be used to connect the ESP32 to Adafruit IO. Modify
the WLAN_SSID, WLAN_PASS, AIO_USERNAME, and AIO_KEY in the code with your
credentials.
3. After modifying the code, upload it to the ESP32.
Code:
#include <WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#define WLAN_SSID "Ashish"
#define WLAN_PASS "12345678"
#define AIO_SERVER "io.adafruit.com"
#define AIO_SERVERPORT 1883
#define AIO_USERNAME "DURGESH_SINGH"
#define AIO_KEY "aio_OQrD206pQvpMfzJhKcPPXBnw79DL" int
output=2;
WiFiClient client; // Create an ESP8266 WiFiClient class to connect to the MQTT
server.
52
Internet of Things(3171108) 210160116018(A1)
}
}
}
void MQTT_connect() {
int8_t ret;
// Stop if already connected.
if (mqtt.connected()) {
return;
53
Internet of Things(3171108) 210160116018(A1)
}
Serial.print("Connecting to MQTT... ");
uint8_t retries = 3;
while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
Serial.println(mqtt.connectErrorString(ret));
Serial.println("Retrying MQTT connection in 5 seconds...");
mqtt.disconnect(); delay(5000); // wait 5 seconds retries-
-; if (retries == 0) {
// basically die and wait for WDT to reset me
while (1);
}
}
Serial.println("MQTT Connected!"); }
4. The ESP32 will connect to Adafruit IO, and you'll be able to control the LED using Google
Assistant via the applets created in IFTTT.
5. After uploading of code open your serial monitor and your serial monitor should look like
this:
6. Now open Google assistant in your Android and give voice command like “Turn LED on”
or “Turn LED off” and it will respond you like you defined earlier and you will observe
change of LED state also.
54
Internet of Things(3171108) 210160116018(A1)
Observation:
Controlling an LED's ON/OFF state via Google Assistant commands from a mobile
phone, facilitated through cloud integration with Adafruit, illustrates the intersection of IoT
with voice-controlled automation. Users can issue voice commands to Google Assistant, which
communicates with Adafruit's cloud platform to trigger actions on the LED. This project
underscores the convergence of cloud services, voice recognition technology, and hardware
control, offering a seamless and intuitive method for remote device management. Additionally,
it showcases the potential of voice-controlled IoT applications for enhancing convenience and
accessibility in smart home environments.
Conclusion:
In conclusion, enabling LED control via Google Assistant commands from a mobile
phone through Adafruit's cloud platform illustrates the seamless integration of IoT with voice-
controlled automation. By leveraging Google Assistant's voice recognition capabilities and
Adafruit's cloud infrastructure, users can effortlessly manage the LED's ON/OFF state
remotely. This project showcases the convenience and accessibility of voice-controlled IoT
applications, highlighting their potential to enhance smart home environments and streamline
everyday tasks.
Quiz:
3. Which service is used to set up voice commands for Google Assistant in this project?
Answer:
The service used to set up voice commands for Google Assistant in this project is likely
the Google Assistant service provided by Adafruit IO. Adafruit IO offers integration
with Google Assistant, allowing users to control IoT devices using voice commands
through Google Assistant-enabled devices such as smartphones, Google Home, or Nest
devices. By setting up appropriate triggers and actions on Adafruit IO, users can interact
55
Internet of Things(3171108) 210160116018(A1)
with their IoT devices using natural language voice commands via Google Assistant.
4. What is the role of the unique AIO key generated in the Adafruit IO setup?
Answer:
The unique AIO (Adafruit IO) key generated in the Adafruit IO setup serves as an
authentication token that grants access to the Adafruit IO platform. This key is used by
the NodeMCU board (or any other IoT device) to authenticate and establish a secure
connection with Adafruit IO servers. It allows the device to publish data to Adafruit IO
feeds, subscribe to feed updates, and interact with other services provided by Adafruit
IO. The AIO key acts as a secure identifier for the specific user and project, ensuring
that only authorized devices can access and interact with the Adafruit IO platform.
References:
Signature
56
Internet of Things(3171108) 210160116018(A1)
Experiment No: 10
Aim: Installing Raspbian OS in Raspberry Pi and performing basic practical like LED on/off.
Date:
Objectives:
Components:
• Raspberry Pi (any model with GPIO pins)
• MicroSD card (for Raspbian OS)
• Power supply for Raspberry Pi
• LED
• Resistor (appropriate value to limit LED current)
• Jumper wires
• Breadboard (optional, for easier circuit connections)
Configuration:
57
Internet of Things(3171108) 210160116018(A1)
Python Code:
import RPi.GPIO as GPIO
from time import sleep
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(8, GPIO.OUT, initial=GPIO.LOW)
while True:
58
Internet of Things(3171108) 210160116018(A1)
Observation:
Conclusion:
Quiz:
59
Internet of Things(3171108) 210160116018(A1)
2. What is the forward voltage (VF) and forward current (IF) of a typical red LED?
Answer:
The forward voltage (VF) and forward current (IF) of a typical red LED can vary
depending on the specific LED model and manufacturer. However, a common forward
voltage for a red LED is around 1.8 to 2.2 volts, and the forward current is typically
around 10 to 20 milliamps (mA). It's important to consult the datasheet of the specific
LED you are using for accurate specifications.
3. In the Raspberry Pi GPIO setup code, what does GPIO.BOARD refer to?
Answer:
In the Raspberry Pi GPIO setup code, GPIO.BOARD refers to the pin numbering
scheme used to identify the GPIO pins on the Raspberry Pi board. With GPIO.BOARD,
the pin numbers used in the code correspond directly to the physical pin numbers on
the Raspberry Pi's GPIO header.
References:
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Signature
60
Internet of Things(3171108) 210160116018(A1)
61