Project tutorial
HomeBright

HomeBright © GPL3+

Brighten your home with HomeBright.

  • 6,179 views
  • 15 comments
  • 10 respects

Components and supplies

Apps and online services

About this project

This app uses LeapMotion and Arduino Uno to create a home automation system which controls the intensity of lighting of rooms. A home floor plan is mapped to the LeapMotion coordinates to determine a particular room. While palm position controls the lighting of a targeting room, raising or lowering the palm controls the intensity of lighting of the room. 

Instruction

Install node.js

Install Leap Motion SDK

Install Cylon.js for Arduino and Leap Motion (Refer to useful links below)

or use the package.json to install all the required node modules

How to Run

run:  node homebright-console.js (Refer to code section)

https://developer.leapmotion.com/

http://cylonjs.com/documentation/platforms/arduino/

http://cylonjs.com/documentation/platforms/leapmotion/

http://cylonjs.com/documentation/drivers/led/

Code

homebright-console.jsJavaScript
cylon robot which controls the LED lightings
node homebright-console.js
"use strict";

var cylon = require("cylon");

cylon.robot({
  connections: {
    leapmotion: { adaptor: "leapmotion" },
    arduino: { adaptor: "firmata", port: "COM7" }
  },

  devices: {
    leapmotion: { driver: 'leapmotion' },
    livingroom: { driver: "led", pin: 6, connection: "arduino" },
    dininghall: { driver: "led", pin: 9, connection: "arduino" },
    bedroom: { driver: "led", pin: 10, connection: "arduino" },
    studyroom: { driver: "led", pin: 11, connection: "arduino" }
  },

  work: function(my) {
    my.leapmotion.on("hand", function(hand) {
			
			var on = hand.grabStrength > 0.5 ? false : true;
			var x = hand.palmPosition[0];
			var z = hand.palmPosition[2];

			var value = 0;
			
			if (on) {
				value = hand.palmPosition[1];
			}
			
			console.log(value);
			
			if(x > 0 &&  z > 0) {   // living room
					my.livingroom.brightness(value);
					//my.livingroom.turnOn();
			} else if (x > 0 && z < 0) {   // dining hall
					my.dininghall.brightness(value);
			} else if (x < 0 && z > 0) {   // study room
					my.studyroom.brightness(value);
			} else {   // bedroom
					my.bedroom.brightness(value);
			}

    });
  }
}).start();
package.jsonJavaScript
node package config file
npm install
{
  "name": "homebright-console",
  "version": "1.0.0",
  "dependencies": {
    "cylon": "1.2.0",
    "cylon-gpio": "0.27.0",
    "cylon-i2c": "0.23.0",
    "cylon-leapmotion": "0.20.0",
    "serialport": "1.7.4",
	"firmata": "0.5.5",
    "cylon-firmata": "0.23.0"
  }
}

Schematics

HomeBright Sketch (bb)
Homebright%20sketch bb
HomeBright Sketch (schem)
Homebright%20sketch schem

Comments

Similar projects you might like

Simple Arduino Uno - ESP 8266 Integration

Project tutorial by circuito.io team

  • 93,140 views
  • 23 comments
  • 75 respects

Room temperature sensor with display on Mobile

Project showcase by Kaustubh Agarwal

  • 23,926 views
  • 8 comments
  • 54 respects

Traffic Light Information System

Project tutorial by Pieter Luyten and Joppe Smeets

  • 16,237 views
  • 18 comments
  • 36 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 24,854 views
  • 17 comments
  • 75 respects

Arduino Smart car

Project tutorial by Tony ZHANG

  • 24,028 views
  • 1 comment
  • 22 respects
Add projectSign up / Login