IoT WORKSHOP
IoT WORKSHOP
IoT WORKSHOP
INTRODUCTION
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
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
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
void setup()
{
// Debug console
DebugSerial.begin(9600);
void loop()
{
Blynk.run();
}
Blynk example without ethernet shield
wifi.setmode(mode)
Parameters
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())
--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> <a
href=\"?pin=OFF1\"><button>OFF</button></a></p>";
buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a> <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
1. Start
6. Apply threshold,find out the contours and set the Room Status.
SEND DATA USING SERIAL
COMMUNICATION
if text == "Occupied":
else:
Seminar by faculties & students who have developed IoT projects & are
familiar.