Alexa-Light Atmosphere

Made by hongyuc

Found in DIoT 2018 1- Home Hack

Taking advantage of colors can not only adjust indoor light atmosphere, but it can also affect people’s moods. My roommates has busy schedule at school everyday, so I hope to design a product which could change its light though Alexa to relax for him.

0

Problem Statement

Taking advantage of colours can not only adjust indoor light atmosphere, but it can also affect people’s moods. My roommates have busy schedule at school every day, so I hope to design a product which could change its light though Alexa to relax him. When he lies on the bed, he only needs to tell Alexa what colour of the light he wants, then he would be able to relax under the warm light. 

0

Goal

I will use Alexa and IFTTT to control the light in the room. When my roommate talks to Alexa, the light will turn on or even change its color with further orders.

0

Parts

LED Light x 1

Breadboard x 2

motion sensor x 1

Alexa x 1

Amazon Web Service Alexa

IFTTT Alexa

Particle Photon x 1

Wires x n


0

Details

The operation steps should be: Telling Alexa about what kind of light you want(etc. relax, deep learning or party). Then the could process your order and transfer the date to particle so as to control the light. 

0


0

Process

To work as an ambient project which helps my roommate control the light by voice.

1.Connect the Alexa Cloud to the particle.

2.Completing the circular with the motion sensor.

3.Apply the Alexa to receive a voice signal to control light.

4.Try to change to colour of LED in code(Obviously it seems not work well)

0
bool lightStatus;
int currentHex;
int controlRGB(String command);
int wait = 1000;
int onoff = 0xFF02FD;
int hrz = 32;
int inputPin = D0;             
int ledPin = D1;               
int pirState = LOW;             
int val = 0;                    

void setup() {
    pinMode( ledPin, OUTPUT );
    pinMode(inputPin, INPUT);
    lightStatus = false;
    Particle.function("lights", controlRGB);
    Particle.variable("lightStatus", lightStatus);
}

void loop() {
if ( calibrated() )
{

readTheSensor();
reportTheData();
}

}

void readTheSensor() {
  val = digitalRead(inputPin);
}

void lightOnOff(){
    irsend.sendNEC(On_Off, 32);
    lightStatus = !lightStatus;
}

bool calibrated() {
  return millis() - calibrateTime > 0;
}


void setLight(int hex){
     if(!lightStatus){
            lightOnOff();
            delay(wait);
        }
        irsend.sendNEC(hex,hrz);
}

int controlRGB(String command){
    
    if(command == "onoff"){
        lightOnOff();
    }
    if(command == "code"){
        setLight(currentHex);
    }
    if(command == "red"){
       setLight(Red);
    }
    if(command == "green"){
        setLight(Green);
    }
     if(command == "blue"){
         setLight(Blue);
    }
     if(command == "white"){
         setLight(White);
    }
     if(command == "brighter"){
         setLight(Brighter);
    }
     if(command == "lessBright"){
         setLight(Less_Bright);
    }
     if(command == "flash"){
         setLight(Flash);
    }
     if(command == "fade7"){
         setLight(Fade7);
    }
     if(command == "fade3"){
         setLight(Fade3);
    }
     if(command == "jump3"){
         setLight(Jump3);
    }
     if(command == "jump7"){
         setLight(Jump7);
    }
     if(command == "quick"){
         setLight(Quick);
    }
     if(command == "slow"){
         setLight(Slow);
    }
    if(command == "off"){
        if(lightStatus){
           lightOnOff(); 
        }
    }
    if(command == "isoff"){
        lightStatus = false;
    }
}
Click to Expand
0

Reflection

I found programming very challenging with limited prior coding experience. Especially when I need to connect the device to Alexa, I tried to study some tutorials and followed the key steps to make my project work. Originally, I hope my LED could blink with some kind of rhythm, but this time I just made it very simple only with turn on and turn off. Maybe next time I will try to apply different light effect on this project.(like combining with processing..)

x
Share this Project

Courses

49713 Designing for the Internet of Things

· 25 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

Taking advantage of colors can not only adjust indoor light atmosphere, but it can also affect people’s moods. My roommates has busy schedule at school everyday, so I hope to design a product which could change its light though Alexa to relax for him.

Created

January 24th, 2018