I made a similar project using but simpler hardware (only PHPoC) here: https://forum.phpoc.com/blogs/khanh-...ing-your-stuff


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.


Things Used In This Project
Wiring Diagram

Click image for larger version  Name:	Arduino_force_sensor_ Wiring.JPG Views:	1 Size:	33.4 KB ID:	768

Click image for larger version  Name:	Arduino_force_sensor_Real Arduino Wiring.JPG Views:	1 Size:	36.7 KB ID:	767

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 is hidden below table
Click image for larger version  Name:	Arduino_force_sensor_Force sensor.jpg Views:	1 Size:	12.4 KB ID:	765

Laptop overlays force sensor

Click image for larger version  Name:	Arduino_force_sensor_Laptop overlays force sensor..jpg Views:	1 Size:	42.4 KB ID:	766

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.

Source Code

<Arduino code>
#include "SPI.h"
#include "Phpoc.h"

PhpocEmail email;
PhpocDateTime datetime;

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

boolean sendGmail();

void setup() {
    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);

    adcValue /= 30;

    if(adcValue < THRESHOLD)

             digitalWrite(5, HIGH);
            // send notification

            objPresent = false;
        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("[email protected]", "Arduino");
    email.setTo("[email protected]", "Boss");

    email.setSubject("Alert: Your treasure is being taken away");

    // write email message
    email.println("Location: Planet Earth.");
    email.print("Time: ");
    email.println("Your treasure is being taken away.");

    // send email
    if(email.send() > 0)
        Serial.println("Email send ok");
        return true;
        Serial.println("Email send failed");
        return false;

Function References