Home devices control system with cayenne

Home devices control system using Cayenne
This project is about controlling home devices through cayenne and Arduino. It is very easy to connect your devices with internet through Cayenne IOT solutions. I am very happy to post my first project using this amazing and unique service.In home devices control system, I have used two devices to control through internet by using Cayenne IOT server and trust me I completed this task in 5 minutes which in past took me more than 15 days to connect arduino with internet. So it makes my life so easy. Now I can connect my devices with internet with in minutes.

What’s Connected

In this we are using followng hardware components

Arduino
Ethernet shield
Relay module
load
##Circuit diagram

For demonstration purpose I have connected only one load, but we can connect as many loads as we want.

Dashboard Screenshots


user can simply press on and off button to turn and turn off device which is interfaced through and it is very easy to interface relay with Arduino

Video of project

##Code of project
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space

// If you're not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples.
#include <CayenneEthernet.h>

#define VIRTUAL_PIN1 1
#define VIRTUAL_PIN2 2
#define RELAY_DIGITAL_PIN1 4
#define RELAY_DIGITAL_PIN2 5
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "";

void setup()
{
  // set digital pin to output
  pinMode(RELAY_DIGITAL_PIN1, OUTPUT);
  pinMode(RELAY_DIGITAL_PIN2, OUTPUT);

  Serial.begin(9600);
  Cayenne.begin(token);
}

CAYENNE_IN(VIRTUAL_PIN1)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 1) {
    digitalWrite(RELAY_DIGITAL_PIN1, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN1, LOW);
  }
}
CAYENNE_IN(VIRTUAL_PIN2)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 1) {
    digitalWrite(RELAY_DIGITAL_PIN2, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN2, LOW);
  }
}

void loop()
{
  Cayenne.run();
}

In code you just need to use, Cayenne_in function for different loads which is self explanatory. This is all about this project. I am very excited to post some advance projects with Cayenne services in coming days. :slight_smile:

2 Likes

Cool video!

You should be sure to submit this to the project contest, it’s ending soon!

-B

how to submit project to content? I have already uploaded project on hackstar and instructables.

link of my article on hackstar Home Devices Control System With Cayenne - Hackster.io
link of my article on instructables Home Devices Control System With Cayanne - Instructables

I will also post new projects in content before 31 october