Project showcase

Arduino - Detect Someone Taking Your Stuff and send Gmail © GPL3+

When your stuff is being taken away by a thief, Arduino makes an alert and sends a notification to you via Gmail.

  • 19,921 views
  • 45 comments
  • 63 respects

Components and supplies

About this project

If you are a beginner, you can learn about Arduino - Relay.

In this project, I am going to show you how to detect someone stealing your valuable stuff. If detected, Arduino sends a notification via Gmail and makes an alert sound and light.

Demonstration

Detecting Something is Taken Away

To detect treasure present or not, I put the treasure on the force sensor. This sensor let us know how heavy treasure is. If output value of sensor is below a threshold, Its means the treasure is not present and someone took it away.

Electronic part should be hidden under table.

Handling Event

If event is detected, Arduino will make an alert sound and light, and send an Gmail notification to owner.

Similar Project but Different Platform

This project does the same works but it used other hardware platform.

The Best Arduino Starter Kit for Beginner

See The Best Arduino Kit for Beginners

Code

Arduino CodeArduino
#include "SPI.h"
#include "Phpoc.h"

PhpocEmail email;
PhpocDateTime datetime;

const int THRESHOLD = 50;
boolean objPresent = false;
long adcValue = 0;

boolean sendGmail();

void setup() {
    Serial.begin(9600);
    while(!Serial)
    ;
    pinMode(A0, INPUT); // to read value from sensor
	pinMode(5, OUTPUT); // to control relay
    
    Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
    datetime.date("Y-M-d H:i:s");
    
}

void loop() {
    // read 30 time and get average value to eliminate noises
    adcValue = 0;
    
    for(int i = 0; i < 30; i++)
    {
        adcValue += analogRead(A0);
        delay(10);
    }
    
    adcValue /= 30;
    
    if(adcValue < THRESHOLD)
    {
        
        if(objPresent)
        {
            //Alert
             digitalWrite(5, HIGH);
            // send notification
            while(!sendGmail())
               ;
            
            objPresent = false;
        }
    }
    else
    {
        objPresent = true;
        digitalWrite(5, LOW);
    }
}

boolean sendGmail(){
    // setup outgoing relay server - gmail.com
    email.setOutgoingServer("smtp.gmail.com", 587);
    email.setOutgoingLogin("your_account", "your_password");
    
    // setup From/To/Subject
    email.setFrom("your_account@gmail.com", "Arduino");
    email.setTo("receiver_account@gmail.com", "Boss");
    
    email.setSubject("Alert: Your treasure is being taken away");
    
    // write email message
    email.beginMessage();
    email.println("Location: Planet Earth.");
    email.println("");
    email.print("Time: ");
    email.println(datetime.date());
    email.println("");
    email.println("Your treasure is being taken away.");
    email.endMessage();
    
    // send email
    if(email.send() > 0)
    {
        Serial.println("Email send ok");
        return true;
    }
    else
    {
        Serial.println("Email send failed");
        return false;
    }
}

Schematics

Wiring
1. Stack PHPoC Shield on Arduino
2. Connect Force sensor and relay to Arduino as bellow image
Arduino wiring jutlmecazu
Real Wiring
Arduino wiring real 9dxjinknrg

Comments

Similar projects you might like

Arduino, Monitoring Door-Opening via Gmail

Project tutorial by phpoc_man

  • 37,204 views
  • 41 comments
  • 124 respects

Arduino Dynamic Web Control

Project tutorial by phpoc_man

  • 47,433 views
  • 22 comments
  • 158 respects

Arduino - Send Temperature to Web via Serial

Project tutorial by IoT_hobbyist

  • 7,919 views
  • 7 comments
  • 32 respects

Arduino - Web-Based Joystick

Project tutorial by IoT_lover

  • 15,909 views
  • 18 comments
  • 95 respects

Motion Following Motorized Camera Base

Project tutorial by Lindsay Fox

  • 128,827 views
  • 76 comments
  • 345 respects

Arduino - Remotely Open Door via Web with Pattern Password

Project tutorial by phpoc_man

  • 3,459 views
  • 0 comments
  • 18 respects
Add projectSign up / Login