MotionSense Not-E-FYE: Motion Activated Pushbullet Notification to Smartphone
Create a motion-activated Pushbullet Notification to your smartphone.
Join the DZone community and get the full member experience.
Join For Freemotionsense 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
pushbullet
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 : 173.17.168.19
-
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.
to get more : http://www.codeproject.com/articles/1002782/iot-motionsense-not-e-fyi
references :
Published at DZone with permission of Anupam Datta. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments