Project showcase
Smart Living Room (Home Theatre)

Smart Living Room (Home Theatre) © GPL3+

I built myself a voice controlled home theatre, with background light, screen and projector control. With an ESP8266 and an Arduino Nano.

  • 5,728 views
  • 3 comments
  • 20 respects

Components and supplies

Esp01
Espressif ESP8266 ESP-01
Used for the communication between the amazon echo und the relay board
×1
Ard nano
Arduino Nano R3
used for the projector and the screen control
×1
Mcp23008 scr8g5le 10a b%20(1)
ControlEverything.com Relay Shield for Particle Photon I²C 8-Channel SPDT 10-Amp
this is not the exact hardware i used, but it's a 8-Channel Relay
×1

Apps and online services

About this project

Hey there!

I've got my girlfriend an Amazon Echo device for Christmas. Some days later I thought that this device on its own, is a little boring. So I promised her to make us a voice controlled smart living room... and this is my way to it.

While there are some opportunities for controlling some devices that make your home "smart"... but then I've only seen light controls for like 150€. That's waaay to expensive for me.

So I thought, let's build a smart, voice controlled device on my own, so I can personalize its features and expand its possibilities.

So I searched in the internet for some information, if there is any possibility to make a Board communicate with the amazon echo V.2. I found the ESP8266 board pretty fast with a library called "fauxmo". So I bought myself this board with a 8-Channel Relay Board for controlling nearly everything that is electronical.

I had to read myself into the example code, which took me some time (since i'm not a great programmer). With minor changes in the code I got it working.

After a working communication between the echo and my ESP8266, I hooked up the relay board to the module and tried some switching. After some "debugging" i got it to work.

So I hooked up a very cheap warm-light LED strip on the end of our shelves and.... taadaaa!

I looked around and only saw so many possibilites, so I stood up and got back on my computer to program much more devices into the code, that I could control with my voice.

And now I'm capable of driving the projector screen up and down, while this happens the projector gets a infrared signal to turn on/off. Also I can control the background light (seen on the picture) and the lamp on the side. Maybe I'll add some devices in the future.

Here's a short video of the functionality.

Code

ESP8266 voice controlArduino
for controlling the esp8266 with the amazon echo and the relays
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"
#include "credentials.h"

#define SERIAL_BAUDRATE                 115200
#define LIGHT                             D0
#define LAMP                              D1
#define START_ARD                         D2


fauxmoESP fauxmo;

// -----------------------------------------------------------------------------
// Wifi
// -----------------------------------------------------------------------------

void wifiSetup() {

    // Set WIFI module to STA mode
    WiFi.mode(WIFI_STA);

    // Connect
    Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
    WiFi.begin(WIFI_SSID, WIFI_PASS);

    // Wait
    while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(100);
    }
    Serial.println();

    // Connected!
    Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());

}

void setup() {

    
    Serial.begin(SERIAL_BAUDRATE);
    Serial.println();
    Serial.println();

    // Wifi
    wifiSetup();

    // Setting up
    pinMode(LIGHT, OUTPUT);
    pinMode(LAMP, OUTPUT);
    pinMode(START_ARD, OUTPUT);
    
    digitalWrite(LIGHT, HIGH);
    digitalWrite(LAMP, HIGH);
    digitalWrite(START_ARD, HIGH);

    fauxmo.enable(true);

    // Add virtual devices
    fauxmo.addDevice("Licht");
    fauxmo.addDevice("Lampe"); 
    fauxmo.addDevice("Beamer");
    
   // "Control section"
    fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state) {
        Serial.printf("[MAIN] Gerät #%d (%s) ist: %s\n", device_id, device_name, state ? "AN" : "AUS");

        if( (strcmp(device_name, "Licht") == 0)){
          if(state){
            digitalWrite(LIGHT, LOW);
            } else{
            digitalWrite(LIGHT, HIGH);
              }
          }//end of if

        if( (strcmp(device_name, "Lampe") == 0)){
          if(state){
            digitalWrite(LAMP, LOW);
            } else{
              digitalWrite(LAMP, HIGH);
              }//end of if-else
          }//end of if 

        if( (strcmp(device_name, "Beamer") == 0)){
          if(state){
            digitalWrite(START_ARD, LOW);
            } else{
              digitalWrite(START_ARD, HIGH);
              }//end of if-else
          }//end of if
          
    });

    // Callback to retrieve the current state
    fauxmo.onGetState([](unsigned char device_id, const char * device_name) {
        return digitalRead(LIGHT) == LOW;
        return digitalRead(LIGHT) == HIGH;
        return digitalRead(LAMP) == LOW;
        return digitalRead(LAMP) == HIGH;
        return digitalRead(START_ARD) == LOW;
        return digitalRead(START_ARD) == HIGH;
    });

}

void loop() {
    fauxmo.handle();

    static unsigned long last = millis();
    if (millis() - last > 5000) {
        last = millis();
        Serial.printf("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
    }

}
Arduino Nano projector controlArduino
this code is for the Nano, which controls the projector and the screen.
#include <IRremote.h>

IRsend irsend;  // PIN 3

#define SCREEN_DOWN         6  //IN4
#define SCREEN_UP           7  //IN5

int aktiviert = 0;    // activation variable

void setup()
{
  Serial.begin(9600);
 // Setting up 
  pinMode(2, INPUT);
  pinMode(SCREEN_DOWN, OUTPUT);
  pinMode(SCREEN_UP, OUTPUT);

  // Turning the Relay switches off in the beginning 
   digitalWrite(SCREEN_DOWN, HIGH);
   digitalWrite(SCREEN_UP, HIGH);

}//end of setup()

void loop() {  
 if(digitalRead(2) == HIGH){
       if(aktiviert == 0){        //Screen down, projector on
         digitalWrite(SCREEN_DOWN, LOW);
         delay(1000);
         digitalWrite(SCREEN_DOWN, HIGH);
         delay(30000); //Wait 45 sec.
         irsend.sendNEC(0x61D6F807, 32);
         delay(15000);
         digitalWrite(SCREEN_UP, LOW);
         delay(1000);
         digitalWrite(SCREEN_UP, HIGH);
         aktiviert = 1;
       }//end of if
    }else {
      if(aktiviert == 1){         //Screen up, projector off               
         irsend.sendNEC(0x61D6F807, 32);
         delay(1000);
         irsend.sendNEC(0x61D6F807, 32);
         delay(1000);
         irsend.sendNEC(0x61D6F807, 32);
         digitalWrite(SCREEN_UP, LOW);
         delay(46000);
         digitalWrite(SCREEN_UP, HIGH);
         delay(1000);
         digitalWrite(SCREEN_DOWN, LOW);
         delay(1000);
         digitalWrite(SCREEN_DOWN, HIGH);
        aktiviert = 0;
        }//end of if       
      }//end of if-else
 }//end of loop()

Schematics

Smart living room schematic
I had to write on it, because there was no 8-Channel relay board.. sorry for that. Also its a different ESP8266 board. I'm using one with micro-USB socket.
Smart home vm3mcc29lo

Comments

Similar projects you might like

Alexa Based Smart Home Monitoring

Project tutorial by Adithya TG

  • 16,640 views
  • 19 comments
  • 47 respects

Arduino-Powered Smart Light (Works with Amazon Echo)

Project tutorial by Tinker Project

  • 14,710 views
  • 7 comments
  • 29 respects

Rampiot - Cool Smart Lock

Project tutorial by Robinson Mesino

  • 3,695 views
  • 1 comment
  • 23 respects

Zoned Climate Control with MediaTek's LinkIt™ Smart 7688

Project tutorial by BuddyC

  • 7,716 views
  • 5 comments
  • 18 respects

Health Band - A Smart Assistant for the Elderly

Project tutorial by Technovation

  • 20,056 views
  • 11 comments
  • 53 respects

GO-4 Smart Home Arduino Bot

Project in progress by AhmedAzouz

  • 5,801 views
  • 0 comments
  • 34 respects
Add projectSign up / Login