IIOT Lab Manual Final
IIOT Lab Manual Final
IIPC 208
IOT Lab
Bachelor of Technology
in
Industrial Internet of Things
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.
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.
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.
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:
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:
7
Arduino UNO Features and Technical Specs
12 EEPROM 1 KB
13 ICSP Header Yes
14 Power sources DC Power Jack & USB Port
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).
• External Interrupts. Pin 2 and 3 are used for providing external interrupts. An interrupt is called
by providing LOW or changing value.
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.
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
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 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.
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: -
Step1 :-
Click on I Agree
13
Step2 :-
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
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.
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:-
void setup()
{
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output
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