You are on page 1of 35

JSS MAHAVIDYAPEETHA

LABORATORY MANUAL

Subject Name: Internet of Things Lab

Subject Code: KME 553

COURSE: B. Tech SEMESTER: V

Department of mechanical Engineering


JSS ACADEMY OF TECHNICAL EDUCATION
C-20/1, SECTOR-62, NOIDA
Name:
Roll No.:
Group/Branch:

VISION OF THE INSTITUTE


JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

JSS Academy of Technical Education Noida aims to become an Institution of excellence in


imparting quality outcome-based education that empowers the young generation with
knowledge, skills, research aptitude and ethical values to solve contemporary challenging
problems.

MISSION OF THE INSTITUTE

The mission of JSS Academy of Technical Education, Noida is to


● Develop a platform for achieving globally acceptable level of intellectual acumen and
technological competence
● Create an inspiring ambience that raises the motivation level for conducting quality
research
● Provide an environment for acquiring ethical values and positive attitude

VISION OF THE DEPARTMENT

To be recognized as a Centre of Excellence in education by synergizing Teaching, Innovation


and Research in field of Mechanical Engineering.

MISSION OF THE DEPARTMENT

M1: To foster competence and excellence in Mechanical Engineering through innovative


teaching-learning processes to answer the demand from modern industries.
M2: To boost and sustain a culture of research among faculty and students thereby facilitating
them to be creative and innovative.
M3: To inculcate ethical, professional values and leadership skills among students as part of
lifelong learning.
PROGRAM EDUCATIONAL OBJECTIVE (PEOs)

PEO 1: Produce mechanical engineers with knowledge in mathematics, science and engineering
to develop problem solving skills and use modern tools and techniques necessary for
mechanical engineering & allied disciplines leading to Research and Development.

PEO 2: Strengthen themselves professionally and personally to accept responsibilities and


pursue higher education in engineering and other professional fields

PEO 3: Be capable of communicating and working effectively in cross-functional teams and


committed to principles of professional ethics and social responsibilities

PEO 4: To develop innovation & entrepreneur skills and evolve multi-disciplinary project
implementing capabilities.

2
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

PROGRAM OUTCOMES
1. Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution of
complex engineering problems.
2. Problem analysis: 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/development of solutions: 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. Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of
data, and synthesis of the information to provide valid conclusions.
5. Modern tool usage: 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. The engineer and society: 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. Environment and sustainability: Understand the impact of the professional
engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member
or leader in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with
the engineering community and with society at large, such as, being able to
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
11. Project management and finance: 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. Life-long learning: 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.

PROGRAME SPECIFIC OUTCOMES (PSOs):

PSO 1: Apply knowledge of mechanical design, modeling, simulation and analysis to


realize physical systems /processes.
PSO 2: Apply preceding knowledge of material testing and advanced manufacturing
Processes leading to Research and Development.

3
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

LIST OF EXPERIMENTS

Corresponding
Sr. No. Title of experiment CO
1 Familiarization with concept of IoT, Arduino/Raspberry Pi CO 1
and perform necessary software installation.
2 To interface motor using relay with Arduino/Raspberry Pi
CO 2
and write a program to turn ON/OFF motor
3 To interface sensors with Arduino/Raspberry Pi and write a
CO 2
program to display sensors data on the computer screen.
4 To interface LCD with Arduino/Raspberry Pi and write a CO 2
program to display sensor data on it
5 Write a program on Arduino/Raspberry Pi to upload Sensor
CO 3
data to things peak cloud
6 Develop IoT based smart lock system for Motor cycle/Car CO 4
7 Develop IoT based home security system. CO 5

4
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

COURSE OUTCOMES (COs)


Subject CO’s Cognitive
code Level
C316.1 Demonstrate Internet of Things and its hardware and software 2
components.
C316.2 Make use of I/O devices, sensors & communication modules for 3
Interfacing.
C316.3 Apply remotely monitor data and control devices. 3
C316.4 Design prototype of IoT based smart system. 4
C316.5 Develop IoT based projects for real life problem. 6

CO-PO-PSO MAPPING
Course PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO 10 PO 11 PO 12 PSO1 PSO
outcomes

CO1 3 1 3 1 1 2
CO2 3 1 3 1 1 2 1
CO3 3 2 2 3 1 2 2 1
CO4 3 3 3 3 3 1 1 2 1 3 2 3 2
CO5 3 3 3 3 3 2 2 2 1 3 2 3 2

5
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Internet of Things Lab


Syllabus L-T-P
0-0-2
Subject Code: KME 553 Internet of Things Lab L T P: 0 0 2 Credits: 1
S.No. Name of Experiment Outcome
1 Familiarization with concept of IoT, Will be able to understand IoT,
Arduino/Raspberry Pi and perform necessary Arduino/Raspberry Pi, and also able to
software installation. install software setup of Arduino/
Raspberry Pi
2 To interface motor using relay with Able to use relay to control motor and
Arduino/Raspberry Pi and write a program to turn other mechanical devices
ON/OFF motor.
3 To interface sensors with Arduino/Raspberry Pi Able to retrieve data from sensors and to
and write a program to display sensors data on the display it on computer screen
computer screen.

4 Interface OLED with Arduino/Raspberry Pi and Able to retrieve data from sensors and to
write a program to display sensor data on it. display it on OLED
5 To interface sensor with Arduino/Raspberry Pi Able to control relay with help of
and write a program to turn ON/OFF Relay when microcontroller and sensors
sensor data is detected.
6 To interface sensor with Arduino/Raspberry Pi Able to control Solenoid valve with help
and write a program to turn ON/OFF Solenoid of
valve when sensor data is detected. microcontroller and sensors
7 To interface sensor with Arduino/Raspberry Pi Able to control linear actuator with help of
and write a program to turn ON/OFF Linear microcontroller and sensors
Actuator when sensor data is detected.
8 To interface sensor with Arduino/Raspberry Pi Able to control Starter Motor with help of
and write a program to turn ON/OFF Starter microcontroller and sensors
Motor when sensor data is detected.
9 To interface Bluetooth with Arduino/Raspberry Pi Able to communicate sensor data from
and write a program to send sensor data to smart microcontroller to smart phone
phone using Bluetooth.
10 To interface Bluetooth with Arduino/Raspberry Pi Able to control actuators using mobile
and write a program to turn Actuators* ON/OFF phone through Bluetooth
when message is received from smart phone using
Bluetooth.
11 Write a program on Arduino/Raspberry Pi to Able to upload status of devices and
upload Sensor data to things peak cloud. sensors on web cloud
12 Write a program on Arduino/Raspberry Pi to Able to retrieve status of devices and
retrieve sensors data from things peak cloud. sensors from web cloud
13 Develop IoT based smart lock system for Motor Able to develop smart lock system of
cycle/Car. motor cycle/car
14 Develop IoT based Smart water flow system Able to develop smart water flow system
15 Develop IoT based home security system Able to develop smart home security
system

6
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

DETAILS OF THE EXPERIMENTS CONDUCTED


(TO BE USED BY THE STUDENTS IN THEIR RECORDS)

MARKS
SR.
DATE OF EXPT. PAGE AWARD FACULTY SIGNATURE
NO TITLE OF THE EXPERIMENT
CONDUCTION NO NO. ED WITH REMARK
.

Familiarization with concept of IoT,


1 1 Arduino/Raspberry Pi and perform necessary
software installation.
To interface motor using relay with
2 2 Arduino/Raspberry Pi and write a program to
turn ON/OFF motor
To interface sensors with Arduino/Raspberry Pi
3 3 and write a program to display sensors data on
the computer screen.
4 4 To interface LCD with Arduino/Raspberry Pi
and write a program to display sensor data on it
5 5 Write a program on Arduino/Raspberry Pi to
upload Sensor data to things peak cloud
6 6 Develop IoT based smart lock system for Motor
cycle/Car
7 7 Develop IoT based home security system.

7
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Experiment No 1
Aim: Familiarization with concept of IoT, Arduino/Raspberry Pi and perform necessary
software installation.
Objectives: Student should get the knowledge of Arduino IDE and different types of Arduino
Board
Outcomes: Student will be got knowledge of Arduino IDE and different types of Arduino Board
Arduino: Arduino is a prototype platform (open-source) based on an easy-to-use hardware and
software. It consists of a circuit board, which can be programmed (referred to as a
microcontroller) and a ready-made software called Arduino IDE (Integrated Development
Environment), which is used to write and upload the computer code to the physical board.
Arduino provides a standard form factor that breaks the functions of the microcontroller into a
more accessible package.
Arduino is a prototype platform (open-source) based on an easy-to-use hardware and software. It
consists of a circuit board, which can be programmed (referred to as a microcontroller) and a
ready-made software called Arduino IDE (Integrated Development Environment), which is used
to write and upload the computer code to the physical board.
The key features are –
∙ 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. You can simply use
a USB cable.
∙ 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. Download the Arduino Software (IDE)
∙ Get the latest version from the arduino.cc web site. You can choose between the Installer (.exe)
and the Zip packages. We suggest you use the first one that installs directly everything you need
to use the Arduino Software (IDE), including the drivers. With the Zip package you need to
install the drivers manually. The Zip file is also useful if you want to create a portable
installation.

8
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

∙ When the download finishes, proceed with the installation and please allow the driver
installation process when you get a warning from the operating system

Choose the components to install

∙ Choose the installation directory (we suggest to keep the default one)

9
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

∙ The process will extract and install all the required files to execute properly the Arduino
Software (IDE)
∙ Proceed with board specific instructions
∙ When the Arduino Software (IDE) is properly installed you can go back to the
Different Arduino Boards:
Arduino USB
1.Arduino uno: This is the latest revision of the basic Arduino USB board. It connects to the
computer with a standard USB cable and contains everything else you need to program and use
the board.
2.Arduino NG REV-C:
Revision C of the Arduino NG does not have a built-in LED on pin 13 - instead you'll see two
small unused solder pads near the labels "GND" and "13".
3. Arduino Bluetooth:
The Arduino BT is a microcontroller board originally was based on the ATmega168, but now is
supplied with the 328, and the Blue giga WT11 Bluetooth module. It supports wireless serial
communication over Bluetooth.

10
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

4. Arduino Mega The original Arduino Mega has an ATmega1280 and an FTDI USB-to serial
chip.
5. Arduino NANO
The Arduino Nano 3.0 has an ATmega328 and a two-layer PCB. The power LED moved to the
top of the board.

11
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Experiment No 2

Aim: To interface motor using relay with Arduino/Raspberry Pi and write a program to turn
ON/OFF motor.
Objectives: Student should get the knowledge of Arduino Board and how to control stepper
motor using relay with Arduino.
Outcomes: Student will be Write program using Arduino IDE for ON/OFF stepper motor using
relay.
Hardware Requirements:
∙ 1x Arduino Uno R3
∙ 1x SPDT Relay
∙ Stepper motor
∙ 4x Jumper Wires (Red, , blue, black)

Hardware connections:

Motor Driver Connection:


Pin #10-13 (CN29) :-> I1-I4 (CN38)
Motor Connection:
W1-W4 (CN40) :-> 4 Winding cables of Stepper Motor
Vcc Cable of Motor :-> 5V
Program to turn ON/OFF of stepper motor
#include <Stepper.h> //Include the Arduino Stepper Library
// Define Constants
const float STEPS_PER_REV = 32; // Number of steps per internal motor revolution
const float GEAR_RED = 64; // Amount of Gear Reduction
const float STEPS_PER_OUT_REV = STEPS_PER_REV * GEAR_RED; // Number of steps
per geared output rotation
// Define Variables
int StepsRequired; // Number of Steps Required
Stepper steppermotor(STEPS_PER_REV, 10, 11, 12, 13);
void setup()
{
// Nothing (Stepper Library sets pins as outputs)
}

12
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

void loop()
{
Steps Required = STEPS_PER_OUT_REV / 2;
steppermotor. setSpeed (10);
steppermotor.step(StepsRequired);
delay(1000);
}

Experiment No. 3

13
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Aim: To interface sensors with Arduino/Raspberry Pi and write a program to display sensors
data on the computer screen.
Objectives: Student should get the knowledge of Temperature and Humidity Sensor
Outcomes: Student will be developed programs using Arduino IDE and Arduino Board for DHT
11 Temperature Sensor.
Connecting to a DHT 11 Sensor
These sensors have little chips in them and while they're not that delicate, they do need to be
handled properly. Be careful of static electricity when handling them and make sure the power
supply is connected up correctly and is between 2.7 and 5.5V DC - so don't try to use a 9V
battery!
They come in a "TO-92" package which means the chip is housed in a plastic hemi-cylinder with
three legs. The legs can be bent easily to allow the sensor to be plugged into a breadboard. You
can also solder to the pins to connect long wires. If you need to waterproof the sensor, you can
see below for an Instruct able for how to make an excellent case.
Hardware Requirements:

● 1x Arduino Uno R3

● 4x Jumper Wires

● 1X dht 11 temperature and humidity sensor

Hardware connections:

DHT11 Connection:
Pin #2 (CN27) :-> DATA (CN42)
Program for display sensor data on a computer screen(Serial Monitor)
#include <Wire.h>
#include <dht11.h>
#define DHT11PIN 2
dht11 DHT11;
void setup()
{
Serial.begin(9600);
}

14
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

void loop()
{
Serial.println();
int chk = DHT11.read(DHT11PIN);
Serial.print("Humidity (%): ");
Serial.println((float)DHT11.humidity, 2);
Serial.print("Temperature (C): ");
Serial.println((float)DHT11.temperature, 2);
delay(2000);
}

15
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Experiment No. 4
Aim: To interface LCD with Arduino/Raspberry Pi and write a program to display sensor data
on it.
Objectives: Student should get the knowledge to collect the temperature and humidity data
using the DHT11 sensor.
Outcomes: Student will be developed programs using Arduino IDE and Arduino board for
DHT11 sensor.
Hardware Requirements:

● 1x Arduino Uno R3

● 8x Jumper Wires

● 1 X LCD

● 1X DHT 11 sensor

Hardware connections:

DHT11 Connection:
Pin #2 (CN27) :-> DATA (CN42)
LCD Connection:
(CN31) :-> (CN10)
A4(SDA) :-> SDA
A5(SCL) :-> SCL
Program for display sensor data on a LCD screen
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <dht11.h>
#define DHT11PIN 2
LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7); // Set the LCD parameters (I2C Address, En, RW,
RS, D4, D5, D6, D7)
dht11 DHT11;
void setup()

16
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

{
Serial.begin(9600);
lcd.begin (16,2); // for 16 x 2 LCD module
}
void loop()
{
Serial.println();
lcd.setCursor(0, 0);
int chk = DHT11.read(DHT11PIN);
Serial.print("Humidity (%): ");
Serial.println((float)DHT11.humidity, 2);
lcd.print("Humidity:");
lcd.print((float)DHT11.humidity);
lcd.setCursor(0, 1);
lcd.print("Temp :");
lcd.print((float)DHT11.temperature);
Serial.print("Temperature (C): ");
Serial.println((float)DHT11.temperature, 2);
delay(2000);
}

17
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Experiment No. 5
Aim: Write a program on Arduino/Raspberry Pi to upload Sensor data to things peak cloud.
Objectives: Student should get the knowledge to upload Sensor data to things peak cloud
Outcomes: Student will be developed programs using Arduino IDE and Arduino board with
WiFi module (ESP8266)

Components Required

1. Arduino board
2. 8x Jumper Wires
3. WiFi (ESP8266) or Internet
4. DHT 11 Sensor

Hardware Connection

DHT11 Connection:

Vcc and Ground of DHT11 are internally connected to +5V and GND respectively.

Pin #6 (CN28): DATA (CN42)

ESP8266 Connection:

Vcc and Ground of ESP8266 are internally connected to 3V3 and GND respectively.

Pin #10 (CN29) : Tx (CN14)

Pin #11 (CN29) : Rx (CN14)

Steps for building Arduino Data Logger on Cloud

Step 1: Signup for Thing Speak


For creating your channel on Thing Speak you first need to sign up on Thing Speak. In case if
you already have account on Thing Speak just sign in using your id and password.
For creating your account go to www.thinspeak.com

18
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Click on signup if you don’t have account and if you already have account click on sign in.
After clicking on signup fill your details.

After this verify your E-mail id and click on continue.


Step 2: Create a Channel for Your Data
Once you Sign in after your account verification, create a new channel by clicking “New
Channel” button

19
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Give channel a name and Add Two Fields by selecting box next to them and write names for
them.

Field 1 : Humidity

Field 2 : Temperature

- Complete Channel creation by clicking on ‘Save Channel’

-> Making Channel Public

Click on Sharing and then select ‘Share channel view with everyone’.

-> Write and Read API keys are available under API Keys, if you need to write/read data
on/from the channel.
Step 3: Getting API Key in Thing Speak
To send data to Thing Speak, we need an unique API key, which we will use later in our python
code to upload our CPU data to Thing Speak Website.
Click on “API Keys” button to get your unique API key for uploading your CPU data.

20
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Now copy your “Write API Key”. We will use this API key in our code.
Step 4: Code for Arduino
//#include "dht.h"
#include <SoftwareSerial.h>
#define RX 10
#define TX 11
#define DHT11_PIN 6 data out pin of DHT11 is connected to pin 6 of arduino
dht DHT;
String AP = "EXCEL51"; enter the network name you want to connect the esp8266
String PASS = "12345678"; // enter its password
String API = "XNNYW4MO0ZG9IM7Q"; // enter your channel API write key
String HOST = "api.thingspeak.com";
String PORT = "80"; //universal port defined for http
String field = "field1";
int countTrueCommand;
int countTimeCommand;
boolean found = false;
int valSensor1 = 1;
int valSensor2 = 1;

21
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

int temp, humi;


Software Serial esp8266(RX, TX);
void setup() {
Serial.begin(9600);
esp8266.begin(115200); /baud rate at which esp works (its default value is 115200 but we
changed it)
sendCommand("AT", 5, "OK");
sendCommand("AT+CWMODE=1", 5, "OK");
sendCommand("AT+CWJAP=\"" + AP + "\",\"" + PASS + "\"", 20, "OK");
}
void loop() {
valSensor1 = getSensorData();
valSensor2 = getSensorData1();
String getData = "GET https://api.thingspeak.com/update?
api_key=XNNYW4MO0ZG9IM7Q&field1=0" + String(valSensor1) + "&field2=" +
String(valSensor2); // replace key with your write key
sendCommand("AT+CIPMUX=1", 5, "OK");
sendCommand ("AT+CIPSTART=0,\"TCP\",\"" + HOST + "\"," + PORT, 15, "OK");
sendCommand("AT+CIPSEND=0," + String(getData.length() + 4), 4, ">");
esp8266.println(getData); delay(1500); countTrueCommand++;
sendCommand("AT+CIPCLOSE=0", 5, "OK");
}
int getSensorData1() {
int chk = DHT.read11(DHT11_PIN);
DHT.read11(DHT_dpin);
temp = DHT.temperature;
return temp;
}
int getSensorData() {
int chk = DHT.read11(DHT11_PIN);
// DHT.read11(DHT_dpin);
humi = DHT.humidity;
return humi;

22
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

}
void sendCommand(String command, int maxTime, char readReplay[]) {
Serial.print(countTrueCommand);
Serial.print(". at command => ");
Serial.print(command);
Serial.print(" ");
while (countTimeCommand < (maxTime * 1))
{
esp8266.println(command);//at+cipsend
if (esp8266.find(readReplay)) //ok
{
found = true;
break;
}
countTimeCommand++;
}

if (found == true)
{
Serial.print("humi = ");
Serial.println(DHT.humidity);
Serial.print("temp = ");
Serial.println(DHT.temperature);
Serial.println("OK");
countTrueCommand++;
countTimeCommand = 0;
}
if (found == false)
{
Serial.println("Fail");
countTrueCommand = 0;
countTimeCommand = 0;
}

23
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

found = false;
}
Step 6: Check Thing Speak site for Data Logging
After completing these steps open your channel and you will see the CPU temperature data is
updating into Thing Speak website.

Like this you can send any sensor data connected with Raspberry pi to the Thing Speak Cloud.
In next article we will connect LM35 temperature sensor with Raspberry Pi and send the
temperature data to Thing Speak, which can be monitored from anywhere.

24
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Experiment No. 6
Aim: Develop IoT based smart lock system for Motor cycle/Car
Objectives: Student should get the knowledge to develop IoT based smart lock system for Motor
cycle/Car
Outcomes: Student will be developed programs using Arduino IDE and develop IoT based
smart lock system for Motor cycle/Car
Components Required
1. Arduino Nano R3
2. HC-05 Bluetooth Module
3. Relay (generic)
4. General purpose Transistor NPN

5. Resistor 1K Ohm
6. 1N4007-High voltage and High current rated Diode
7. Linear Regulator (7805)
8. Capacitor 1microFarad

Smart Central lock device for motorcycle (bike). by using this device, you can control your bikes
ignition lock. you can Lock/ unlock it remotely. Also, can start and stop the engine by using your
smartphone. So, let's see how you can make one by yourself.

you need all the above mentions components to make this device

25
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Let us understand the circuit. starts from the input power supply. it needs 12 Volt DC power
supply to operate. I added a Diode Bridge here to protect this circuit from reverse polarity. after
that bridge, I Stepped down the voltage into 5 volts by using a linear voltage regulator IC
LM7805. then its feed to Arduino nano and to the Bluetooth module. Bluetooth module
connected with Arduino using Tx & Rx pins As Bluetooth's Tx pin goes to Arduino's Rx pin
And Bluetooth's Rx pin goes to Arduino's Tx pin. transistor T1 And T2 Acting as Switch To
control the Relay RLY1 & RLY2 respectively. the base of the transistor T1 is connected with the
digital pin 5 of Arduino through a current limiting resistor of 1k. and the base of T2 is connected
to digital pin 4 of Arduino.

26
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

//for Bluetooth Central Lock device.


int LCK=4; //left motor output 1
int SLF=5; //left motor output 2
char d=0;
int FLG=0;
void setup()
{
pinMode (LCK, OUTPUT);
pinMode(SLF,OUTPUT);
Serial.begin(38400);
}
void loop()
{
if(Serial. Available ()>0)
{
d=Serial. Read();
Serial.println(d);
if(d=='B')
{
digital Write (LCK, HIGH);
FLG=1;
}
if(d=='A' && FLG==1)
{
digital Write(SLF,HIGH);
}
else
{
digital Write(SLF,LOW);
}
if(d=='C')
{
digitalWrite(LCK,LOW);
digitalWrite(SLF,LOW);
FLG=0;
}
}
}

Now connect the Bluetooth module with the circuit.

27
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Open battery cover And Seat. and put this device in a suitable position where you find enough
space for it.

now combine yellow, Green and Red wire and connect them to the positive terminal of the
battery. find the flasher relay. it is usually placed near to the battery bellow seat.

28
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

grab that 2-terminal relay and disconnect it from its wire harness. now connect ignition relay
wire from our device that is yellow wire to the positive terminal of this connector. now a
question arises here, that how to find out which one is the positive terminal? so to find out that
take a piece of wire connect it's one end to the positive terminal of the battery and touch the
other end of the wire to both ends of the relay harness. The ignition will be on when the second
end of the wire is at any one terminal of the relay harness. The point at which the ignition is on is
the positive point of the relay. now connect the yellow wire to that point and put back the flasher
relay.

29
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

now connect the starter relay wire. for that search for start relay. in my case, it is placed under
the fuel tank. just remove it and find out the positive terminal of this relay also. now to find out
this take a 12volt bulb attach one end of bulb to the negative terminal of the battery and second
end of it to one of the ends of start relay harness. and press start button of bike. remember that
while testing this you should have to turn on ignition using your keys. now on which point of
relay harness bulb will glow that is the target point. now connect green wire into that point and
insert back the start relay. and fix it on its position. now all done.

30
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Note: if you are not familiar with bike/motorcycle wirings please don't try it without the help of
any bike mechanic. wrong wiring can burn your bike.

turn on Bluetooth, search for new device, click on HC-05. enter 1234/0000 if it asks for a
password. 1234/0000 is the default password for HC-05, you can change this password by
changing its setting. to know more about the Bluetooth module setting visit my previous tutorial.
if you still not understand how to change that setting let me know in the comment box and I will
make a short note on how to change the Bluetooth setting.

31
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

once you connected with device you are ready to operate Lock/Unlock ignition by sliding the
switch on the app.

32
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

Experiment No. 7
Aim: Develop IoT based Home security system.
Objectives: Student should get the knowledge to Develop IoT based home security system.
Outcomes: Student will be developed programs using Arduino IDE and Develop IoT based
home security system.
Components Required
1) TI CC3200 Launch pad
2) Accessible WIFI
3) PIR motion detector Sensor
4) Alarm
5) Relays for connecting home appliances, electromechanically
controlled doors or windows,
6) Mobile phone to receive Voice Call
7) Energeia (Software)

Fig. Security and Home Automation


PIR motion sensors are installed at the entrances of a building. These sensors as explained earlier
detect the motion of human beings. This signal which detects their presence becomes the input
trigger for the micro-controller. The owner, who may or may not be present in that building, will
be receiving a voice call on his mobile phone (whose number is predefined in the program)
stating that ’There is an Intruder in the House’. To turn ON the lights and alarm at house so that

33
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

the intruder will be warned, the owner can press ’1’ from his mobile keypad. Moreover, if the
owner finds that his building is not safe, he can send an SMS to the concerned authority in police
department; explaining his situation. The module will turn OFF the alarm and lights after a fixed
time delay. The call will be triggered again as soon as the module detects any unexpected motion
and the owner will receive the call again and the process continues so on. (To ensure the safety
from other entrances too, motion sensor should be installed at those places and will be controlled
by a single micro-controller).

As a smart home automation system

This application of the module can be explained by an example. Suppose the owner is expecting
a guest at his house but he is not available there. Now, as the guests reach at his house the owner
will receive a video call. But now the owner
can press digits other than 1 (such as 3 for lights, 4 for fan, 5 for A.C., and so on) or even can
disable the security system. Similarly, if the user or somebody leaves the house, the user will

34
JSS Academy of Technical Education – NOIDA
Internet of Things Lab (KME 553) Manual (Mechanical, V Semester)

still receive a video call and this time he can switch Off the appliances or can enable the security
system again by pressing proper digits known to him. Since the appliances are connected to
mains supply through a relay, they can be easily controlled using micro-controller.

35

You might also like