You are on page 1of 7

See

discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/317370136

Home security alarm notification with


smartphone and Blynk

Research June 2017


DOI: 10.13140/RG.2.2.32529.43369

CITATIONS READS

0 11

1 author:

M. Todica
Babe-Bolyai University
81 PUBLICATIONS 252 CITATIONS

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

IR and Raman Investigation of Some Poly(acrylic) Acid Gels in Aqueous and Neutralized State View
project

Serwo and RGB led feedback with smartphone and Blynk View project

All content following this page was uploaded by M. Todica on 06 June 2017.

The user has requested enhancement of the downloaded file.


Home security alarm notification with smartphone and Blynk
M. Todica

This work presents how to receive notifications on the smartphone, via internet, from
security alarm sensors working on 315/433 Mhz. No hardware or software intervention
on the original sensors is needed. The only requested condition is that the receiver of our
system should be placed in the area of radiation of the radio transmitter sensor, and in the
working area of wirelesses internet router. Notifications can be sent from any kind of
sensor, PIR, magnetic, temperature, etc. with radio transmitter. The sensors can be
connected to theirs original mother alarm system or can be managed separately, without
any connection with the alarm system. For instance in this work we use a PIR sensor,
alone, without any connection to the mother alarm system, (Fig. 1). When a motion is
detected the sensor sends the code which is received by our system and transmitted
trough internet to the smarphone. That means the
motion is detected. We need the following
materials:
One sensor with RF 315/433 Mhz transmitter, one
receiver module 315/433 Mhz and one board
NodeMCU ESP-V3 or WeMos D1-R2. Optionally
we can add RGB led to our project. The
connection of the radio module and RGB led are
shown in figure 2 for NodeMcu board, (data pin of
radio to D2), and in figure 3 for WeMos D1-R2
board, (data pin of radio to D4). As radio can be
used super heterodyne (Fig. 2), or super
regenerative modules (Fig. 3). Both can be power
Fig. 1. PIR sensor with with +3.3V, but better results are obtained with
433Mhz transmitter +5V supply. In this case the data pin of Rx
modules must be connected to pins D2
respectively D4 using a resistive divider 2/3 in order to avoid signals higher than 3.3V on
the entries of NodeMcu or WeMos boards. The RGB led is connected to GND, D7, D6
and D5 for NodeMcu, or GND, D13, D12 and D11 for WeMos. The RGB led is
controlled by widget buttons attached to digital pins D12 and D13 on Blynk. The led can
be replaced by relay if we want to send other orders to the board, for instance arming or
disarming the alarm, open or closing lights, etc. The led connected to D5 respectively to
D13 flashes every time when a radio code is received.
To do this project we must follow the next steps.

Step one. Setting Arduino to recognize and communicate with the ESP266 NodeMcu or
WeMos board. The protocol is similar with the procedure of installing ESP8266-01. A
very good tutorial can be found to the link:
http://www.instructables.com/id/Programming-ESP8266-ESP-12E-NodeMCU-Using-
Arduino-/?ALLSTEPS
Alternatively can be used the procedure described in previous work,
Controlling by smartphone via internet two relays with Blynk and ESP 8266-01
DOI: 10.13140/RG.2.2.31986.91847
We must install the library RCSwitch from the link below:
https://github.com/sui77/rc-switch/

Step two. Uploading the code. We used Arduino 1.6.8 version. After connecting the
board NodeMcu or WeMos to the computer, we upload the code below:

+Vcc GND
Antenna
Data
17 cm

Fig. 2. Connection of Rx module and RGB led to NodeMcu board

The code.
////////////////////
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;

char auth[] = " enter your char auth ";


//enter your char auth

char ssid[] = "your SSID";


//enter the name of your WI FI router
char pass[] = " your password ";
//enter the password of your router
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

void setup() {
pinMode(14,OUTPUT);
//control the led connected to D13 of the board WeMos
Blynk.begin(auth, ssid, pass);
Serial.begin(9600);

mySwitch.enableReceive(4);
// Rx DATA of radio connected to D2 of NodeMcu
// Rx DATA of radio connected to D4 of WeMos
timer.setInterval(500L, sendUptime);

}
void loop()
{
Blynk.run();
timer.run(); // Initiates SimpleTimer

void sendUptime()
{
if (mySwitch.available()) {

Serial.print("Received ");
Serial.println( mySwitch.getReceivedValue() );
//displays on PC monitor the received codes
Serial.print(" / ");

digitalWrite(14,HIGH);
//the led on D13 of WeMos board will shine if any code is received
int code=mySwitch.getReceivedValue();
Blynk.virtualWrite(12, " Code= ");
Blynk.virtualWrite(12, code);
//displays on terminal widget V12 the received code
mySwitch.resetAvailable();
}
else
{
Blynk.virtualWrite(12, " NO Code ");
Serial.println(" No Received ");
digitalWrite(14,LOW);
}
//mySwitch.resetAvailable();
}
////////////////////
End of the code

Step three. Setting Blynk application.


Download Blynk application and install it on the smartphone from the link:
http://www.blynk.cc/getting-started.
Create an account with your email and password. Open a new project, give it a name and
select your board, (ESP 8266), (Fig. 4). It is the same for both NodeMcu or WeMos. The
Blynk server will sent by e-mail "YourAuthToken" to you. Introduce the AuthToken into

17 cm
antenn
a

Fig. 3. Connection of Rx module and RGB led to WeMos D1-R2 board


the Arduino code. Go to the Widget Box and add widget terminal on virtual V12, (Fig. 4,
5). Run Blynk application on the smartphone. Every time when a code is received from
the alarm sensor, the code will be displayed on the terminal widget. If we want to activate
the RGB led we must add Button widgets on digital D2, D12 and D13. These buttons
will activate the blue led of the ESP, the led connected to D6, D7 of NodeMcu, or D12,
D13 of WeMos.

Fig. 4. Setting the Blynk workspace

Fig. 5 Setting the Button and terminal Widgets


View publication stats

References

1. http://www.instructables.com/id/Programming-ESP8266-ESP-12E-NodeMCU-Using-
Arduino-/?ALLSTEPS

2. Controlling by smartphone via internet two relays with Blynk and ESP 8266-01,
M. Todica, DOI: 10.13140/RG.2.2.31986.91847

3. https://github.com/sui77/rc-switch/

4. http://arduino.esp8266.com/package_esp8266com_index.json.

5. http://www.blynk.cc/getting-started.

6. https://www.hackster.io/mjrobot/lasercat-iot-with-nodemcu-and-blynk-27365d

7. Bilaterally communication between smartphone and ESP8266 NodeMcu with Blynk


via internet
M. Todica, DOI: 10.13140/RG.2.2.35562.52161

You might also like