Home > Projects > LED Projects > MKR1000 Christmas IoTree with Cayenne Project Builder

MKR1000 Christmas IoTree with Cayenne Project Builder

Summary of MKR1000 Christmas IoTree with Cayenne Project Builder


This project automates a Christmas tree using two Arduino MKR1000 boards to control lights and detect motion. One board acts as an ornament on the tree with a PIR sensor, while the other sits on an office desk to trigger an alarm light and send text alerts when movement is detected. The system uses myDevices Cayenne for scheduling lights at sunrise/sunset, managing triggers, and handling notifications via an IP camera.

Parts used in the Automated Christmas Tree Project:

  • Arduino MKR1000
  • PIR Motion Sensor (generic)
  • Jumper wires (generic)
  • Relay (generic)
  • IP Camera
  • Alarm Light

Automate your Christmas tree and get notified when motion is detected around the tree!Temp Img

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
× 2
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
× 1
Jumper wires (generic)
Jumper wires (generic)
× 1
Relay (generic)
This is a really easy relay to use, plug and play! http://www.digital-loggers.com/iot.html
× 2

Software apps and online services

Cayenne
myDevices Cayenne
Arduino IDE
Arduino IDE

Story

Arduino MKR1000 Automating Christmas Tree Using Cayenne

Cayenne Web Dashboard:

Scheduling Christmas Lights

MKR1000 Triggers and Notifications

Christmas IoTree Setup:

Code

MKR1000 Cayenne Sketch File

C/C++

This sketch file comes as an example when the Cayenne Arudino library is download. Just copy and paste the sketch file into the Arduino IDE and input user auth token along with WiFi credentials.
/*
Cayenne MKR1000 Example

This sketch connects to the Cayenne server using an Arduino/Genuino MKR1000 and runs the main communication loop.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. Install the Arduino SAMD Boards from the Arduino Boards Manager if you have not done so already.
2. Install the WiFi101 library (https://github.com/arduino-libraries/WiFi101) from the Arduino Library Manager if you have not done so already.
3. Select the Arduino/Genuino MKR1000 board and the correct port in the Arduino IDE.
4. Set the token variable to match the Arduino token from the Dashboard.
5. Set the network name and password.
6. Compile and upload this sketch.

For Cayenne Dashboard widgets using digital or analog pins this sketch will automatically
send data on those pins to the Cayenne server. If the widgets use Virtual Pins, data
should be sent to those pins using virtualWrites. Examples for sending and receiving
Virtual Pin data are under the Basics folder.
*/

//#define CAYENNE_DEBUG         // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneMKR1000.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "AuthenticationToken";
// Your network name and password.
char ssid[] = "NetworkSSID";
char password[] = "NetworkPassword";

void setup()
{
	Serial.begin(9600);
	Cayenne.begin(token, ssid, password);
}

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

Quick Solutions to Questions related to Automated Christmas Tree Project:

  • How can I automate the timing of my Christmas tree lights?
    You can use the MKR1000 and Cayenne Scheduling to turn your Christmas tree lights on at sunrise and off at sunset.
  • Can this project notify me if someone approaches the tree?
    Yes, the system detects motion around the tree and will send you a text message when activity is detected.
  • Does the system support viewing activity remotely?
    An IP camera is pointed at the Christmas tree so you can view the activity when motion is detected.
  • What happens if motion is detected by the Christmas tree?
    The MKR1000 located on your office desk will turn on an alarm light to alert you.
  • Which software handles the automation and trigger events?
    Cayenne handled all of the automation, trigger events, scheduling, and text message notifications used in the project.
  • How do I configure the code for the MKR1000?
    You copy the example sketch into the Arduino IDE, input your user auth token, and set your WiFi credentials before compiling.
  • Is the relay component difficult to install?
    No, it is described as a really easy relay to use that is plug and play.
  • Where should the second MKR1000 be located?
    The second MKR1000 is located on your office desk to receive signals from the tree.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top