7CS4-21 IoT Lab Manual
7CS4-21 IoT Lab Manual
LAB MANUAL
Internet of Things Lab (7CS4-21)
VERSION 1.0
AUTHOR / REVIEWED
APPROVED BY
OWNER BY
Dr. Pankaj
Dadheech,
NAME Dr. Sarabjeet Singh, Prof. (Dr.) Mukesh Kumar
Dr. Vinay Kanungo
Dr. Yogendra Gupta, Gupta
Dr. Nilam
Choudhary
Associate Professor/
DESIGNATION Associate Professor HOD (CSE)
Assistant Professor
SIGNATURE &
REVIEW DATE
SIGNATURE &
REVIEW DATE
SIGNATURE &
REVIEW DATE
DO’s:
Enter the lab on time and leave at proper time.
Wait for the previous class to leave before the next class enters.
Keep the bag outside in the respective racks.
Turn off the machine before leaving the lab.
Leave the labs at least as nice as you found them.
If you notice a problem with a piece of equipment (e.g. a computer doesn't respond) or the room
in general (e.g. cooling, heating, lighting) please report it to lab assistant immediately.
Please be considerate of those around you, especially in terms of noise level. While labs are a
natural place for conversations of all types, kindly keep the volume turned down.
DONT’S:
Do not misuse the equipment.
Do not adjust the heat or air conditioners. If you feel the temperature is not properly set, inform
lab staff; we will attempt to maintain a balance that is healthy for people and machines.
Do not attempt to reboot the computer. Report the problems to lab assistant.
Do not remove or modify any software or file without permission.
Do not remove printers and machines from the network without the permission of lab assistant.
Do not monopolize equipment. If you're going to be away from your machine for more than 10 or
15 minutes, log out before leaving. This is both for the security of your account, and to ensure that
others are able to use the lab resources while you are not.
Do not download or upload of MP3, JPG or MPEG files.
Playing games is not allowed in the lab.
No hardware including USB drives can be connected or disconnected in the labs without prior
permission of the lab assistant.
Eatables are not allowed in the lab.
Lab Manual (IOT Lab) SKIT, Ramnagaria, Jagatpura, Jaipur
Don’t bring the mobile phones in the lab. If necessary then keep them in silence mode.
INSTRUCTIONS
Marking/Assessment System
Total Marks -100
Distribution of Marks - 60 (Sessional)
Attendance File Work Performance Viva Total
10 10 30 10 60
The student should have hands on experience in using various sensors like temperature,
humidity, smoke, light, etc. and should be able to use control web camera, network, and
relays connected to the Pi.
List of Experiments
1. Start Raspberry Pi and try various Linux commands in command terminal window:
ls, cd, touch, mv, rm, man, mkdir, rmdir, tar, gzip, cat, more, less, ps, sudo, cron, chown,
chgrp, ping etc.
2. Write Run some python programs on Pi like:
a) Read your name and print Hello message with name
b) Read two numbers and print their sum, difference, product and division.
c) Word and character count of a given string.
d) Area of a given shape (rectangle, triangle and circle) reading shape and appropriate
values from standard input.
Beyond Syllabus:
Lab Manual (IOT Lab) SKIT, Ramnagaria, Jagatpura, Jaipur
1.Design a system using Arduino to monitor Soil Moisture of a plant on an IDE. If soil
moisture is less, then LED should glow.
2.Design a system using Arduino that blinks an LED when you detect a motion in an area on
an IDE.
3.Motion detection and blinking the light when the light intensity is low using Arduino.
INDEX
Lab Manual (IOT Lab) SKIT, Ramnagaria, Jagatpura, Jaipur
3 Experiment No 1 20
4 Experiment No 2 26
5 Experiment No 3 30
6 Experiment No 4 33
7 Experiment No 5 35
8 Experiment No 6 37
9 Experiment No 7 38
10 Experiment No 8 42
11 Experiment No 9 44
12 Experiment No 10 47
13 Experiment No 11 52
14 Experiment No 12 55
15 Beyond Syllabus 58
20 Viva Questions 64
21 References 80
SKIT, Ramnagaria, Jagatpura, Jaipur
LAB PLAN
10
SKIT, Ramnagaria, Jagatpura, Jaipur
The objective of this course is to impart necessary and practical knowledge of components of
Internet of Things and develop skills required to build real-life IoT based projects.
To introduce the terminology, technology and its applications.
To introduce the concept of M2M (machine to machine) with necessary protocols.
To introduce the Python Scripting Language which is used in many IoT devices.
To introduce the Raspberry PI platform, that is widely used in IoT applications.
To introduce the implementation of web based services on IoT devices.
Course Outcomes
7CS4-01.2 Explain and realize the revolution of Internet in Mobile Devices, Cloud & Sensor
Networks
7CS4-01.3 Discuss the architecture, operation, and business benefits of an IoT solution
7CS4-01.4 Examine the potential business opportunities that IoT can uncover
7CS4-01.5 Explore the relationship between IoT, cloud computing, and big data and Identify how
IoT differs from traditional data collection systems
11
SKIT, Ramnagaria, Jagatpura, Jaipur
Arduino
Arduino boards are able to read analog or digital input signals from different sensors and turn
it into an output such as activating a motor, turning LED on/off, connect to the cloud and
many other actions.
You can control your board functions by sending a set of instructions to the microcontroller
on the board via Arduino IDE (referred to as uploading software).
Unlike most previous programmable circuit boards, Arduino does not need an extra piece of
hardware (called a programmer) in order to load a new code onto the board.
Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to
program.
Finally, Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package.
Board Types:
Various kinds of Arduino boards are available depending on different microcontrollers used.
However, all Arduino boards have one thing in common: they are programmed through the
Arduino IDE. The differences are based on the number of inputs and outputs (the number of
sensors, LEDs, and buttons you can use on a single board), speed, operating voltage, form factor
etc. Some boards are designed to be embedded and have no programming interface (hardware),
which you would need to buy separately. Some can run directly from a 3.7V battery, others need
at least 5V. Here is a list of different Arduino boards available.
12
SKIT, Ramnagaria, Jagatpura, Jaipur
The Arduino UNO board is used because it is the most popular board in the Arduino board
family. In addition, it is the best board to get started with electronics and coding. Some boards
look a bit different from the one given below, but most Arduinos have majority of these
components in common.
1. Power USB: Arduino board can be powered by using the USB cable from your computer.
All you need to do is connect the USB cable to the USB connection (1).
2. Power (Barrel Jack): Arduino boards can be powered directly from the AC mains power
supply by connecting it to the Barrel Jack (2).
3. Voltage Regulator: The function of the voltage regulator is to control the voltage given to
the Arduino board and stabilize the DC voltages used by the processor and other elements.
4. Crystal Oscillator: The crystal oscillator helps Arduino in dealing with time issues. How
does Arduino calculate time? The answer is, by using the crystal oscillator. The number
printed on top of the Arduino crystal is 16.000H9H. It tells us that the frequency is
16,000,000 Hertz or 16 MHz.
13
SKIT, Ramnagaria, Jagatpura, Jaipur
5. Arduino Reset: Reset the Arduino board, i.e., start the program from the beginning. The
UNO board can be reset in two ways. First, by using the reset button (17) on the board.
Second, connect an external reset button to the Arduino pin labelled RESET (5).
6. Pins (3.3, 5, GND, Vin): 3.3V (6) − Supply 3.3 output volt, 5V (7) − Supply 5 output volt.
Most of the components used with Arduino board works fine with 3.3 volt and 5 volt. GND
(8)(Ground) − There are several GND pins on the Arduino, any of which can be used to
ground your circuit. Vin (9) − This pin also can be used to power the Arduino board from an
external power source, like AC mains power supply.
7. Analog pins: The Arduino UNO board has six analog input pins A0 through A5. These pins
can read the signal from an analog sensor like the humidity sensor or temperature sensor and
convert it into a digital value that can be read by the microprocessor.
8. Main microcontroller: Each Arduino board has its own microcontroller (11). You can
assume it as the brain of your board. The main IC (integrated circuit) on the Arduino is
slightly different from board to board. The microcontrollers are usually of the ATMEL
Company. You must know what IC your board has before loading up a new program from
the Arduino IDE. This information is available on the top of the IC. For more details about
the IC construction and functions, you can refer to the data sheet.
9. ICSP pin: Mostly, ICSP (12) is an AVR, a tiny programming header for the Arduino
consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an SPI
(Serial Peripheral Interface), which could be considered as an "expansion" of the output.
10. Power LED indicator: This LED should light up when you plug your Arduino into a power
source to indicate that your board is powered up correctly. If this light does not turn on, then
there is something wrong with the connection.
11. TX and RX LEDs: On your board, you will find two labels: TX (transmit) and RX (receive).
They appear in two places on the Arduino UNO board. First, at the digital pins 0 and 1, to
indicate the pins responsible for serial communication. Second, the TX and RX led (13). The
TX led flashes with different speed while sending the serial data. The speed of flashing
depends on the baud rate used by the board. RX flashes during the receiving process.
12. Digital I/O: The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide PWM
(Pulse Width Modulation) output. These pins can be configured to work as input digital pins
to read logic values (0 or 1) or as digital output pins to drive different modules like LEDs,
relays, etc. The pins labeled “~” can be used to generate PWM.
13. AREF: AREF stands for Analog Reference. It is sometimes, used to set an external reference
voltage (between 0 and 5 Volts) as the upper limit for the analog input pins.
Arduino IDE
14
SKIT, Ramnagaria, Jagatpura, Jaipur
Arduino IDE is open source software that is used to program the Arduino controller board
connected via USB cable. Following steps are required to set up an Arduino board.
1. Power the board by connecting it to a PC via USB cable. The power source is selected with
a jumper, a small piece of plastic that fits onto two of the three pins between the USB and
power jacks. Check that it is on the two pins closest to the USB port. Connect the Arduino
board to your computer using the USB cable.
2. Launch Arduino IDE: After the Arduino IDE software is downloaded, unzip the folder.
Inside the folder, find the application icon with an infinity label (application.exe). Double-
click the icon to start the IDE.
3. Open the first project: Once the software starts, two options are available −
Create a new project.
Open an existing project example.
To create a new project, select File → New.
To open an existing project example, select File → Example
4. Select the Arduino board: To avoid any error while uploading your program to the board,
select the correct Arduino board name, which matches with the board connected to your
computer. Go to Tools → Board and select the Arduino Uno board.
5. Select the serial port: Select the serial device of the Arduino board. Go to Tools → Serial
Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for
hardware serial ports). To find out, you can disconnect your Arduino board and re-open the
menu, the entry that disappears should be of the Arduino board. Reconnect the board and
select that serial port.
6. Upload the program to the board: Before explaining how we can upload our program to
the board, we must demonstrate the function of each symbol appearing in the Arduino IDE
toolbar.
15
SKIT, Ramnagaria, Jagatpura, Jaipur
Now, simply click the "Upload" button in the environment. Wait a few seconds; you will see the
RX and TX LEDs on the board, flashing. If the upload is successful, the message "Done
uploading" will appear in the status bar.
Raspberry Pi
In 2012, the company launched the Raspberry Pi and the current generations of regular Raspberry
Pi boards are Zero, 1, 2, 3, and 4. Generation 1 Raspberry Pi had the following four options:
Model A
Model A +
Model B
16
SKIT, Ramnagaria, Jagatpura, Jaipur
Model B +
Among these models, the Raspberry Pi B models are the original credit-card sized format. On the
other hand, the Raspberry Pi A models has a smaller and more compact footprint and hence, these
models have the reduced connectivity options. Raspberry Pi Zero models, which come with or
without GPIO (general-purpose input output) headers installed, are the most compact of all the
Raspberry Pi boards types.
The best use of Raspberry Pi is to learn how a computer works. It is easy to learn how to make
electronic projects or programs with it. It comes with two programming languages, Scratch and
Python. Through GPIO (general purpose input output) pins, Raspberry Pi can be connected to
other circuits to control the devices of choice.
Specifications
17
SKIT, Ramnagaria, Jagatpura, Jaipur
HDMI Cable.
Monitor.
Keyboard.
Mouse.
5 Volt Power Adapter.
LAN Cable.
Min- 2GB micro SD Card.
Operating System
The official supported OS are:
Raspbian.
NOOBS.
18
SKIT, Ramnagaria, Jagatpura, Jaipur
UBUNTU mate.
Snappy Ubuntu core.
Windows 10 core.
Pinet.
RISC OS.
Experiment – 1
Aim: Start Raspberry Pi and try various Linux commands in command terminal window:
ls, cd, touch, mv, rm, man, mkdir, rmdir, tar, gzip, cat, more, less, ps, sudo,cron, chown,
chgrp, ping, chmod, curl, echo, exit, find, finger, free, grep, kill etc.
Linux Commands:
2. cd: cd command in linux known as change directory command. It is used to change current
working directory.
Syntax:
$ cd [directory]
19
SKIT, Ramnagaria, Jagatpura, Jaipur
3. touch: Used to create, change and modify timestamps of a file. It is used to create a file
without any content.
Touch command Syntax to create a new file:
touch file_name
Touch command to create multiple files:
touch File1_name File2_name File3_name
4. mv: mv stands for move. mv is used to move one or more files or directories from one place
to another in file system. It has two distinct functions. It renames a file or folder. It moves
group of files to different directory.
Syntax:
mv [Option] source destination
5. rm: rm stands for remove here. rm command is used to remove objects such as files,
directories, symbolic links and so on from the file system
Syntax:
rm [OPTION]... FILE...
6. man: man command in Linux is used to display the user manual of any command
Syntax:
$man [OPTION]... [COMMAND NAME]...
Syntax:
$man [OPTION]... [COMMAND NAME]...
9. tar: The Linux ‘tar’ stands for tape archive, is used to create Archive and extract the
20
SKIT, Ramnagaria, Jagatpura, Jaipur
Archive files.
Syntax:
tar [options] [archive-file] [file or directory to be archived]
Syntax:
gzip [Options] [filenames]
Example:
$ gzip mydoc.txt]
11. cat: It reads data from the file and gives their content as output. It helps us to create,
view and concatenate files.
Syntax:
$cat filename
12. more: This command is used to view the text files in the command prompt, displaying one
screen at a time in case the file is large (For example log files). The more command also
allows the user do scroll up and down through the page.
Syntax:
more [-options] [-num] [+/pattern] [+linenum] [file_name]
∙ [-options]: any option that you want to use in order to change the way the file is displayed.
Choose any one from the followings: (-d, -l, -f, -p, -c, -s, -u)
∙ [-num]: type the number of lines that you want to display per screen.∙ [+/pattern]: replace
the pattern with any string that you want to find in the text file.
∙ [+linenum]: use the line number from where you want to start displaying the text content.
∙ [file_name]: name of the file containing the text that you want to display on the screen.
13. Less: less command is linux utility which can be used to read contents of text file one page
(one screen) per time. It has faster access because if file is large, it don’t access complete file,
but access it page by page.
Syntax:
less filename
21
SKIT, Ramnagaria, Jagatpura, Jaipur
14. ps: It is used for viewing information related with the processes on a system which stands as
abbreviation for “Process Status”
Syntax –
ps [options]
15. sudo: sudo (Super User DO) command in Linux is generally used as a prefix of some
command that only super user are allowed to run.
16. cron: automates the scheduled task at a predetermined time. It is a daemon process, which
runs as a background process.
Syntax:
cron [-f] [-l] [-L loglevel]
17. chown: chown command is used to change the file Owner or group.
Syntax:
chown [OPTION]… [OWNER][: [GROUP]] FILE…
chown [OPTION]… –reference=RFILE FILE…
18. chgrp: chgrp command in Linux is used to change the group ownership of a file or directory.
Syntax:
Chgrp [OPTION]… GROUP FILE…
chgrp [OPTION]… –reference=RFILE FILE…
19. ping: PING (Packet Internet Groper) command is used to check the network connectivity
between host and server/host.
20. chmod: The chmod command is used to change the access mode of a file. The name is an
abbreviation of change mode.
Syntax:
chmod [reference][operator][mode] file...
21. curl: curl is a command line tool to transfer data to or from a server, using any of the
supported protocols
Syntax:
curl [options] [URL...]
22
SKIT, Ramnagaria, Jagatpura, Jaipur
22. echo: echo command in linux is used to display line of text/string that are passed as an
argument .
Syntax:
echo [option] [string]
23. exit: exit command in linux is used to exit the shell where it is currently running. It takes one
more parameter as [N] and exits the shell with a return of status N.
Syntax:
exit [n]
24. find: It can be used to find files and directories and perform subsequent operations on
them. It supports searching by file, folder, name, creation date, modification date, owner
and permissions.
Syntax:
$ find [where to start searching from]
[expression determines what to find] [-options] [what to find]
25. Finger: command is a user information lookup command which gives details of all the
users logged in.
Syntax:
$finger[username]
26. Free: command which displays the total amount of free space available along with the
amount of memory used and swap memory in the system, and also the buffers used by the
kernel.
Syntax:
$free [OPTION]
27. Grep: The grep filter searches a file for a particular pattern of characters, and displays all
lines that contain that pattern.
Syntax:
grep [options] pattern [files]
28. Kill: command in Linux (located in /bin/kill), is a built-in command which is used to
terminate processes manually. Kill command sends a signal to a process which terminates the
process.
23
SKIT, Ramnagaria, Jagatpura, Jaipur
Experiment – 2
Python Program:
name = input('What is your name?\n')
print ('Hello %s.' % name)
Output:
What is your name?
IoT Laboratory
Hello IoT Laboratory
b) Read two numbers and print their sum, difference, product and division.
Python Program:
num1 = int(input("Enter First Number: "))
num2 = int(input("Enter Second Number: "))
print("Enter which operation would you like to perform?")
24
SKIT, Ramnagaria, Jagatpura, Jaipur
result = 0
if ch == '+':
result = num1 + num2
elif ch == '-':
result = num1 - num2
elif ch == '*':
result = num1 * num2
elif ch == '/':
result = num1 / num2
else:
print("Input character is not recognized!")
print(num1, ch , num2, ":", result)
Output 1: Addition
Enter First Number: 100
Enter Second Number: 5
Enter which operation would you like to perform?
Enter any of these char for specific operation +,-,*, /: +
100 + 5: 105
Output 2: Subtraction
Enter First Number: 8
Enter Second Number: 7
Enter which operation would you like to perform?
Enter any of these char for specific operation +,-,*, /: -
8 - 7: 1
Output 3: Multiplication
Enter First Number: 6
Enter Second Number: 8
Enter which operation would you like to perform?
Enter any of these char for specific operation +,-,*, /: *
6 * 8: 48
Output 4: Division
Enter First Number: 20
Enter Second Number: 5
Enter which operation would you like to perform?
Enter any of these char for specific operation +,-,*, /: /
20 / 5 : 4.0
25
SKIT, Ramnagaria, Jagatpura, Jaipur
Python Program:
word_count = 0
char_count = 0
usr_input = input("Enter a string : ")
split_string = usr_input.split()
word_count = len(split_string)
for word in split_string:
char_count += len(word)
print("Total words : {}".format(word_count))
print("Total characters : {}".format(char_count))
Output:
Enter a string: Hello, How are you?
Total words: 4
Total characters: 16
d) Area of a given shape (rectangle, triangle and circle) reading shape and appropriate
values from standard input.
Python Program:
width = float(input('Please Enter the Width of a Rectangle: '))
height = float(input('Please Enter the Height of a Rectangle: '))
Output:
Please Enter the Width of a Rectangle: 22
Please Enter the Height of a Rectangle: 5
Area of a Rectangle is: 110.00
Perimeter of Rectangle is: 54.00
Python Program:
# Python Program to find the area of triangle
# Three sides of the triangle a, b and c are provided by the user
26
SKIT, Ramnagaria, Jagatpura, Jaipur
Output:
Enter first side: 3
Enter second side: 4
Enter third side: 5
The area of the triangle is 6.00
Python Program:
# Python Program to find Diameter, Circumference, and Area of a Circle
PI = 3.14
radius = float(input(' Please Enter the radius of a circle: '))
diameter = 2 * radius
circumference = 2 * PI * radius
area = PI * radius * radius
Output:
Please Enter the radius of a circle: 5
Diameter of a Circle = 10.00
Circumference of a Circle = 31.40
Area of a Circle = 78.50
27
SKIT, Ramnagaria, Jagatpura, Jaipur
y=int(input("Enter breadth:"))
print("Area={}".format(x*y))
elif s=='2':
x=int(input("Enter base:"))
y=int(input("Enter height:"))
print("Area={}".format(0.5*x*y))
elif s=='3':
x=int(input("Enter radius:"))
print("Area={}".format(3.14*x*x))
else:
print("Enter a valid choice")
Experiment – 3
a) Print a name 'n' times, where name and n are read from standard input, using for and
while loops.
28
SKIT, Ramnagaria, Jagatpura, Jaipur
while(i<=num):
print (name)
i=i+1
Python Program:
print ("enter two no n1 and n2")
n1=raw_input()
n2=raw_input()
n1=int(n1)
n2=int(n2)
try:
div=n1/n2
print (div)
except ZeroDivisionError:
print ("zero division is handled")
Output:
Enter n1:10
Enter n2:0
zero division is handled
#DivideByZero Exception
x=int(input("First No:"))
y=int(input("Second No:"))
try:
print("x/y={}".format(x/y))
except Exception:
print("DivideByZero Exception")
29
SKIT, Ramnagaria, Jagatpura, Jaipur
Python Program:
import time
for i in range(1,11):
zz=time.asctime(time.localtime(time.time()))
zz=zz[11:19]
print (zz)
print (time.asctime(time.localtime(time.time())))
time.sleep(10)
Python Program:
#Current time 10 times
import datetime
import time
for i in range(0,10):
print(datetime.datetime.now().time())
time.sleep(10)
d) Read a file line by line and print the word count of each line.
Python Program:
file=open("eee.txt","r")
line=1
for i in file:
Python Program:
# read line by line from file
while True:
30
SKIT, Ramnagaria, Jagatpura, Jaipur
count+=1
line = file1.readline()
if not line:
break
print("Word Count in Line{}: {}".format(count,
len(line.split())) )
file1.close()
Experiment – 4
Explanation:
The first step in this project is to design a simple LED circuit. Then we will make the LED
circuit controllable from the Raspberry Pi by connecting the circuit to the general purpose
input/output (GPIO) pins on the Raspberry Pi.
A simple LED circuit consists of a LED and resistor. The resistor is used to limit the current that
is being drawn and is called a current limiting resistor. Without the resistor the LED would run at
too high of a voltage, resulting in too much current being drawn which in turn would instantly
burn the LED, and likely also the GPIO port on the Raspberry Pi.
To calculate the resistor value we need to examine the specifications of the LED. Specifically we
need to find the forward voltage (VF) and the forward current (IF). A regular red LED has a
forward voltage (VF) of 1.7V and forward current of 20mA (IF). Additionally we need to know
the output voltage of the Raspberry Pi which is 3.3V.
We can then calculate the resistor size needed to limit the current to the LED’s maximum
forward current (IF) using ohm’s law like this:
Unfortunately 80 ohm is not a standard size of a resistor. To solve this we can either combine
multiple resistors, or round up to a standard size. In this case we would round up to 100 ohm.
When hooking up the circuit, note the polarity of the LED. The LED has a long and a short lead.
31
SKIT, Ramnagaria, Jagatpura, Jaipur
The long lead is the positive side also called the anode, the short lead is the negative side called
the cathode. The long should be connected to the resistor and the short lead should be connected
to ground via the blue jumper wire and pin 6 on the Raspberry Pi as shown on the diagram. To
find the pin number refer to this diagram showing the physical pin numbers on the Raspberry Pi.
Circuit:
Code:
32
SKIT, Ramnagaria, Jagatpura, Jaipur
Output:
Experiment 5
Circuit:
Fig: Push-button
Code:
importRPi.GPIOas GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(8, GPIO.OUT,initial=GPIO.LOW)
While True:
If GPIO.input(16) == GPIO.LOW
33
SKIT, Ramnagaria, Jagatpura, Jaipur
print(“Button pushed”)
GPIO.output(8,GPIO.HIGH)
else:
print(“Button released”)
GPIO.output(8,GPIO.LOW)
Output
34
SKIT, Ramnagaria, Jagatpura, Jaipur
Experiment 6
Aim: Flash an LED at a given on time and off time cycle, where the two times are taken from a
file.
Code:
f=open("delay.txt","r")
on_time=int(f.readline())
off_time=int(f.readline())
while True:
GPIO.output(8, GPIO.HIGH) # Turn on
sleep(on_time) #
GPIO.output(8, GPIO.LOW) # Turn off
sleep(off_time) #
35
SKIT, Ramnagaria, Jagatpura, Jaipur
Experiment – 7
Explaination:
Unlike Arduino, the Raspberry Pi won’t run the code until it is executed manually. We need a
scheduler to run the python code when the Pi is powered up or rebooted. Crontab (cron table) is
scheduler used in Linux to schedule a specific task at a specific time. It is mostly used by Linux
system Administrators to automate his daily tasks like scheduling backups and deleting old files,
etc., Here we will be using it to launch the code during the startup, so we will be creating a shell
script to navigate to the python code first and then launch it during startup using crontab.
Step 1:
First, create a ‘blink’ folder and then create an empty ‘blink.py’ file. It should be inside the path
/home/pi/blink. (The /home/pi/ is the default user files path).
36
SKIT, Ramnagaria, Jagatpura, Jaipur
Python code: blink.py
import time
def setup():
def blink():
while True:
37
SKIT, Ramnagaria, Jagatpura, Jaipur
time.sleep(1)
time.sleep(1)
def destroy():
setup()
try:
blink()
except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be
executed.
destroy()
Step 2:
Open the terminal and navigate to the ‘blink’ folder by using the following command
cd blink
Create a launcher script by typing the command in the terminal.
nano launcher.sh
Step 3:
Now the editor will get launched. Copy and paste the following code to the editor. This shell
script will navigate to the blink code.
38
SKIT, Ramnagaria, Jagatpura, Jaipur
#! /bin/sh
# launcher.sh
# navigate to home directory, then to this directory, and then execute python script, then back
home
cd /
cd home/pi/blink
sudo python blink.py
cd /
Now press Ctrl – X and the press Y to Save. It will ask for filename leave it as ‘launcher.sh’
itself and press enter.
Step 4:
We want to make this launcher.sh script executable. Type the following command for it.
You can test the launcher script by typing the following command if you want to test.
sh launcher.sh
Step 5:
Create a log directory for capturing logs incase of any errors. Navigate back to home directory
and create a log directory there.
cd
mkdir logs
Step 6:
We need to schedule the launcher script to run during startup itself. Open the crontab by using
the command.
sudo crontab –e
Once the crontab window opens add this line at the end of the file.
50 9 * * 4 python3 /home/rasp-pi/blink/blink.py
39
SKIT, Ramnagaria, Jagatpura, Jaipur
# Now Press CTRL+X , to save type Y, remain the file name as it is press enter
Experiment – 8
Aim: Switch on a relay at a given time using cron, where the relays contact terminals are connect
to load.
40
SKIT, Ramnagaria, Jagatpura, Jaipur
Relay Module
Relay Connection
Code:
41
SKIT, Ramnagaria, Jagatpura, Jaipur
sleep (5)
GPIO.output(8, GPIO.LOW) # Turn off
sleep (5)
Experiment -9
Aim: Get the status of bulb at a remote place on the LAN through Web.
Explanation:
MQTT Protocol
MQTT stands for Message Queuing Telemetry Transport. MQTT is a machine to machine
internet of things connectivity protocol. It is an extremely lightweight and publish-subscribe
messaging transport protocol. This protocol is useful for the connection with the remote location
where the bandwidth is a premium. These characteristics make it useful in various situations,
42
SKIT, Ramnagaria, Jagatpura, Jaipur
including constant environment such as for communication machine to machine and internet of
things contexts. It is a publish and subscribe system where we can publish and receive the
messages as a client. It makes it easy for communication between multiple devices. It is a simple
messaging protocol designed for the constrained devices and with low bandwidth, so it's a
perfect solution for the internet of things applications.
Now we will look at the architecture of MQTT. To understand it more clearly, we will look at
the example. Suppose a device has a temperature sensor and wants to send the rating to the
server or the broker. If the phone or desktop application wishes to receive this temperature value
on the other side, then there will be two things that happened. The publisher first defines the
topic; for example, the temperature then publishes the message, i.e., the temperature's value.
After publishing the message, the phone or the desktop application on the other side will
subscribe to the topic, i.e., temperature and then receive the published message, i.e., the value of
the temperature. The server or the broker's role is to deliver the published message to the phone
or the desktop application.
Code:
43
SKIT, Ramnagaria, Jagatpura, Jaipur
44
SKIT, Ramnagaria, Jagatpura, Jaipur
mqttc.on_connect = on_connect
mqttc.on_publish = on_publish
mqttc.on_subscribe = on_subscribe
rc = 0
while True:
while rc == 0:
import time
rc = mqttc.loop()
#time.sleep(0.5)
print("rc: " + str(rc))
Experiment – 10
Aim: Interface Temperature & Humidity sensor using Raspberry pi and send the data over
ThingSpeak cloud Infrastructure.
Explanation:
45
SKIT, Ramnagaria, Jagatpura, Jaipur
DHT11 Sensor
DHT11 sensor measures humidity and temperature values serially over a single wire.
It can measure relative humidity in percentage (20 to 90% RH) and temperature in degree
Celsius in the range of 0 to 50°C.
It has 4 pins; one of which is used for data communication in serial form.
Pulses of different TON and TOFF are decoded as logic 1 or logic 0 or start pulse or end of a
frame.
Circuit:
Code:
Here, we are going to interface DHT11 sensor with Raspberry Pi 3 and display Humidity and
Temperature on terminal.
We will be using the DHT Sensor Python library by Adafruit from GitHub. The Adafruit
Python DHT Sensor library is created to read the Humidity and Temperature on raspberry Pi
or Beaglebone Black. It is developed for DHT series sensors like DHT11, DHT22 or
AM2302.
https://github.com/adafruit/Adafruit_Python_DHT/archive/master.zip
46
SKIT, Ramnagaria, Jagatpura, Jaipur
Extract the library and install it in the same root directory of downloaded library by executing
following command,
Once the library and its dependencies has been installed, open the example sketch named
simple test from the library kept in examples folder.
In this code, raspberry Pi reads Humidity and Temperature from DHT11 sensor and prints
them on terminal. But, it read and display the value only once. So, here we made change in the
program to print value continuously.
Note:
Assign proper sensor type to the sensor variable in this library. Here, we are using DHT11
sensor.
sensor = Adafruit_DHT.DHT11
#Code:
import Adafruit_DHT
import http.client
import urllib
import time
key = "CKUNX8CN1DHO6MO0" # Put your API Key here
47
SKIT, Ramnagaria, Jagatpura, Jaipur
def thermometer():
while True:
#Calculate CPU temperature of Raspberry Pi in Degrees C
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
#print('Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(temperature,
humidity))
if humidity is not None and temperature is not None:
print('Temp={0:0.1f}*C Humidity={1:0.1f}
%'.format(temperature, humidity))
else:
print('Failed to get reading. Try again!')
params = urllib.parse.urlencode({'field1': temperature, 'field2':
humidity, 'key':key })
headers = {"Content-typZZe": "application/x-www-form-
urlencoded","Accept": "text/plain"}
conn = http.client.HTTPConnection("api.thingspeak.com:80")
try:
conn.request("POST", "/update", params, headers)
response = conn.getresponse()
#print (temp)
print (response.status, response.reason)
data = response.read()
conn.close()
except:
print ("connection failed")
break
if __name__ == "__main__":
while True:
thermometer()
48
SKIT, Ramnagaria, Jagatpura, Jaipur
ThingSpeak Cloud:
ThingSpeak is an open IoT platform for monitoring the data online. In ThingSpeak, the data in
the channel can be set as private or public according to the choice. ThingSpeak takes minimum
of 15 seconds to update the readings. It’s a great and very easy to use platform for building IOT
projects.
The first step in building any IoT project using Raspberry Pi is to upload the data to any cloud
server using Raspberry Pi. In this simplest Raspberry Pi IOT project, ThingSpeak is used as a
cloud server to store the data. Here Raspberry Pi will read DHT11/DHT22 sensor data and send
it to ThingSpeak. The sensed data can be monitored from anywhere in the world via internet.
This will be useful for some application where Pi is running for long time at some remote place
and CPU temperature needs to be monitored.
For creating the channel on ThingSpeak you first need to sign up on ThingSpeak. In case if you
already have account on ThingSpeak just sign in using your id and password.
For creating your account go to www.thingspeak.com
Once Signing is done, create a new channel by clicking “New Channel” button
To send data to ThingSpeak, a unique API key is needed, which will be used later in the python
code to upload the CPU data onto ThingSpeak Website.
Click on “API Keys” button to get the unique API key for uploading the CPU data.
49
SKIT, Ramnagaria, Jagatpura, Jaipur
After completing these steps, open the channel and observe that the DHT sensor data is getting
updated into ThingSpeak website.
Experiment –11
Explanation:
50
SKIT, Ramnagaria, Jagatpura, Jaipur
Ultrasonic Sensors, particularly HC-SR04 Ultrasonic Sensor, are very popular among electronic
hobbyists and are frequently used in a variety of projects like Obstacle Avoiding Robot, Distance
Measurement, Proximity Detection and so forth. In this project, we will learn about HC-SR04
Ultrasonic and see how to interface one with Raspberry Pi.
We will now see how to measure the distance of an object using HC-SR04 Ultrasonic Sensor. In
order to send the 40 KHz Ultrasound, the TRIG Pin of the Ultrasonic Sensor must be held HIGH
for a minimum duration of 10µS.After this, the Ultrasonic Transmitter, will transmits a burst of
8-pulses of ultrasound at 40 KHz. Immediately, the control circuit in the sensor will change the
state of the ECHO pin to HIGH. This pin stays HIGH until the ultrasound hits an object and
returns to the Ultrasonic Receiver. Based on the Time for which the Echo Pin stays HIGH, you
can calculate the distance between the sensor and the object. For example, if we calculated the
time for which ECHO is HIGH as 588µS, then you can calculate the distance with the help of the
speed of sound, which is equal to 340m/s.
Physical Connections:-
Back side pins of sensor:- ( in breadboard vertical connections( in between) are there)
51
SKIT, Ramnagaria, Jagatpura, Jaipur
setup() {
Serial.begin(96
00);} void
loop()
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(1000);
52
SKIT, Ramnagaria, Jagatpura, Jaipur
{return microseconds / 74 / 2;
Verify your code in Arduino IDE that is sketch. Upload your code in Arduino IDE. After
connecting, all done. Press Ctrl + shift + M. You can see output window
Output:
Experiment – 12
Aim: Design a system using Arduino to monitor Temperature and Humidity.
Theory:
53
SKIT, Ramnagaria, Jagatpura, Jaipur
DHT11 Sensor:
The DHT11 is a basic, low cost digital temperature and humidity sensor.
∙ DHT11 is a single wire digital humidity and temperature sensor, which provides humidity
and temperature values serially with one-wire protocol.
∙ DHT11 sensor provides relative humidity value in percentage (20 to 90% RH) and
temperature values in degree Celsius (0 to 50 °C).
∙ DHT11 sensor uses resistive humidity measurement component, and NTC temperature
measurement component.
Explanation:
Physical Connections:-
Back side pins of sensor: - (in breadboard vertical connections (in between) are there)
Code:
#include <dht11.h>
#define DHT11PIN 4
dht11 DHT11;
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println();
int chk = DHT11.read(DHT11PIN);
Serial.print("Humidity (%): ");
Serial.println((float)DHT11.humidity, 2);
54
SKIT, Ramnagaria, Jagatpura, Jaipur
55
SKIT, Ramnagaria, Jagatpura, Jaipur
Beyond Syllabus
Experiment – 1
Aim: Design a system using Arduino to monitor Soil Moisture of a plant on an IDE. If
soil moisture is less, then LED should glow.
56
SKIT, Ramnagaria, Jagatpura, Jaipur
Theory:
Soil moisture sensors measure the volumetric water content in soil. Since the direct gravimetric
measurement of free soil moisture requires removing, drying, and weighing of a sample, soil
moisture sensors measure the volumetric water content indirectly by using some other property
of the soil, such as electrical resistance, dielectric constant, or interaction with neutrons, as a
proxy for the moisture content.
Connections:
Code:
int sensorPin = A0;
int sensorValue;
int limit = 300;
void setup() {
Serial.begin(9600);
57
SKIT, Ramnagaria, Jagatpura, Jaipur
pinMode(13, OUTPUT);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.println("Analog Value : ");
Serial.println(sensorValue);
if (sensorValue<limit) {
digitalWrite(13, HIGH);
}
else {
digitalWrite(13, LOW);
}
delay(1000);
}
Output:
Experiment – 2
Aim: Design a system using Arduino that blinks an LED when you detect a motion in an
area on an IDE. Write working, connections, code and expected output.
Hardware Library: ARDUINO UNO
Theory:
58
SKIT, Ramnagaria, Jagatpura, Jaipur
"Passive Infra-Red" sensor is a "Pyroelectric IR Sensor" which generates energy when exposed
to heat. Everything emits some low level of radiation, the hotter the object is, the more radiation
is emitted. When a human or an animal (with IR radiation wavelength of 9.4µMeter) approaches
the sensors range the sensor detects the heat in the form of infrared radiation.
The sensor only detects the energy emitted by other objects and don’t produce any, that's why
the sensor is called a PIR or "Passive Infra-Red" sensor. These sensors are small, cheap,
rugged, low power and very easy to use.
Connections:
With Arduino,
∙ Connect the VCC of the PIR sensor to the 5v pin of Arduino.
∙Then connect the output pin to D13
∙ GND to the Ground pin of the Arduino.
∙ Connect the LED to the D2 pin of the Arduino.
Code:
int LED = 13; // the pin that the LED is attached to int PIR = 2; // the pin that the sensor is
attached to
void setup() {
pinMode(LED, OUTPUT); // initialize LED as an output
pinMode(PIR, INPUT); // initialize sensor as an input Serial.begin(9600); // initialize serial
}
void loop(){
59
SKIT, Ramnagaria, Jagatpura, Jaipur
Output:
Motion detected
Motion detected
Motion detected
Motion detected
Motion stopped
Motion stopped
Motion detected
Motion detected
Motion detected
Motion stopped
Experiment – 3
Aim: Motion detection and blinking the light when the light intensity is low using Arduino.
Components: PIR Sensor, LDR Sensor, Arduino UNO, Jumping wires, LED
60
SKIT, Ramnagaria, Jagatpura, Jaipur
Theory:
PIR Sensor
"Passive Infra-Red" sensor is a "Pyroelectric IR Sensor" which generates energy when exposed
to heat. Everything emits some low level of radiation, the hotter the object is, the more radiation
is emitted. When a human or an animal (with IR radiation wavelength of 9.4µMeter) approaches
the sensors range the sensor detects the heat in the form of infrared radiation.
The sensor only detects the energy emitted by other objects and don't produce any, that's why the
sensor is called a PIR or “Passive Infra-Red" sensor. These sensors are small, cheap, rugged,
low-power and very easy to use.
LDR Sensor
The LDR Sensor Module is used to detect the presence of light / measuring the intensity of light.
The output of the module goes high in the presence of light and it becomes low in the absence of
light. The sensitivity of the signal detection can be adjusted using potentiometer.
Connections:
With Arduino,
∙ Connect the VCC of the PIR and LDR Sensor to the 5v pin of Arduino.
61
SKIT, Ramnagaria, Jagatpura, Jaipur
Code:
#define LED 2 // The pin that the LED is attached to
#define LDR 4 // The pin that the LDR Sensor is attached to
#define PIR 13 // The pin that the PIR sensor is attached to
void setup() {
pinMode(LED, OUTPUT); // initalize LED as an output
pinMode(PIR, INPUT); // initialize PIR sensor as an input
pinMode(LDR, INPUT); // initialize LDR sensor as an input
Serial.begin(9600); // initialize serial
}
void loop(){
if(digitalRead(PIR) == HIGH)
{
Serial.println("Motion detected!");
delay(100); // delay 100 milliseconds
else
{
Serial.println("Motion stopped!");
delay(100); // delay 100 milliseconds
}
}
Output:
Motion detected!
Motion detected!
Motion detected!
62
SKIT, Ramnagaria, Jagatpura, Jaipur
Viva Questions
63
SKIT, Ramnagaria, Jagatpura, Jaipur
Internet of Things (IoT) is a network of physical objects or people called "things" that are
embedded with software, electronics, network, and sensors that allow these objects to collect and
exchange data. The goal of IoT is to extend to internet connectivity from standard devices like
computer, mobile, tablet to relatively dumb devices like a toaster.
2) Explain Raspberry Pi
Raspberry Pi is a computer which is capable of doing all the operations like a conventional
computer. It has other features such as onboard WiFi, GPIO pins, and Bluetooth in order to
communicate with external things.
Raspberry pi in headless mode can be run by using SSH. The latest operating system has an
inbuilt VNC server that is installed for taking remote desktop on Raspberry Pi.
Sensors/Devices: Sensors or devices are a key component that helps you to collect live data
from the surrounding environment. All this data may have various levels of complexities. It
could be a simple temperature monitoring sensor, or it may be in the form of the video feed.
Connectivity: All the collected data is sent to a cloud infrastructure. The sensors should be
connected to the cloud using various mediums of communications. These communication
mediums include mobile or satellite networks, Bluetooth, WI-FI, WAN, etc.
64
SKIT, Ramnagaria, Jagatpura, Jaipur
Data Processing: Once that data is collected, and it gets to the cloud, the software product
performs processing on the gathered data. This process can be just checking the temperature,
reading on devices like AC or heaters. However, it can sometimes also be very complex, like
identifying objects, using computer vision on video.
User Interface: The information needs to be available to the end-user in some way, which
can be achieved by triggering alarms on their phones or sending them notification through
email or text message. The user sometimes might need an interface which actively checks
their IoT system.
IoT IIoT
The full form of IoT is the Internet of The full form of IIoT is the Industrial Internet
Things. of Things.
The quality of data is medium to high. The quality of data is high to very high.
65
SKIT, Ramnagaria, Jagatpura, Jaipur
8) Define Arduino
Arduino is a free electronics platform having easy to use hardware and software. It has a
microcontroller capable of reading input from sensors to control the motors programmatically.
Smoke sensor
Temperature sensors
Pressure sensor
Motion detection sensors
Gas sensor
Proximity sensor
IR sensors
10) Mention the basic difference between IoT and sensor businesses?
A sensor business does not need an active internet connection to work. Internet of Things
requires a control side to work.
66
SKIT, Ramnagaria, Jagatpura, Jaipur
The Bluegiga APX4 is a solution that supports both the WiFi and BLE platform, and it is based
on a 450MHz ARM9 processor.
67
SKIT, Ramnagaria, Jagatpura, Jaipur
Smart Thermostats: Helps you to save resources on heating bills by knowing your usage
patterns.
Connected Cars: IoT helps automobile companies handle billing, parking, insurance, and
other related stuff automatically.
Activity Trackers: Helps you to capture heart rate patterns, calorie expenditure, activity
levels, and skin temperature on your wrist.
Smart Outlets: Remotely turn any device on or off. It also allows you to track a device's
energy level and get custom notifications directly into your smart phone.
Parking Sensors: IoT technology helps users to identify the real-time availability of parking
spaces on their phones.
Connect Health: The concept of a connected healthcare system facilitates real-time health
monitoring and patient care. It helps in improved medical decision-making based on patient
data.
PWM or Pulse Width Modulation is a variation of how much time the signal is high in an analog
fashion. The signal can be high or low and the user can even change the proportion of the time.
Applications of PWM in IoT are controlling the speed of DC motor, controlling the direction of a
servo moto, Dimming LED, etc.
17) What are the functions used to read analog and digital data from a sensor in Arduino?
Functions used to read analog and digital data from a sensor in Arduino are: digitalRead() and
digitalWrite().
Bluetooth Low Energy is a wireless PAN (Personal Area Network) technology. It uses less
power to transmit long-distance over a short distance.
68
SKIT, Ramnagaria, Jagatpura, Jaipur
MicroPython is a Python implementation, which includes a small subset of its standard library. It
can be optimized to run on the ModeMCU microcontroller.
Raspberry Pi 1 Model B
Raspberry Pi 1 Model B+
Raspberry Pi 1 Model A
Raspberry Pi Zero
Raspberry Pi 3 Model B
Raspberry Pi 1model A+
Raspberry Pi Zero W
Raspberry Pi 2
Turbidity sensor.
Total organic carbon sensor.
pH sensor.
Conductivity sensor.
69
SKIT, Ramnagaria, Jagatpura, Jaipur
Arduino Raspberry pi
Raspberry pi is a credit card size computer. Users can run more than one program at a
time.
XMPP
AMQP
Very Simple Control Protocol (VSCP)
Data Distribution Service (DDS)
MQTT protocol
WiFi
Simple Text Oriented Messaging Protocol(STOMP)
Zigbee
IoT Publishers are sensors that send real-time data to intermediate devices or middleware.
Arduino library is a collection of code that is already written for controlling module or sensor.
70
SKIT, Ramnagaria, Jagatpura, Jaipur
Thingworx is a platform for the fast development and deployment of connected devices. It is a
collection of integrated IoT development tools that support analysis, production, property, and
alternative aspects of IoT development.
The Salesforce IoT Cloud is an online platform for storing and processing IoT information. It is
an assortment of various application development elements, which are called lightning. This
program gathers information from websites, devices, customers, and partners. It then triggers
actions for period responses.
GE or General Electric Predix is the software for the information assortment from industrial
instruments. It offers a PaaS which allows users performance management and operation
optimization facility. It connects instrumentation, people, and information in an exceedingly
conventional technique.
Popular companies working on IoT are: 1) Philips, 2) LG, 3) Google, 4) Apple and 5) Samsung.
1) Data frame.
2) Request frame.
3) Error frame.
4) Overload frame.
34) What is the main difference between floating CPU and fixed-point CPU?
Floating CPU can take floating value directly, whereas fixed CPU is converted to integer format.
Thereby, it leads to the loss of some resolution.
71
SKIT, Ramnagaria, Jagatpura, Jaipur
GPIO is a programmable pin that can be used to control input or output pins programmatically.
The main aim of airflow sensors is to measure the air level in the soil. This sensor enables one to
measure it dynamically, from one location, or multiple locations of the garden.
influx DB
Apache Cassandra
RethinkDB
MongoDB
Sqlite
Home automation
Portable web server
manipulating the robots
Internet radio
IoT Contiki is software that targets explicitly little devices connected with the Internet. It is used
with process power bandwidth, power, and restricted memory. Contiki helps for the management
of programs, resources, processes, communication, and memory.
72
SKIT, Ramnagaria, Jagatpura, Jaipur
Data in IoT refers to the information that is collected by the installed devices at any building.
Majorly used IoT controllers by industries are: 1) Siemens IoT 2020 and 2) Arduino.
A crystal oscillator is the main part of the microprocessor. It executes every single pulse one
instruction in CPU.
It brings together people, processes, things, and data to make network connections valuable
and relevant.
It converts the information into actions to create new capabilities and opportunities for
businesses.
The full form of WSN is Wireless Sensor Network. It is a network of notes, design to observe
and to study physical parameters of the application.
Zigbee is the same like Bluetooth. It used in a complex system for low power operation,
robustness, and high security.
Z-Wave is an IoT technology that uses low power RF communication. It is designed for home
automation products like lamp controllers and sensors.
A new library in Arduino can be installed by selecting the library from the sketch option in
Toolbar.
73
SKIT, Ramnagaria, Jagatpura, Jaipur
The full form of MQTT is Message Queue Telemetry Transport Protocol. It is a messaging
protocol that is used for tracking devices in IoT.
IoT hardware includes varieties of devices like router, bridge, sensor, etc.
Raspbian
Open ELEC (Open Embedded Linux Entertainment center)
RISC OS
Lakka
OSMC (Open Source Media Centre)
Windows IoT Core
Reducing the size of the sketch is can be reduced by removing unwanted libraries from the code
and make code short and simple.
54) What are the various types of antennas designed for IoT devices?
Chip Antenna
PCB Antenna
Wire Antenna
Proprietary Antenna
Whip Antenna
74
SKIT, Ramnagaria, Jagatpura, Jaipur
M2M IoT
It uses isolated systems of devices having the It uses integrated devices, applications, and
same standards. data across varying standards.
A cellular network or wired network is used It uses an active Internet connection for
for device connectivity. device connectivity.
Machines can communicate with one Many machines can communicate with each
machine at a time. other over the Internet.
Programmers can use the Arduino IDE in order to write an Arduino program. Developers can
also use Node.js Johny five-module in order to control Arduino.
75
SKIT, Ramnagaria, Jagatpura, Jaipur
A specification called Gridfs can be used for storing high volume file into Arduino.
IoT softwares are: 1) Blockchain, 2) windows IoT, 3) Predix, 4) Microsoft Azure, 5) Bluemix,
and 6) Node-RED.
Shodan is an IOT testing tool that can be used to discover which of your devices are connected to
the Internet. It allows you to keep track of all the computers which are directly accessible from
the Internet.
A Thermocouple is a device which consists of two different conductors joined together to form
an electrical junction.
MPU6050- Gyroscope
ADXL345
piezoelectric sensor
Accelerometer
Hardware Prototypes used in IoT are 1) Raspberry Pi, 2) ARM Cortex Family, and 3) Arduino.
76
SKIT, Ramnagaria, Jagatpura, Jaipur
IoT testing is a type of testing to check IoT devices. Today there is an increasing need to deliver
better and faster services. There is a huge demand to access, create, use, and share data from any
device. The thrust is to provide greater insight and control over various interconnected IoT
devices. Hence, the IoT testing framework is important.
Thingful is a search engine for the Internet of Things. It allows secure interoperability between
millions of IoT objects via the Internet. This IOT testing tool also controls how data is used and
empowers to take more decisive and valuable decisions.
Interrupts enable specific tasks to process in the background and are enabled by default. Its main
job is to ensure the device processor responds fastly to essential events.
Asset Tracking or Asset management is the process of keeping track of physical assets and
information.
73) What are the risks associated with the IOE Internet of Everything?
Risks associated with IOE are 1) Privacy, 2) Security, 3) Network congestion, and 4) Electricity
consumption at the peaks.
74) What is the basic difference between the IoT network and Wireless Sensor Network?
77
SKIT, Ramnagaria, Jagatpura, Jaipur
Wireless Sensor Network things connected to the wireless network and gather some monitoring
environment or data. IoT contains a combination of:
WSN
Internet
Cloud Storage
web or mobile application
The network is the main part of the IoT. It is responsible for providing a practical and smart
system that makes strong infrastructure. The network offers scalability to help devices coordinate
with other lines with the Internet.
76) What is the connection between IoT and sensors in the commercial enterprise?
Sensors may be used in devices that are not net-connected, while devices need to be connected to
the Net with IoT. Yet, sensing is a part of IoT, even if the device is not connected to the Net.
Usability Testing: There are so many devices of different shape and form factors are used by
the users. Moreover, the perception also varies from one user to others. That's why checking
the usability of the system is very important in IoT testing.
Compatibility Testing: There are lots of devices that can be connected through the IoT
system. These devices have varied software and hardware configuration. Therefore, a possible
combination is huge. As a result, checking the compatibility in the IoT system is important.
Reliability and Scalability Testing: Reliability and Scalability is important for building an
IoT test environment which involves a simulation of sensors by utilizing virtualization tools
and technologies.
78
SKIT, Ramnagaria, Jagatpura, Jaipur
Data Integrity Testing: It's important to check the Data integrity in IoT testing as it requires
a large amount of data and its application.
Security testing: In the IoT environment, many users are accessing a massive amount of data.
Thus, it is important to validate user via authentication, have data privacy controls as part of
security testing.
Performance Testing: Performance testing is important to create a strategic approach for
developing and implementing an IoT testing plan.
References:
79
SKIT, Ramnagaria, Jagatpura, Jaipur
Text Books:
1. Vijay Madisetti, ArshdeepBahga, “Internet of Things-A Hands on Approach”, University
Press, 2015, ISBN: 9788173719547.
2. Dr. SRN Reddy, RachitThukral and Manasi Mishra, “Introduction to Internet of Things:
A practical Approach”, ETI Labs.
3. Pethuru Raj and Anupama C. Raman, “The Internet of Things: Enabling Technologies,
Platforms, and Use Cases”, CRC Press.
Reference Books:
1. Matt Richardson & Shawn Wallace, “Getting Started with Raspberry Pi”, O'Reilly
(SPD), 2014, ISBN: 9789350239759.
2. Jeeva Jose, “Internet of Things”, Khanna Publishing House, Delhi.
3. Adrian McEwen, “Designing the Internet of Things”, Wiley.
4. Raj Kamal, “Internet of Things: Architecture and Design”, McGraw Hill.
5. Cuno Pfister, “Getting Started with the Internet of Things”, O Reilly Media.
80