Project tutorial

Control Christmas Lights with Voice Commands using Arduino © CERN-OHL

I have hacked into the Christmas LED strips and start controlling it using Arduino and 1Sheeld Voice Recognition.

  • 2,604 views
  • 2 comments
  • 14 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)
M3 4 5 set drill tap w g 1  43270 1521058825 llaxvkoksp
OpenBuilds Drill Taps

Apps and online services

About this project

Intro

Every year I buy the Christmas tree and the LED strips and just plug the Strip to the AC socket and leave it just shuffle. This year I decided to hack into the LED strips and start controlling it with Arduino and the Amazing 1Sheeld Voice Recognition shield.

The LED Control

I bought a small $5 tree and the normal Christmas 2$ LED strip.

The LED strip comes with a box having a push button it's used to shuffle between the light 8 modes.

I get the screw driver and open up this box to hack the circuit inside.

The Circuit

The circuit mainly composed of 4 PCR406 transistors to operate 4 LED Strips and connected to the HN803A to control the signals goes out to transistors. You can get more information about it from "electrical technology" website.

Now I decide to control both it's power and it's shuffling push button so I connect 4 jumpers to the power terminals and to the shuffle button and reconnect them to the relay board and start controlling them using the Arduino and 1Sheeld.

1Sheeld is a platform for Arduino that allows you to tap into your smartphone's sensors and capabilities and let you use them in your Arduino projects.

Basically, it is a hardware shield that sits on top of your Arduino board and communicates over Bluetooth to this Android app, to transfer data between it and your smartphone. You can check the getting started tutorial on 1Sheeld website which will take you step by step till you can operate the 1Sheeld very smoothly and it's an awesome reference for great Arduino projects.

Voice Recognition

In this project I have used it's amazing Voice Recognition shield:

Mainly I used it to turn on and off the whole system also to shuffle between it's 8 modes just with voice commands which are:

  • Waves
  • Sequential
  • Slo-glo
  • Chasing
  • Fade
  • Twinkle
  • Steady
  • Combination

Code

Christmas controlling with voice commandsArduino
#define CUSTOM_SETTINGS
#define INCLUDE_VOICE_RECOGNIZER_SHIELD

#include <OneSheeld.h>

/* Voice commands set by the user. */
const char poweronCommand[] = "turn on";
const char poweroffCommand[] = "turn off";
const char combinationCommand[] = "combination";
const char wavesCommand[] = "waves";
const char sequentialCommand[] = "sequential";
const char slowCommand[] = "slow";
const char chasingCommand[] = "chasing";
const char fadeCommand[] = "fade";
const char twinkleCommand[] = "twinkle";
const char steadyCommand[] = "steady";


int lamp = 12;
int power = 11;

int counter=0;
int x=0;
int y=0;
int z=0;
int l=0;
int m=0;
int n=0;
int p=0;
int q=0;
int val=0;

void setup()
{
  /* Start Communication. */
  OneSheeld.begin();

   pinMode(lamp,OUTPUT);
    pinMode(power,OUTPUT);
}

void loop () 
{
  /* Check if new command received. */
  if(VoiceRecognition.isNewCommandReceived())
  {
    /* Compare the Poer on command. */
    if(!strcmp(poweronCommand,VoiceRecognition.getLastCommand()))
    {
      digitalWrite(power,LOW);
      counter=0;
    }
/* Compare the Poer off command. */    else if (!strcmp(poweroffCommand,VoiceRecognition.getLastCommand()))
    {
      digitalWrite(power,HIGH);
    }
    /* Compare the combination command. */
    else if (!strcmp(combinationCommand,VoiceRecognition.getLastCommand()))
    {
      x=0-counter;
      if(x<0){
        x+=8;
        }
        for(val=0 ; val<x ; val++){
          mode();
          }
      counter=0;
      
    }
    /* Compare the waves command. */
    else if (!strcmp(wavesCommand,VoiceRecognition.getLastCommand()))
    {
      y=1-counter;
      if(y<0){
        y+=8;
        }
        for(val=0 ; val<y ; val++){
          mode();
          }
      counter=1;
    }
     /* Compare the sequential command. */
    else if (!strcmp(sequentialCommand,VoiceRecognition.getLastCommand()))
    {
      z=2-counter;
      if(z<0){
        z+=8;
        }
        for(val=0 ; val<z ; val++){
          mode();
          }
      counter=2;
    }
    /* Compare the slow command. */
    else if (!strcmp(slowCommand,VoiceRecognition.getLastCommand()))
    {
       l=3-counter;
      if(l<0){
        l+=8;
        }
        for(val=0 ; val<l ; val++){
          mode();
          }
      counter=3;
    }
    /* Compare the chasing command. */
    else if (!strcmp(chasingCommand,VoiceRecognition.getLastCommand()))
    {
      m=4-counter;
      if(m<0){
        m+=8;
        }
        for(val=0 ; val<m ; val++){
          mode();
          }
      counter=4;
    }
    /* Compare the fade command. */
     else if (!strcmp(fadeCommand,VoiceRecognition.getLastCommand()))
    {
       n=5-counter;
      if(n<0){
        n+=8;
        }
        for(val=0 ; val<n ; val++){
          mode();
          }
      counter=5;
    }
     /* Compare the Twinkle command. */
    else if (!strcmp(twinkleCommand,VoiceRecognition.getLastCommand()))
    {
      p=6-counter;
      if(p<0){
        p+=8;
        }
        for(val=0 ; val<p ; val++){
        
         mode();
          }
      counter=6;
    }
      /* Compare the steady command. */
     else if (!strcmp(steadyCommand,VoiceRecognition.getLastCommand()))
    {
       q=7-counter;
      if(q<0){
        q+=8;
        }
        for(val=0 ; val<q ; val++){
          mode();
          }
      counter=7;
    }
  }
}

void mode(){
   digitalWrite(lamp,LOW);
          delay(150);
   digitalWrite(lamp,HIGH);
   delay(150);
  }

Schematics

Christmas tree lights control schematic
Wdaoczlt2oae5daataqu

Comments

Similar projects you might like

Control Music Volume and Ledbar Using Slider of 1Sheeld

Project tutorial by ahmed ismail

  • 1,464 views
  • 2 comments
  • 11 respects

Arduino Based Amazon Echo Using 1Sheeld

Project tutorial by ahmed ismail

  • 35,941 views
  • 80 comments
  • 100 respects

Control your light system with your voice

Project tutorial by Maha Raafat

  • 33,158 views
  • 22 comments
  • 147 respects

Control Lights with your Phone from Anywhere in the World!

Project showcase by Kaustubh Agarwal

  • 15,046 views
  • 4 comments
  • 36 respects
Add projectSign up / Login