MotionSense is a motion activated Pushbullet notification system for your smart and handheld gadgets. It detects activity and notify you to take action. It consists of an Arduino with WiFi connectivity and one PIR sensor to detect activity.
List of materials I used :
1000 µF capacitor, different resistors [ capacitor for WiFi power supply, resistor for voltage regulation ]
Single thread 0.5mm wires [ connector lead ]
Female-female jumper wires [ connectors ]
Xperia Z1 [ for Pushbullet app, any smartphone will do ]
My Laptop [ coding in arduino ]
Arduino IDE [v1.6.4]
First You Need to Set Up Your PIR Sensor
Turn Yellow potentiometers in this fashion to get highest sensitivity
Now connect with Aduino :
PIR GND -> Arduino GND
PIR VCC - > Arduino 5V
PIR OUT - > DIGITAL pin 2 [ you can choose pin according to your choice and change in arduino code also ]
Connect ESP8266 WiFi with Arduino
ESP8266 GND - > Arduino GND
ESP8266 UXTX (transmit pin) -> Arduino RX2 (arduino mega receiver pin, ie. Serial2 in code)
ESP8266 CH_PD (make HIGH) -> Arduino 5V (add one voltage regulator 0f 3.3 as ESP 8266 can tolerate 3.3v. I have used a resistor as I didn't have voltage regulator. But voltage regulator is preferred)
leave RST, GPIO2 and GPIO0 not connected
ESP8266 URXD (receiver pin) - > Arduino TX2 (arduino receiver pin ie. Serial2 in code)
ESP8266 VCC - > 3.3v of Arduino
ESP8266 has power issue. At the time of data transmission, it draws power from arduino so much that arduino may restart if Arduino is powered via PC USB. Even with 5v power supply through power plug may not suffice. Hence it is always recommended to use external power supply for ESP8266. However in my experiment I used a quick & cheap solution for this. I used one 1000µF electrolyte capacitor to supply enough power to ESP8266.
longer pin - > ESP8266 VCC connected to 3.3v
shorter pin - > ESP8266 GND connected to arduino GND
Create Account in Pushbullet. Get Access Token in Account Section. In API section you can see different APIs for different purposes.
NOTE : Here all the API link and URLs are provided for https connection and Arduino can not use https as it is not that powerful to handle that. Hence we will use HTTP version of those APIs which is not mentioned here in pushbullet docs but I got this reference from github.
In pushbullet docs for pushing they had mentioned URL which is HTTPS, so we will use HTTP URL and port provided in that github project. Also we will add /pushbullet before and REST path they had mentioned.
REST path is : /v2/pushes
but we will use : /pushbullet/v2/pushes
base URL : 126.96.36.199
port : 8181
Now you need to put logic on Arduino.
Open this GitHub Project
Go to Experiments folder. There you will find MotionSense.ino, your code which will push notification to your Smart Devices.
Copy this code to arduino IDE and connect your arduino ( already set up with WiFi and PIR sensor ).
Now change these parameters :
#define SSID "YOURSSID" /* replace YOURSSID with your WiFi access point name */ #define PASS "YOURPASSWORD" /* replace YOUR PASSWORD with your WiFi access point password */
You may want to change PIR OUT pin to your desired pin
#define PIRPIN 2 /* change to your desired digital pin of your arduino */ #define AUTH_TOKEN "YOUR_TOKEN_FROM_YOUR_ACCOUNT"; /* replace YOUR_TOKEN_FROM_YOUR_ACCOUNT with your Access Token*/
Also use your access token as mentioned in above snippet.
Now compile and run.
It will take time for sensor calibration, WiFi module initialization and for connecting to your access point.
You can see these things in your Serial monitor.
After everything will done, it will start looping through main loop and you will see
"Everything fine | No intrusion "
in your serial monitor continuously.
Whenever you go go in-front of your PIR sensor, it will detect movement and Push notification to your devices.