Christmas Tree Controller

This is a brief explanation how to create a Christmas tree that its LEDs are controlled by the end user from a website. The concept is pretty simple. We need to have a server, a website, a database, a relay, LEDs and of course a Netduino. Obviously this concept can be applied on a RaspberryPi.

Video Demonstration

General Setup

For this project Node.JS was chosen because it has a popular library called Socket.IO and can be easily connected with MongoDB. Socket.IO is a JavaScript library for real time web applications. It enables real-time communication between web clients and servers. MongoDB is a cross-platform document-oriented database which is classified as a NoSQL database. Socket.IO was used to display the Christmas tree’s animation state (controlled by netduino) in real time to all connected users via Node.JS. MongoDB was used to store the user’s LEDs animation.

Here is a step-by-step breakdown structure of what was done:

Step 1 – User enters animation sequence: Selected LED colours with duration in seconds.

Step 2 – Upon submission, the user’s data is stored in MongoDB and emitted via Socket.IO to all connected clients in JSON.

Step 3 – Netduino checks every two seconds with Node.JS if there’s a new animation for playing. If there is, Node.JS gets the data from the database and returns it to Netduino as JSON string. Then Netduino parses the JSON string and plays the animation. Once it finishes, it instructs Node.js to get the next animation.

Step 4 – Another challenging part was how to setup the relay with the batteries, LEDs and Netduino. The following tutorial was followed and implemented: http://www.instructables.com/id/Controlling-AC-light-using-Arduino-with-relay-modu/?ALLSTEPS

 

FrameworkChristmas