Skip to end of metadata
Go to start of metadata

 

1. Component list


  • 1× esp8266-07
  • 1× PIR Sensor
  • 1x Bread Board Power Supply
  • 1x 12V AC-DC Power Adaptor
  • 2x 400pin Breadboard
  • Wires

2. Overall idea


In this project we are using the ESP8266 WiFi module and PIR sensor motion detector to get e-mail alerts when motion is detected. We are using GadgetKeeper Cloud Platform to bind e-mail notifications with PIR Sensor. 

3. Prepare the hardware


 

 

ESP8266 Wiring

PIN nameConnection
Resetvia push button to gnd
GPIO12PIR sensor data pin
VCC3V3
TXDCP2102 TXD Pin
RXDCP2102 RXD Pin
GPIO0GND
GNDGND

 

CP2102 Wiring

PIN nameConnection
TDXESP8266 TXD Pin
RXDESP8266 RXD Pin
GNDGND

 

PIR sensor

PIN nameConnection
VCC5V
GNDGND
OUTESP8266 GPIO12 Pin

 

NOTE: to upload code to ESP8266 first connect GPIO0 pin to ground, reset esp and then upload code. After uploading code GPIO0 can be disconnected again.

4. Configure Arduino IDE


Download Arduino IDE from Arduino.cc (1.6.4 or greater) - don't use 1.6.2! You can use your existing IDE if you have already installed it

Open File -> Preferences and end enter:

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

into Additional Board Manager URLs field.

Click OK and go to Sketch -> Include Library -> Manage Libraries to open Board manager

In Boards Manager search for esp8266 and install the ESP8266 package.

5. Add required additional Arduino libraries


The required libraries can be downloaded from following link:

Time.h

All other required libraries are available as standard libraries with the IDE.

Installing Additional Arduino Libraries guidelines can be found on official Arduino site.

6. Configure GadgetKeeper


 

Create the "Alarm" thing first.

Follow Create Event And Trigger tutorial if you need detailed "point and click" UI instructions

Create Motion detected event for Alarm thing in GadgetKeeper Console.



  1. In the "Thing: Alarm" tab, open "Events"
  2. Click "New" to open "Create Event" dialog
  3. Set name to "Motion detected"
  4. Select "boolean" as the data type for this event
  5. Save event
If you need detailed "point and click" UI instructions how to create even see "Create Event And Trigger" on GadgetKeeper Documentation.

Add script to Mail notification trigger for Alarm thing in GadgetKeeper Console.

  1. Open "Triggers" again in the "Thing: Alarm" tab
  2. Select "Mail notification"
  3. Click "Edit Script" button to open "Edit Script Trigger" dialog
  4. Insert the following script in the text area (email name may be edited):

     

  5. Save the trigger script by clicking "Save"

 

 

If you need detailed "point and click" UI instructions how to create even see "Create Event And Trigger" on GadgetKeeper Documentation.

 

7. Arduino sketch


This is the arduino sketch for this cheap homemade IoT device. Every time the PIR sensor is triggered is sends data to GadgetKeeper Cloud to trigger email notification event. It can be also downloaded form github esp_pir_snesor.

 

 





 


  • No labels