19ece101 Introduction To Iot Laboratory Manual: B. Tech - Electronics and Communication Engineering
19ece101 Introduction To Iot Laboratory Manual: B. Tech - Electronics and Communication Engineering
19ece101 Introduction To Iot Laboratory Manual: B. Tech - Electronics and Communication Engineering
Prepared by
Dr. Vivek Venugopal
Verified by Approved by
Component Marks
Internal Continuous 30
Evaluation
Mid-term Exam 20
Mini Project 20
Record 10
End Semester Exam 20
List of Experiments
1. Introduction and familiarization of Arduino, Ardublock and controlling
switching ON/OFF (blinking) an LED with Arduino controller
2. Interfacing of Arduino controller with Serial Monitor, IR sensor
3. Utilisation of Arduino controller to detect motion using PIR sensor and targets
using Ultrasonic sensor
4. Interfacing Potentiometer and Buzzer witn Arduino controller
5. Interfacing of Arduino with DC Motor and perform direction control and
rotation control.
6. Serial communication and device control using Bluetooth Module and
Arduino controller
7. Serial communication and device control using Wi-Fi Module and Arduino
controller
8. Fabrication and control of Wheeled robot using Arduino Controller and
Bluetooth/Wi-Fi Module
9. Basic App Development using MIT App Inventor and Remote Device Control
Android App Development
10. Assembly, Programming and Flight control of Quadcopter (Demo only)
Aim
Write the aim of the experiment.
Components required
List out the components required for the experiment.
Procedure
Write the steps involved in performing the experiment in a sequential manner.
Circuit Diagram
Draw the circuit diagram of the related experiment (Sample Circuit Diagram for first
experiment (LED interfacing) is shown below)
Table of Contents
Experiment No 1: Introduction and familiarization of Arduino, Ardublock and controlling
switching ON/OFF (blinking) an LED with Arduino controller ............................................... 6
Introduction to Arduino .......................................................................................................... 6
Introduction to Ardublock ...................................................................................................... 9
Experiment No 2: Interfacing of Arduino controller with Serial Monitor, IR sensor ............. 14
Experiment No 3: Utilisation of Arduino controller to detect motion using PIR sensor and
targets using Ultrasonic sensor ................................................................................................ 18
Experiment No 4: Interfacing Potentiometer and Buzzer with Arduino controller ................. 22
Experiment No: 1
Aim
To familiarise with the Arduino Board, Ardublock tool and to perform the following
1. Switching LED ON
2. Switching LED OFF
3. Blinking the LED ON and OFF using delay elements
Components required
Arduino Uno Board, USB power cable
Introduction to Arduino
What is Arduino?
• Arduino is an open source electronics prototyping platform.
• Arduino is used for creating interactive objects:
▪ That can communicate with humans by using sensors and actuators, and
▪ Controlled by software running inside a microcontroller (which is a small
computer on a single chip).
• The Arduino hardware and software is open source.
▪ You can download the Arduino hardware design and build your own (with Arduino as the
starting point).
▪ The Arduino software, known as the Integrated Development Environment (IDE), is
free. You can download it from www.arduino.cc.
• The Arduino IDE is easy-to-use and can run on Windows, Macintosh, and Linux.
Applications of Arduino
• Arduino can be used for rapid prototyping of IoT projects.
• In this lab, you will learn to use Arduino to:
▪ Control LED switch ON/OFF and blinking frequency.
▪ Sensing the surrounding by interfacing with an IR sensor.
▪ Detect a gas by interfacing with a gas sensor.
▪ Control a DC motor.
▪ Measure the distance of an obstacle by interfacing with an ultrasonic sensor.
▪ Transfer data wirelessly by interfacing with a Bluetooth communication
module.
• Arduino is in fact capable of much more.
• Youuse the IDE to create a sketch (a little computer program) that you upload to the
Arduino board.
Introduction to Ardublock
1. Go to C:\Users\<Username>\ Documents\Arduino\
These steps are performed inorder to add ArduBlock Add On into the Tools Tab of
Arduino IDE.
6. Close the Arduino IDE if it is opened.
7. Open Arduino IDE, click on Tools Tab and verify ArduBlock Add On is listed. If
it is not listed, then the ardublock jar file is not pasted in the actual location.
On the left-hand side, you can see many colored blocks such as control, Pins, Tests, Generic
hardware, and so on. Each of these blocks contains many sub-blocks which can be dragged
onto the right-side working area. Once the necessary blocks required for the implementation
are done, click on Upload to Arduino and the corresponding code for the blocks inserted
will be generated in Arduino IDE.
The Arduino program will start Compiling, followed by Uploading. If the COM Port is not
selected properly, the following error will be displayed.
So Click on Tools Menu, Click Port and Select the correct COM Port (Eg. COM6) where
the board is connected.
Identify COM Port to which Arduino is connected
Click on Tools Menu in Arduino IDE, Click Port and Select the correct COM Port
(Eg. COM6)
Click on Upload to Arduino Button in ArduBlock IDE once again. Then Arduino
IDE will be activated, Compiling followed by Uploading will be performed. Once the Upload
is completed, Done Uploading message will be displayed in output window of Arduino IDE.
Procedure
1. For Turning LED ON
• Open ArduBlock
• Go to Digital Pins tab, drag Set Digital Pin # block into the working area
• Once inserted in the working area change the pin number to D13 and ensure
that the pin is in HIGH state in the block.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• Open ArduBlock
• Go to Digital Pins tab, drag Set Digital Pin # block into the working area
• Once inserted in the working area change the pin number to D13 and ensure
that the pin is in LOW state in the block.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• Open ArduBlock
• Go to Digital Pins tab, drag Toggle Digital Pin # block into the working area
• Once inserted in the working area change the pin number to D13
• Go to Generic Hardware tab, drag Delay Millis block into the working area
and place it below the Toggle Digital Pin # block.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
Circuit Diagram
Draw the circuit diagram of the related experiment
ArduBlock Model
1. Switching LED ON
Experiment No: 2
Aim
To interface the Arduino Board with Serial monitor and IR sensor and perform the following
1. Printing “Hello World” message on the Serial monitor
2. Interfacing Arduino Board with IR sensor and display the sensor value
3. Conditional Turning ON of LED based on IR sensor value
Components required
Arduino Uno Board, USB power cable, IR sensor
Procedure
• Open ArduBlock
• Go to Communication tab, drag Serial Print block into the working area
• Once inserted in the working area change the message to Hello World!!! and
ensure that the newline is in True state in the block.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• For viewing the message click on the Serial Monitor button on the top right
corner
• Open ArduBlock
• Go to Communication tab, drag Serial Print block into the working area
• Once inserted in the working area change the message to IR sensor value is
and ensure that the newline is in True state in the block.
• From the communication tab, add a Glue block which has a square notch on
one side and a curved corner in the other end. This is required to add the next
block (Digital pin block)
• After the Glue block, add a Digital Pin # block from the Pins tab. Make sure
that the Pin number is D2.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• For viewing the message click on the Serial Monitor button on the top right
corner
• Open ArduBlock
• Go to Control tab, drag if/else block into the working area. Once inserted in
the working area, add a Digital Pin # block from the Pins tab right next to the
test tab. Make sure that the Pin number is D2.
• Go to Digital Pins tab, drag Set Digital Pin # block into the working area and
place it next to then tab inside if/else block. Once inserted in the working area
change the pin number to D13 and ensure that the pin is in HIGH state in the
block.
• Go to Digital Pins tab, drag Set Digital Pin # block into the working area and
place it next to else tab inside if/else block. Once inserted in the working area
change the pin number to D13 and ensure that the pin is in LOW state in the
block.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
Circuit Diagram
ArduBlock Model
Experiment No: 3
Utilisation of Arduino controller to detect motion using PIR sensor and targets using
Ultrasonic sensor
Aim
To interface the Arduino Board with PIR sensor and Ultrasonic sensor and perform the
following
1. Detecting motion using the PIR sensor.
2. Calculate the distance of the obstacle from the Arduino board using Ultrasonic sensor.
Components required
Arduino Uno Board, USB power cable, PIR sensor, Ultrasonic sensor
Procedure
1. For detecting motion using PIR sensor
• Open ArduBlock
• Go to Communication tab, drag Serial Print block into the working area
• Once inserted in the working area change the message block to Human
Present?? and ensure that the newline is in True state in the block.
• From the communication tab, add a Glue block which has a square notch on
one side and a curved notch in the other end. This is required to add the next
block (Digital pin block)
• After the Glue block, add a Digital Pin # block from the Pins tab. Make sure
that the pin value is set to D2.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• For viewing the message click on the Serial Monitor button on the top right
corner
• Open ArduBlock
• Go to Communication tab, drag Serial Print block into the working area
• Once inserted in the working area remove the message block and ensure that
the newline is in True state in the block.
• From the communication tab, add a Glue block which has a square notch on
one side and a rotated V shaped notch in the other end. This is required to add
the next block (ultrasonic block)
• After the Glue block, add a Ultrasonic block from the Pins tab. Make sure
that the Trigger is set to D2 and Echo to D3 pins.
• Go to Generic Hardware tab, drag Delay Millis block into the working area
and place it below the Serial Print block and set the delay to 1000 ms.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• For viewing the message click on the Serial Monitor button on the top right
corner
Circuit Diagram
2. For detecting distance of obstacle from Arduino board using Ultrasonic sensor
ArduBlock Model
2. For calculating distance of obstacle from Arduino board using ultrasonic sensor
2. For calculating distance of obstacle from Arduino board using ultrasonic sensor
The code snippet before the setup and loop essentially declares the ultrasonic sensor
and the sensor sends a pulse of 20 microseconds duration through the trigger pin. The
duration variable denotes the time difference between the transmitted pulse and the
pulse generated by echo pin after reception. The speed of sound is 343 m/s or
approximately 0.0343 cm/μs (1/29.1545). The duration variable gives the time for the
wave to go and come back therefore the distance in cm is half of duration value
multiplied by speed in cm/μs. The ultrasonic sensor can only calculate distances
between 2 cm and 300 cm in this code.
Experiment No: 4
Interfacing Potentiometer and Buzzer with Arduino controller
Aim
To interface the Arduino Board with Buzzer and Potentiometer and perform the following
1. Reading of voltage value from Potentiometer.
2. Vary the ON time and OFF time of the LED using Potentiometer.
3. Implementation of voltage divider using Potentiometer
4. Interfacing of Arduino board with Buzzer
Components required
Arduino Uno Board, USB power cable, Buzzer, Potentiometer
Procedure
• Open ArduBlock
• Go to Communication tab, drag Serial Print block into the working area
• Once inserted in the working area change the message block to Pot Value and
ensure that the newline is in True state in the block.
• From the communication tab, add a Glue block which has a square notch on
one side and rotated V shaped notch in the other end. This is required to add
the next block (Analog pin block)
• After the Glue block, add a Analog Pin # block from the Pins tab. Make sure
that the pin value is set to A0.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• For viewing the message click on the Serial Monitor button on the top right
corner
• Open ArduBlock
• Go to Variables/Constants tab, drag Set integer variable block into the
working area
• Once inserted in the working area change the variable block to Pot Value and
value as Analog Pin A0 after inserting Analog Pin # block from Pins tab.
• From the pins tab, add a Toggle Digital Pin block. Make sure that the pin
value is set to D13.
• After the Toggle Digital Pin block, add a Delay Millis block from the
Generic Hardware tab. Make sure that the delay value is set to Pot Value.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• Add a Delay Millis block from the Generic Hardware tab. Make sure that the
delay value is set to 1000.
• Go to Digital Pins tab, drag Set Digital Pin # block into the working area and
place it next to else tab inside if/else block. Once inserted in the working area
change the pin number to D8 and ensure that the pin is in LOW state in the
block.
• Add another Set Digital Pin # block into the working area and place it next to
else tab inside if/else block after the previous Set Digital Pin #. Once inserted
in the working area change the pin number to D9 and ensure that the pin is in
HIGH state in the block.
• Add a Delay Millis block from the Generic Hardware tab. Make sure that the
delay value is set to 1000.
• Click on Upload to Arduino and run the code by first clicking on the Verify
button and then Upload button in Arduino IDE.
• For viewing the message click on the Serial Monitor button on the top right
corner
4. Interfacing Arduino with Buzzer
• Open ArduBlock
• From the Pins tab, select Tone block with pin#, frequency and milliseconds
tab. Change the pin number to D9, frequency to 1000 and delay to 1000.
• From the Pins tab, select No tone block. Make sure that the pin number is D9.
• Add a Delay Millis block from the Generic Hardware tab. Make sure that the
delay value is set to 1000.
Circuit Diagram
1. For reading voltage and varying the ON and OFF time of LED
ArduBlock Model