0% found this document useful (0 votes)
38 views

IIOT Lab Manual Final

Uploaded by

vavilalamahsh76
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)
38 views

IIOT Lab Manual Final

Uploaded by

vavilalamahsh76
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/ 21

Lab Manual

IIPC 208
IOT Lab

Bachelor of Technology
in
Industrial Internet of Things

Department of Electronics & Communication Engineering


National Institute of Technology
Kurukshetra-136119
VISION

The Department of Electronics & Communication Engineering shall strive to impart state-of-the-
art Electronics and Communication Engineering Education and Research responsive to global
challenges.

MISSION

1) To prepare students with strong theoretical and practical knowledge by imparting quality
education.
2) To produce comprehensively trained and innovative graduates in Electronics and
Communication Engineering through hands on practice and research to encourage them for
entrepreneurship.
3) To inculcate team work spirit and professional ethics in students.

2
Programme Educational Objectives (PEOs)
The graduates of the Electronics and Communication Engineering Program will:
1. Have a lead and successful role in their professional career.
2. Be able to analyze real life problems and design socially accepted and economically viable
solutions in Electronics and Communication Engineering area.
3. Be capable of lifelong learning and professional development by pursuing higher education
and participation in research and development activities.
4. Have appropriate human and technical communication skills to be a good team-
member/leaders and responsible human being.

Programme Outcomes (POs)


After successful completion of B. Tech. (Electronics & Communication Engineering) program,
the student will be able to:
1. Apply knowledge of Mathematics, Science and Engineering to solve technical problems in
the domain of Electronics and Communication Engineering.
2. Identify, formulate, review research literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of mathematics, natural sciences,
and engineering sciences.
3. Design solutions for complex engineering problems and design system components or
processes that meet the specified needs with appropriate consideration for the public health
and safety, and the cultural, societal, and environmental considerations.
4. Use research-based knowledge and methods including design of experiments, analysis and
interpretation of data, and synthesis of the information to provide valid conclusion.
5. Create, select, and apply appropriate techniques, resources, and modern engineering and
IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
6. Apply reasoning informed by the contextual knowledge to assess societal, health, safety,
legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
7. Understand the impact of the professional engineering solutions in societal and
environmental contexts, demonstrate the knowledge of, and need for sustainable
development.
8. Apply ethical principles and commit to professional ethics, responsibilities, and norms of
theengineering practice.
9. Function effectively as an individual, and as a member or leader in diverse teams, and in
multidisciplinary settings.

3
10. Communicate effectively on complex engineering activities with the engineering
community and with society, such as, being able to comprehend and write effective reports
and design documentation, make effective presentations, and give and receive clear
instructions.

11. Demonstrate knowledge and understanding of the engineering and management principles
and apply these to one’s own work, as a member and leader in a team, to manage projects
and in multidisciplinary environments.
12. Recognize the need for, and have the preparation and ability to engage in independent and
life-long learning in the broadest context of technological change.

4
IIPC 208
IOT LAB

L T P

0 0 2

Course At the end of the course, students will be able to Choose the sensors and
Objectives
actuators for an IoT application, Experiment with embedded boards for creating
IoT prototypes and design a solution for a given IoT application.

Course At the end of the course, the students will be able to:
Outcomes CO1: Understand the concept of Internet of Things.
CO2: Understand the data acquisition from various sensors.
CO3: Implement interfacing of various sensors with Arduino/Raspberry Pi.
CO4: Apply IoT concept in simple real-life applications.

5
List of Experiments
1. Familiarization with development board (Arduino/ Raspberry Pi etc..) and perform
necessary software installation

2. To interface LED/Buzzer with Development board (Arduino/ Raspberry Pi etc..,) and write
a program to turn ON LED for 1 sec after every 2 seconds.

3. To interface Push button/Digital sensor (IR/LDR) with Development board


(Arduino/Raspberry Pi etc..,) and write a program to turn ON LED when push button is pressed
or at sensor detection.

4. To interface DHT11 sensor with Development board (Arduino/ Raspberry Pi etc..,) and write
a program to print temperature and humidity readings.

5. To interface motor using relay with Development board (Arduino/ Raspberry Pi etc..,) and
write a program to turn ON motor when push button is pressed.

6. To interface OLED with Development board (Arduino/ Raspberry Pi etc..,) and write a
program to print temperature and humidity readings on it.

7. To interface Bluetooth with Development board (Arduino/ Raspberry Pi etc..,) and write a
program to send sensor data to smartphone using Bluetooth.

8. To interface Bluetooth with Development board (Arduino/ Raspberry Pi etc..,) and write a
program to turn LED ON/OFF when ‘1’/’0’ is received from smartphone using Bluetooth.

9. Building Intrusion Detection System with Development board (Arduino/Raspberry Pi etc..,)


Development Board and Ultrasonic Sensor.

10. . Modules and Sensors Interfacing (Relay, RGB LED) using Development board
(Arduino/Raspberry Pi etc..,).

6
EXPERIMENT NO-1

Objective: Familiarization with development board Arduino and perform necessary software
installation.

Theory:

Introduction to IoT Device:-

1 Arduino
It is a microcontroller board developed by Arduino.cc and is based on Atmega328
Microcontroller. The first Arduino project was started in Interaction Design Institute Ivrea in 2003
by David Cuartielles and Massimo Banzi with the intention of providing a cheap and flexible way
for students and professionals to learn embedded programming.

Arduino UNO is a very valuable addition in electronics that consists of a USB interface,
14 digital I/O pins(of which 6 Pins are used for PWM), 6 analog pins and an Atmega328
microcontroller. It also supports 3 communication protocols named Serial, I2C and SPI protocol.

• Few main features of Arduino UNO are shown in the below figure:

Arduino UNO Features and Technical Specs


No. Parameter Name Parameter Value
1 Microcontroller Atmega328
2 Crystal Oscillator 16MHz
3 Operating Voltage 5V
4 Input Voltage 5-12V
5 Digital I/O Pins 14 (D0 to D13)
6 Analog I/O Pins 6 (A0 to A5)
7 PWM Pins 6 (Pin # 3, 5, 6, 9, 10 and 11)
8 Power Pins 5V, 3.3V, Vin, GND
9 Communication UART(1), SPI(1), I2C(1)
10 Flash Memory 32 KB (0.5KB is used by bootloader)
11 SRAM 2 KB

7
Arduino UNO Features and Technical Specs
12 EEPROM 1 KB
13 ICSP Header Yes
14 Power sources DC Power Jack & USB Port

Arduino UNO pin description: -

There are several I/O digital and analog pins placed on the board which operates at 5V. These pins
come with standard operating ratings ranging between 20mA to 40mA. Internal pull-up resistors
are used in the board that limits the current exceeding the given operating conditions. However,
too much increase in current makes these resisters useless and damages the device.

• LED. Arduino Uno comes with a built-in LED which is connected through pin 13. Providing
HIGH value to the pin will turn it ON and LOW will turn it OFF.

8
• Vin. It is the input voltage provided to the Arduino Board. It is different than 5 V supplied
through a USB port. This pin is used to supply voltage. If a voltage is provided through a power
jack, it can be accessed through this pin.

• 5V. This board comes with the ability to provide voltage regulation. 5V pin is used to provide
output regulated voltage. The board is powered up using three ways i.e. USB, Vin pin of the
board or DC power jack.

• USB supports voltage around 5V while Vin and Power Jack support a voltage ranges between
7V to 20V. It is recommended to operate the board on 5V. It is important to note that, if a voltage
is supplied through 5V or 3.3V pins, they result in bypassing the voltage regulator that can
damage the board if the voltage surpasses its limit.

• GND. These are ground pins. More than one ground pins are provided on the board which can
be used as per requirement.

• Reset. This pin is incorporated on the board which resets the program running on the board.
Instead of physical reset on the board, IDE comes with a feature of resetting the board through
programming.

• IOREF. This pin is very useful for providing voltage reference to the board. A shield is used to
read the voltage across this pin which then selects the proper power source.

• PWM. PWM is provided by 3, 5, 6, 9, 10,11pins. These pins are configured to provide 8-bit
output PWM.

• SPI. It is known as Serial Peripheral Interface. Four pins 10(SS), 11(MOSI), 12(MISO), 13(SCK)
provide SPI communication with the help of the SPI library.

• AREF. It is called Analog Reference. This pin is used for providing a reference voltage to the
analog inputs.

• TWI. It is called Two-wire Interface. TWI communication is accessed through Wire Library. A4
and A5 pins are used for this purpose.

• Serial Communication. Serial communication is carried out through two pins called Pin 0 (Rx)
and Pin 1 (Tx).

• Rx pin is used to receive data while Tx pin is used to transmit data.

• External Interrupts. Pin 2 and 3 are used for providing external interrupts. An interrupt is called
by providing LOW or changing value.

Communication and Programming

Arduino Uno comes with the ability of interfacing with other Arduino boards, microcontrollers
and computers. The Atmega328 placed on the board provides serial communication using pins like

9
Rx and Tx. The Atmega16U2 incorporated on the board provides a pathway for serial
communication using USB com drivers. A serial monitor is provided on the IDE software which
is used to send or receive text data from the board. If LEDs placed on the Rx and Tx pins will
flash, they indicate the transmission of data. Arduino Uno is programmed using Arduino Software
which is a cross-platform application called IDE written in Java. The AVR microcontroller
Atmega328 laid out on the base comes with built-in bootloader that sets you free from using a
separate burner to upload the program on the board.

2. MOTER
The motor is used to control the flow of water from a water source (such as a reservoir or irrigation system) to the
crops. It is typically a DC motor that can be turned on or off to start or stop the water flow. The motor is connected to
a relay, which acts as a switch controlled by the Node MCU. When the Node MCU determines that irrigation is
required based on the soil moisture sensor readings, it activates the relay, which in turn powers the motor to start the
water flow. Similarly, when irrigation is no longer needed, the Node MCU deactivates the relay, stopping the motor
and halting the water flow.
3. RELAY
A relay is an electrically operated switch in the context of electronics and electrical engineering. It is made up of a
coil and one or more contact sets. When an electrical current runs through the coil, a magnetic field is created that
activates the contacts, allowing them to open or close the circuits. Relays are frequently employed in automotive
applications, industrial automation, and control systems to control high-power or high-voltage devices with a lower-
power signal.

Figure 2. Moter Figure 3: Relay

4. Push-Button
A push button is a type of switch that is activated by pressing it. It is commonly used in electronic devices, control
panels, and other applications where a user needs to initiate an action or give a command. Push buttons come in
different sizes, shapes, and colors, and can be designed to be momentary (meaning they only stay in the on position
as long as they are being pressed) or latching (meaning they stay in the on position after being pressed until they are
pressed again to turn off). They can also be illuminated or non-illuminated. They can be used to control the relay
which can then control the 5V DC motor as well as other electronic devices.

10
Figure 4. Push_Button

5. Node MCU (ESP8266-based microcontroller)


Node MCU is an open-source firmware and development kit that enables easy prototyping of IoT (Internet of Things)
projects as shown on figure 5. It is based on the ESP8266 Wi-Fi module, which provides both processing power and
Wi-Fi connectivity. Node MCU is programmed using the Arduino IDE or Lua scripting language, making it
accessible to a wide range of developers.
The NodeMCU is a versatile development board widely utilized in the realm of Internet of Things (IoT) projects. It is
built upon the ESP8266 Wi-Fi module, offering a compact yet powerful platform for prototyping and deploying IoT
applications. The board integrates a microcontroller unit (MCU) compatible with the Arduino Integrated Development
Environment (IDE), simplifying the development process for both beginners and experienced developers. One of its
key features is the inclusion of built-in Wi-Fi connectivity, allowing seamless communication with other devices and
the internet. Additionally, the NodeMCU provides a range of General Purpose Input/Output (GPIO) pins, enabling
interfacing with various sensors, actuators, and peripheral devices. Its USB connectivity facilitates convenient power
supply and programming, streamlining the development workflow. With its affordability, ease of use, and robust
community support, the NodeMCU has become a preferred choice for IoT enthusiasts and professionals alike, enabling
the rapid prototyping and deployment of innovative IoT solutions across diverse domains. Figure 3.1 showing the pin
diagram of NodeMCU Board.

Figure 5. Node MCU Pin Diagram

6. DHT11 Sensor
The DHT11(shown in figure 6) is a simple, digital temperature and humidity sensor. It uses a capacitive humidity
sensor and a thermistor to measure the surrounding temperature and humidity and gives out a digital signal on the data
pin. It is very simple to use but it requires careful timing to grab data. The only real downside of this sensor is that we
can only get new data from it every 2 seconds, so when using the library, sensor readings can be up to 2 second delay.

11
The sensor is designed to receive the commands through a microcontroller either Arduino or Node MCU and give
back serial data output. We can program it to give the data in degree Celsius or degree Fahrenheit.

Figure 6. DHT11 Sensor

7.IR Sensors (Infrared Sensors)


IR sensors detect infrared radiation emitted or reflected by objects, enabling proximity sensing, motion detection, and
object tracking in various applications such as automated systems, security devices, and smart home appliances as
shown in figure 7. They offer fast response times, cost-effectiveness, and non-contact sensing capabilities but may be
susceptible to environmental factors and have limited detection ranges.

Figure 7. IR Sensor
Figure 8. Buzzer

8. Buzzer
Provides audible feedback to indicate entry and exit events. It is connected to digital pin of the Arduino board. It is
shown in figure 8.
9. LEDs (Light Emitting Diodes)
Controlled by the Arduino to adjust the lighting based on detected entry and exit. These are connected to digital pin
of the Arduino board.

10. Soil Moisture Sensor


The soil moisture sensor typically consists of two electrodes that measure the electrical conductivity of the soil as
shown in figure 10. As the soil moisture content changes, the conductivity between the electrodes varies, allowing the
sensor to detect moisture levels. The sensor outputs an analog voltage proportional to the soil moisture, which is read
by the Node MCU's analog-to-digital converter (ADC).

12
Figure 10. Soil Moisture Sensor

11.Power Supply
The system requires a stable power supply to operate reliably. The Node MCU, soil moisture sensor, relay, and motor
all require appropriate voltage levels and current capacities. A power source such as a battery, solar panel, or mains
power supply can be used, depending on the specific application and environmental conditions.

Software Installation: -

Download software from https://www.arduino.cc/en/software and follow these steps:-

Step1 :-

Click on I Agree

13
Step2 :-

Select only for me and click on next


Step 3:-

Provide destination folder and click on Install

14
Step 4:-

Step5:-

Click on finish.
Now installation process is completed and we are able to use ARDUNIO IDE setup.

15
Software Installation for Raspberry Pi

1. Download Raspberry Pi Imager:


o Visit the Raspberry Pi website to download the Imager tool.
2. Prepare SD Card:
o Insert the SD card into your computer.
o Use the Imager to install Raspberry Pi OS on the SD card. This tool will format the SD card and
copy the necessary files.
3. Set Up Raspberry Pi:
o Insert the SD card into the Raspberry Pi.
o Connect the peripherals (monitor, keyboard, mouse).
o Power on the Raspberry Pi. The device should boot into the Raspberry Pi OS.

5. Results:
1. Successful installation of Arduino IDE
2. Successful installation of Raspberry Pi OS and completion of the initial setup.
6. Observations:
1. Both development boards were set up successfully and are ready for further experimentation.
2. The initial setup confirms the Raspberry Pi is ready for use.

7. Precautions:
Power Supply: Ensure stable power supply to all components to prevent system failures.
Calibration: Proper calibration is essential to ensure that the system accurately responds to soil moisture levels.
Maintenance: Regular maintenance is required to keep the system functioning optimally, including sensor calibration
and checking for any hardware issues.
Ensure the correct drivers are installed for the Arduino board if the IDE does not recognize it.

Use a reliable power supply for the Raspberry Pi to prevent power-related issues.

Handle the boards carefully to avoid physical damage.

16
EXPERIMENT NO-2

Objective: To interface LED with Arduino UNO and write a program to turn ON LED for 1 sec after every 2
seconds.

Apparatus Required:-
ARDUINO UNO, Resistance 330 ohm, LED, Bread board, Connecting wires, Power Supply

Theory:-
An LED is a simple diode that emits light in a forward bias. When a voltage is given to a PN Junction
Diode, electrons, and holes recombine in the PN Junction and release energy in the form of light
(Photons). An LED’s electrical sign is comparable to that of a PN Junction Diode. When free electrons
in the conduction band recombine with holes in the valence band in forward bias, energy is released in
the form of light. The Arduino UNO is built around the ATmega328P microcontroller and is widely
regarded as user-friendly when compared to other boards, such as the Arduino Mega. It is equipped with
various components including 6 analog pin inputs, 14 digital pins, a USB connector, a power jack, and an
ICSP (In-Circuit Serial Programming) header as shown in figure 1. Due to its popularity and standardized
form factor, the Arduino UNO is one of the most commonly used boards among the available Arduino
options. It is particularly recommended for beginners due to its ease of use and beginner-friendly features.

Program:-

void setup()
{
pinMode(LED_BUILTIN, OUTPUT); // initialize digital pin LED_BUILTIN as an output.

void loop() // the loop function runs over and over again forever
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on
delay(1000); // wait for a second

digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for two second
}

17
Connection Diagram:-

Procedure:
1. Open ARDUINO IDE setup.
2. Write program.
3. Select board Arduino uno.
4. Click on verify icon.
5. Now upload program into arduino.
6. Make connection as per circuit diagram.

Results:
This setup allows you to control both the LED and the buzzer, turning them on for 1 second and off for 2 seconds
in a continuous loop.
Observations:
1. By following this guide, users can turn on LED for 1sec and turn off LED 2 sec.
2. This project provides a practical example of IoT application development.
Precautions:
Power Supply: Ensure stable power supply to all components to prevent system failures.
Calibration: Proper calibration is essential to ensure that the system accurately responds to soil moisture levels.
Maintenance: Regular maintenance is required to keep the system functioning optimally, including sensor calibration
and checking for any hardware issues.

18
EXPERIMENT NO-3
Objective: To interface Push button with Arduino UNO and write a program to turn ON LED when push button is
pressed.

Apparatus Required:-
ARDUINO UNO, Resistance 330 ohm, LED, Push button, Bread board, Connecting wires.

Program:-

const int buttonPin = 2; // the number of the pushbutton pin

const int ledPin = 13; // the number of the LED pin

// variables will change:


int buttonState = 0; // variable for reading the pushbutton status

void setup()
{
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output

pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input:


}

void loop()
{
buttonState = digitalRead(buttonPin); // read the state of the pushbutton value:

if (buttonState == HIGH) // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
{
digitalWrite(ledPin, HIGH); // turn LED on

}
else
{
digitalWrite(ledPin, LOW); // turn LED off:

}
}

19
Connection Diagram:-

Procedure:
1. Open ARDUINO IDE setup.
2. Write program.
3. Select board Arduino uno.
4. Click on verify icon.
5. Now upload program into arduino.
6.Make connection as per circuit diagram.

Results:
1. The LED turns on when the push button is pressed.
2. The LED turns on when the sensor detects an object.
Observations:
1. The LED responds immediately to the press of the push button or the detection by the sensor.
2. The LED remains on as long as the button is pressed or the sensor detects an object.
7. Precautions:
Power Supply: Ensure stable power supply to all components to prevent system failures.
Calibration: Proper calibration is essential to ensure that the system accurately responds to soil moisture levels.
Maintenance: Regular maintenance is required to keep the system functioning optimally, including sensor calibration
and checking for any hardware issues.

20
EXPERIMENT NO-4
Objective:-To interface DHT11 sensor with Arduino and write a program to print temperature and humidity
readings.

Apparatus Required:- ARDUINO UNO, DHT 11 sensor, Bread board, Connecting wires.

Theory: The integration of Internet of Things (IoT) technologies has revolutionized the way we interact with our
surroundings, enabling seamless communication and control of physical devices over the internet. In this
context, the Node MCU microcontroller board, powered by the versatile ESP8266 chip, has emerged as a
popular platform for developing IoT solutions. In this project, we aim to harness the capabilities of Node
MCU to create a TCP/IP based server for real-time monitoring of environmental data using the DHT11
sensor. By leveraging the Wi-Fi connectivity of Node MCU and the simplicity of the DHT11 sensor, we
can establish a robust system capable of remotely capturing and transmitting temperature and humidity
data. This project not only showcases the practical implementation of IoT concepts but also demonstrates
the potential for creating innovative solutions for monitoring and controlling physical environments over
the internet. Through this endeavour, we seek to empower enthusiasts and developers to explore the vast
possibilities of IoT applications using readily available hardware and software resources. With the rapid
proliferation of IoT technology, the project serves as a foundational step towards building smarter and more
connected ecosystems, paving the way for a more efficient and sustainable future.

21

You might also like