Hello there!Today we will give you tutorial on motion detection on mobile application (Blynk).
Blynk:It is a platform where you can develop your application according to your requirement.It is very much easy to use and does not require any knowledge about software development.You can learn it through tutorials on internet.
About:In this tutorial, we will be using a motion sensor, surilli wifi and Blynk application. We have already developed Blynk application you just have to scan the QR code (given below) and you will get the application, surilli wifi is programmed with a basic program, so whenever a motion is detected it is displayed on your application.
Blynk application:Download Blynk from your play store, then open Blynk, login using your email or facebook.
Now that you have logged in, you have to scan theQR code by using the indicated button in the following picture
Scan the following QR code
Now an authentication code will be send to you by an email or can also be viewed in your project settings.This code will be used in your program which will be uploaded on surilli wifi.
NOTE:You can also develop your own application onBlynk.
The circuitry:- Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE and hit upload.
- After it is uploaded, the PIR Motion sensor will start detecting motion
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "************************";//Enter
char ssid[] = "*********";//enter
char pass[] = "*******";//enter
int motion_Sensor_Pin = 16;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
Serial.begin(9600);
pinMode (motion_Sensor_Pin, INPUT);
}
void loop()
{
Blynk.run();
Blynk.syncAll();
}
BLYNK_READ(V0)
{
int sensor_value = digitalRead(16);
if (sensor_value == 1)
{
Blynk.virtualWrite(V0, "Motion Detected");
Serial.println(sensor_value);
WidgetLED led1(V1);
led1.on();
delay(100);
}
else if (sensor_value == 0)
{
Blynk.virtualWrite(V0, "NO Motion Detected");
Serial.println(sensor_value);
WidgetLED led1(V1);
led1.off();
delay(100);
}
}.
Uses:· It can be used for security purposes in your office or home, it will help you detect any unwanted motion in your surrounding.
· It can also be used for automation, for e.g if motion is detected, light is switch "on" or "off" and if door is opened or closed light is switched "on".
Play with the program to see how it reacts to different values and logic. This will develop your understanding about motion sensors so you can use them in your practical application.
Comments