Project tutorial
Arduino - Monitoring Door Open via Facebook Messenger

Arduino - Monitoring Door Open via Facebook Messenger © GPL3+

If door is opened, Arduino sends a message to your Facebook Messenger.

  • 9,962 views
  • 1 comment
  • 37 respects

Components and supplies

Apps and online services

About this project

Demonstration

I made the similar project, but cheaper cost (in total) and can be used for industrial environment here: https://www.hackster.io/phpoc_man/phpoc-monitoring-door-open-via-facebook-messenger-49603e

System Architecture

Wiring

  • One pin to GND.
  • Another pin to A0.

How to Create IFTTT Applet

Follow 12 steps (see red square)

1. Create Applet.

2. Set trigger.

3. Search "Webhooks" and click Webhooks.

4. Choose "Receive a web request."

5. set Event Name is "door_open" and click "Create trigger" button.

6. Click "+that" button to create the action.

7. Search "Facebook Messenger" and click.

8. Choose Action "Send message". It needs to connect to Facebook for the first time.

9. Create the content of message and then click "Add ingredient" button.

10. Choose "OccurredAt". This is time of door open.

11. Click "Create action" button.

12. Click "Finish" button

Now Applet is created.

Get Webhooks Key

Go to this link https://ifttt.com/maker_webhooks

Click "Documentation" to see the Webhooks Key.

Copy the Webhook Key and put it in Arduino code.

Code

MonotorDoorMessengerArduino
// Tutorial for the example is available here:
// https://forum.phpoc.com/articles/tutorials/1241-arduino-ssl-web-client

#include <Phpoc.h>

String IFTTT_WEBHOOKS_KEY = "xxxxxxxxxxxxxxxxxxxxxx"; // change your webhooks key here
char server_name[] = "maker.ifttt.com";

PhpocClient client;

void sendNotification()
{
	// connect to web server on port 443:
	if(client.connectSSL(server_name, 443)) {
		// if connected:
		Serial.println("Connected to server");

		// make a HTTP request:
		client.println("GET /trigger/door_open/with/key/" + IFTTT_WEBHOOKS_KEY + " HTTP/1.1");
		client.println("Host: maker.ifttt.com");
		client.println("Connection: close");
		client.println();
	}

	while(client.connected()) {
		if(client.available()) {
			char c = client.read();
			Serial.write(c);
		}
	}

	Serial.println();
	Serial.println("disconnecting from server.");
	client.stop();
}

void setup() {
	Serial.begin(9600);

	// initialize PHPoC [WiFi] Shield:
	Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);

	pinMode(A0, INPUT_PULLUP);
}

int previous_status = 1;

void loop() {
	int current_status = digitalRead(A0);

	if(previous_status == 0 && current_status == 1) { // if door is opened...
		Serial.println("door is opened");
		sendNotification();
		delay(100);
	} else if(previous_status == 1 && current_status == 0) { // if door is closed...
		Serial.println("door is closed");
	}

	previous_status = current_status;
}

Schematics

Wiring
20190521 133308 c24vhmf3wd

Comments

Similar projects you might like

Entry Level Door Monitoring Alarm System

Project tutorial by Robodia Technology Solutions

  • 6,103 views
  • 1 comment
  • 18 respects

Arduino, Monitoring Door-Opening via Gmail

Project tutorial by phpoc_man

  • 31,408 views
  • 41 comments
  • 110 respects

Arduino - Web-Based Thermometer

Project tutorial by khanhhs

  • 12,336 views
  • 12 comments
  • 43 respects

Smart BT Door Lock (Simple Arduino)

Project showcase by Arun

  • 10,969 views
  • 1 comment
  • 22 respects

Arduino - Web-Based Keypad

Project tutorial by khanhhs

  • 7,624 views
  • 0 comments
  • 48 respects

Smart Plant Monitoring with SMS Alert: Keep Plants Hydrated!

Project tutorial by Rohan Jadhav

  • 1,374 views
  • 2 comments
  • 4 respects
Add projectSign up / Login