You are on page 1of 38

IoT WORKSHOP

INTRODUCTION

The internet of things (IoT) is the internetworking of


physical devices, vehicles (also referred to as
"connected devices" and "smart devices"), buildings
and other itemsembedded with electronics, software,
sensors, actuators, and network connectivity that
enable these objects to collect and exchange data.
Introduction to Arduino
Arduino is an open-source project that created microcontroller-based kits for
building digital devices and interactive objects that can sense and control
physical devices.

These systems provide sets of digital and analog input/output (I/O) pins that
can interface to various expansion boards (termed shields) and other
circuits. The boards feature serial communication interfaces, including
Universal Serial Bus (USB) on some models, for loading programs from
personal computers.

The first Arduino was introduced in 2005, aiming to provide a low cost, easy
way for novices and professionals to create devices that interact with their
What is the Arduino?
Our First Program

1.Download & install the Arduino environment (IDE)


2.Connect the board to your computer via the USB cable
3.Launch the Arduino IDE
4.Select your board and your serial port
5. Goto FILE->EXAMPLES->BASICS->BLINK
6.Upload the program
TERMINOLOGY
Basic Functions

pinMode(pin, mode)
->Sets pin to either INPUT or OUTPUT
digitalRead(pin)
->Reads HIGH or LOW from a pin
digitalWrite(pin, value)
->Writes HIGH or LOW to a pin
Interfacing with
Sensors
LDR

A photoresistor (or light-dependent resistor, LDR, or photocell) is a light-controlled


variable resistor.

The resistance of a photoresistor decreases with increasing incident light intensity; in


other words, it exhibits photoconductivity.
LDR INTERFACING
Temperature Sensor LM35

The LM35 series are precision integrated-circuit temperature devices with an output
voltage linearly-proportional to the Centigrade temperature.

The LM35 device has an advantage over linear temperature sensors calibrated in
Kelvin, as the user is not required to subtract a large constant voltage from the
output to obtain convenient Centigrade scaling.
Interfacing with Temperature Sensor
Blynk

Blynk was designed for the Internet of Things. It can control hardware remotely, it can display sensor
data, it can store data, vizualize it and do many other cool things.
There are three major components in the platform:
Blynk App - allows to you create amazing interfaces for your projects using various widgets we
provide.
Blynk Server - responsible for all the communications between the smartphone and hardware.
You can use our Blynk Cloud or run your private Blynk server locally. Its open-source, could
easily handle thousands of devices and can even be launched on a Raspberry Pi.
Blynk Libraries - for all the popular hardware platforms - enable communication with the server
and process all the incoming and outcoming commands.
Blynk example without ethernet shield
1.OpenOpen Arduino Serial USB example and change Auth Token
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#define BLYNK_PRINT DebugSerial


#include <BlynkSimpleStream.h>

// You should get Auth Token in the Blynk App.


// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

void setup()
{
// Debug console
DebugSerial.begin(9600);

// Blynk will work through Serial


Serial.begin(9600);
Blynk.begin(auth, Serial);
}

void loop()
{
Blynk.run();
}
Blynk example without ethernet shield

2.Run the script which is usually located in /scripts folder:


Windows:My Documents\Arduino\libraries\Blynk\scripts
Mac User$/Documents/Arduino/libraries/Blynk/scripts
On Windows:
Open cmd.exe
Write your path to blynk-ser.bat folder. For example:
cd C:\blynk-library-0.3.1\blynk-library-0.3.1\scripts
Run blynk-ser.bat file. For example : blynk-ser.bat -c COM4 (where COM4 is port with your Arduino)
And press Enter, press Enter and press Enter
NODEMCU AN IOT BREAKTHROUGH

NodeMCU is an open source IoT platform. It includes firmware which runs on


the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware[6] which is
based on the ESP-12 module. The term "NodeMCU" by default refers to the
firmware rather than the dev kits. The firmware uses the Lua scripting
language. It is based on the eLua project, and built on the Espressif Non-OS
SDK for ESP8266. It uses many open source projects, such as lua-cjson,and
spiffs.
An advanced NODEMCU example
Syntax

wifi.setmode(mode)

Parameters

mode value should be one of

wifi.STATION for when the device is connected to a WiFi router. This is often done to give the device access to the Internet.

wifi.SOFTAP for when the device is acting only as an access point. This will allow you to see the device in the list of WiFi networks
(unless you hide the SSID, of course). In this mode your computer can connect to the device, creating a local area network. Unless
you change the value, the NodeMCU device will be given a local IP address of 192.168.4.1 and assign your computer the next
available IP address, such as 192.168.4.2.

wifi.STATIONAP is the combination of wifi.STATION and wifi.SOFTAP. It allows you to create a local WiFi connection and
connect to another WiFi router.
Code

print("ESP8266 Server")
wifi.setmode(wifi.STATIONAP);
wifi.ap.config({ssid="test",pwd="12345678"});
print("Server IP Address:",wifi.ap.getip())

-- 30s timeout for an inactive client


srv = net.createServer(net.UDP, 30)
-- server listens on 5000, if data received, print data to console
srv:listen(5000, function(sk)
sk:on("receive", function(sck, data)
print("received: " .. data)
end)
sk:on("connection", function(s)
print("connection established")
end)
end)
Code continued

--wifi.setmode(wifi.SOFTAP)
--wifi.sta.config("jio","123456789")
--print(wifi.sta.getip())
led1 = 3
led2 = 4
gpio.mode(led1, gpio.OUTPUT)
gpio.mode(led2, gpio.OUTPUT)
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive", function(client,request)
local buf = "";
local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
if(method == nil)then
_, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
end
local _GET = {}
Code continued

if (vars ~= nil)then
for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
_GET[k] = v
end
end
buf = buf.."<h1> ESP8266 Web Server</h1>";
buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a
href=\"?pin=OFF1\"><button>OFF</button></a></p>";
buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a
href=\"?pin=OFF2\"><button>OFF</button></a></p>";
local _on,_off = "",""
if(_GET.pin == "ON1")then
gpio.write(led1, gpio.HIGH);
elseif(_GET.pin == "OFF1")then
gpio.write(led1, gpio.LOW);
elseif(_GET.pin == "ON2")then
Code continued
gpio.write(led2, gpio.HIGH);
elseif(_GET.pin == "OFF2")then
gpio.write(led2, gpio.LOW);
end
client:send(buf);
client:close();
collectgarbage();
end)
end)
A demo of MOTION DETECTION
using PYTHON,OPENCV AND
ARDUINO.
Objectives

To reduce the power consumption and save electricity by a


measurable amount.

Take a step forward towards living in a green world.

To automate the system with a minimum user interaction.

Extend the functionality of CCTV's/camera's by making it smarter and


hence reducing the cost of implementing the new system.
MOTION
DETECTION
Initial 100 frames are
used for background
modelling.

It removes fast changing


motion and also
eliminates the effects
produced by variable
lighting conditions
and noise.

The lights are kept OFF


MOTION
DETECTION
As soon as it detects any
motion , it draws a
rectangle around it
due to the contours
formed.

The Room Status is


changed to occupied.

The lights are Turned


ON.
ALGORITHM

1. Start

2. Initialize the camera.

3. Perform the Background Modelling using running average technique.

4. Capture the current frame.

5. Convert it to GrayScale and apply Gaussian Blur.

6. Apply threshold,find out the contours and set the Room Status.
SEND DATA USING SERIAL
COMMUNICATION

Import serial #library for serial communication(PySerial)

ser = serial.Serial('COM7', 9600, timeout=0.1) #establish a connection

if text == "Occupied":

ser.write("1") #send data to turn on light(High)

else:

ser.write("0") #send data to turn off light(Low)


ARDUINO CODE
IoT
FORUM
Introduction to IoT FORUM
Internet of Things(IoT) FORUM was established in 2016 in order to enhance
the engineering graduates capable of accepting challenges in the new
Internet of Things environment. It was formally inaugurated by Dr. SACHIN
SAKHARE, HOD Computer Department, VIIT on 21st July, 2016.
The idea behind the creation of IoT Forum was to unite students from various
departments and work together in achieving excellence in this very new,
exciting and challenging multi-disciplinary field called Internet of Things. It
also aims at aspiring students to work on the latest Technology that is
ruling and will continue to rule the Industry in the coming years.
Activities Planned By IoT FORUM

1. DEVELOPMENT OF IOT LAB


2. PRODUCT DEVELOPMENT FOR COLLEGE
3. BE PROJECTS
4. INTERNSHIPS
5. WORKSHOPS
6. GUESTS LECTURE, SEMINARS BY INDUSTRY EXPERTS
7. INDUSTRIAL VISITS
Opportunities
The IoT Forum firmly believes not only in providing the technical knowledge
but also the overall development of an individual.

It provides individual with opportunities like delivering a lecture, conducting a


workshop, present their innovative ideas in front of a large crowd etc which
helps them in becoming stage-confident.

It also encourages the individual to discover the leader in them by providing


them various posts at the TE and BE level.

It also provides them opportunities to organize events which in turn help


WORKING OF IOT FORUM

IoT Forum conducts monthly meetings wherein ,

All students come up with new innovative ideas of IoT projects

Discussion on various topics related to IoT

Seminar by faculties & students who have developed IoT projects & are
familiar.

Guidance & encouragement by Teachers/Students at any point if one


requires.

You might also like