Secure your Home with Arduino And Cayenne


About This Project

In present time home/office and many other place security is most important. In our absence these place are not secure. For make these places secure many people keep guards and many people prefer electronic security system. In present time many types of security system are available in market. These security systems are very accurate and easy to control and cheaply available and the most important thing is that they can be operated on low voltage ( upto 12 voltage).

What’s Connected

This project requires just a few parts, and because you’re using a solderless breadboard and pre-cut jumper wires, you won’t need any tools at all — except your computer and USB cable to connect the Arduino.

Dashboard Screenshots

  1. Connecting Arduino Device with Cayenne Dashboard.

  1. Add new widgets to the project

  1. Adding Digital Motion sensor widget to my project

  1. Selecting Virtual pins

  1. Configuring Sensor data with Cayenne

    When it is LOW, No Motion Detected

When it is HIGH, Motion Detected

Photos of the Project

A PIR module is basically made of a pyroelectric sensor (see it below as the round metal can with a rectangular crystal in the center), which can detect levels of infrared radiation. Everything emits some low level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion detector is actually split in two halves.

The reason for that is that we are looking to detect motion (change) not average IR levels. The two halves are wired up so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low.

This give us 2 options for powering it up: using the existing 5V pin or if you want to use it in a 3V only setup, just bypass or remove the regulator and that’s it.

Connecting the PIR sensor module is pretty trivial, as it has only 3 PIN:

The PIR acts as a digital output so all you need to do is listen for the pin status change to HIGH (motion detected) or LOW (no motion detected).

Triggers & Alerts

Wherever you go out of your home for any vacation you just wants to switch on the trigger system and you can monitors in your cayenne app.If anything wrongly happens in your home,It will send notifications to you.No need of any external device needed to alert.

  1. Creating New Trigger in Cayenne Dashboard

—> Notification message will be send to the Mobile phone when any person enters into your home


         #define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
         #include <CayenneEthernet.h>

        // Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
        char token[] = "AuthenticationToken";

         // Virtual Pin of the Digital Motion Sensor widget.
        #define VIRTUAL_PIN V1

       const int motionSensorPin = 4;

       void setup()

    void loop()

      int previousState = -1;
     int currentState = -1;
     unsigned long previousMillis = 0;

    void checkSensor()
unsigned long currentMillis = millis();
// Check sensor data every 250 milliseconds
if (currentMillis - previousMillis >= 250) {
	// Check the sensor state and send data when it changes.
	currentState = digitalRead(motionSensorPin);
	if (currentState != previousState) {
		Cayenne.virtualWrite(VIRTUAL_PIN, currentState);
		previousState = currentState;

The Judges Have Spoken! ~CONTEST RESULTS~