GLADOS Home Automation (voice Recognition)

3,137

46

19

Posted

Introduction: GLADOS Home Automation (voice Recognition)

Voice Activated Challenge

Grand Prize in the
Voice Activated Challenge

about this project:

i worked a long time on this project and the voice recognition works now. I did not create the body of GLADOS. Someone else made the 3d models off GLADOS, i made the control unit for the voice recognition.

Glados can control a lot in my room. From lights to my computer. In this tutorial i will explain the basics of the control system. This is expandedable by repeating the steps.

I use 2 arduino's in this situation. I'm still learning to code and this was a major step up for me. I'm investigating how i can put all this work on one simple rasberry pi.

how it works:

i use a software called voice attack. It is officialy used for voice control in games. This software enables you to attach programs or keystrokes to certain voice commands. I used it in a way that a certain voice commands opens a python script wich will send a serial code to the arduino1. The arduino1 will make a certain output HIGH that wil be send to arduino 2. The arduino 2 reads this of his inputs and will make the requested output HIGH or LOW of the relays. and so turn on or off the lights. This arduino1 is neccesary because the arduino resetted itself after every update from the serial data it received. I have not found a way to fix it yet but i'm looking into it.

Step 1: What Do You Need

you need some stuff to create this project:

hardware:

* A computer (or if you want to have it on 24/7 i recommend a mini computer because it takes less power).
* A relay board (in this case a 4 channel).
* 2 arduino uno's (if you want to control more outputs use 2 arduino mega's).

Software:

* Python software.
* Arduino software.
* Voice attack (this costs 10 dollars).

Step 2: Start With Voice Attack

If you want to make new voice commands press on edit profile.

Step 3: Make New Command

Press new command.

as you can see i have allready created a lot of commands.

Step 4: Type in Where She Needs to React To

Type in the text box what you would like her to react to as a voice command. for this preview is it "activate light 1".

Step 5: Run Aplication

now press on "other -> windows -> run aplication".

Step 6: Look for the Python Code

Press the button "browse for application".

Step 7: Select the Python Code

Choose the correct python code. in this case "activate_light_1".

(Preview of the python code is at the bottom of the instructable.)

Step 8: Select a Sound

If you made your own glados quotes you can press other -> sounds -> play a random sound. I do always random sound because i have more quotes that GLADOS can say. I do that because i wont get tired of always hearing the same answers.

If you dont know how to make glados voice here is a good tuturial about it:


The official texst to speech site doesnt exist anymore so i use another one of oddcast the voice of samantha.

If you dont want to make glados voice you can also do other -> sounds -> stop text-to-speech

Step 9: Find Your Sound

Press on browse for application.

Step 10: Select the Sound

Select the sound in this case it is activate light.

Step 11: Press Ok

Press now the ok button.

Step 12: Press Done

Press on done.

Now you created you first command you can try it if you want.
You did now only acivate the first light. you also need to deactivate light 1 and do that also for light 2 and 3.

Step 13: Arduino 1 Code

This is the arduino that gets serial data from the computer remember this arduino needs to stay plugged in the computer for serial data to work!

(on the bottom of the instructable are downloads)

Download this in arduino 1:

// this is de code for arduino 1

char serialData;

int light_1_on_signal = 2; // yellow calbe goes to arduino 2 input 2
int light_1_off_signal = 3; // yelow cable goes to arduino 2 input 3
int light_2_on_signal = 4; // yelow cable goes to arduino 2 input 4
int light_2_off_signal = 5; // yelow cable goes to arduino 2 input 5
int light_3_on_signal = 6; // yelow cable goes to arduino 2 input 6
int light_3_off_signal = 7; // yelow cable goes to arduino 2 input 7

// the setup routine runs once when you press reset:

void setup() {
// initialize the digital pin as an output.

pinMode(light_1_on_signal, OUTPUT);
pinMode(light_1_off_signal, OUTPUT);
pinMode(light_2_on_signal, OUTPUT);
pinMode(light_2_off_signal, OUTPUT);
pinMode(light_3_on_signal, OUTPUT);
pinMode(light_3_off_signal, OUTPUT);

Serial.begin(9600); // bautrate }

// the loop routine runs over and over again forever: void loop() {

if(serialData == '1'){
digitalWrite(light_1_on_signal, HIGH); // making light_1_on_signal active
}

if(serialData == '2'){
digitalWrite(light_1_off_signal, HIGH); // making light_1_off_signal active
}

if(serialData == '3'){
digitalWrite(light_2_on_signal, HIGH); // making light_2_on_signal active
}

if(serialData == '4'){
digitalWrite(light_2_off_signal, HIGH); // making light_2_off_signal active
}

if(serialData == '5'){
digitalWrite(light_3_on_signal, HIGH); // making light_3_on_signal active
}

if(serialData == '6'){
digitalWrite(light_3_off_signal, HIGH); // making light_3_off_signal active
}
}

Step 14: Arduino 2 Code

(on the bottom of the instructable are downloads)

Download this in arduino 2:

// this is de code for arduino 2

const int light_1_on_signal = 2; // yellow calbe comes from arduino 1 input 2
const int light_1_off_signal = 3; // yellow calbe comes from arduino 1 input 3
const int light_2_on_signal = 4; // yellow calbe comes from arduino 1 input 4
const int light_2_off_signal = 5; // yellow calbe comes from arduino 1 input 5
const int light_3_on_signal = 6; // yellow calbe comes from arduino 1 input 6
const int light_3_off_signal = 7; // yellow calbe comes from arduino 1 input 7

const int light_1 = 8; // makes the relay fotr light 1 HIGH or LOW (on or off)
const int light_2 = 9; // makes the relay fotr light 1 HIGH or LOW (on or off)
const int light_3 = 10; // makes the relay fotr light 1 HIGH or LOW (on or off)

// the setup routine runs once when you press reset:
void setup() {

// initialize the digital pin as an input.
pinMode(light_1_on_signal, INPUT);
pinMode(light_1_off_signal, INPUT);
pinMode(light_2_on_signal, INPUT);
pinMode(light_2_off_signal, INPUT);
pinMode(light_3_on_signal, INPUT);
pinMode(light_3_off_signal, INPUT);

// initialize the digital pin as an output.
pinMode(light_1, OUTPUT);
pinMode(light_2, OUTPUT);
pinMode(light_3, OUTPUT); }

// the loop routine runs over and over again forever:
void loop() {

if(digitalRead(light_1_on_signal) == HIGH) {
// if light_1_on_signa gives a signal he will gives 5v to the relay
digitalWrite(light_1, HIGH); }

if(digitalRead(light_1_off_signal) == HIGH) {
// if light_1_on_signa gives a signal he turns off the 5v to the relay
digitalWrite(light_1, LOW); }

if(digitalRead(light_2_on_signal) == HIGH) {
// if light_1_on_signa gives a signal he will gives 5v to the relay digitalWrite(light_2, HIGH); }

if(digitalRead(light_2_off_signal) == HIGH) {
// if light_1_on_signa gives a signal he turns off the 5v to the relay
digitalWrite(light_2, LOW); }

if(digitalRead(light_3_on_signal) == HIGH) {
// if light_1_on_signa gives a signal he will gives 5v to the relay digitalWrite(light_3, HIGH); }

if(digitalRead(light_3_off_signal) == HIGH) {
// if light_1_on_signa gives a signal he turns off the 5v to the relay
digitalWrite(light_3, LOW);
}
}

Step 15: Electric Circuit

I made a drawing of how you need to wire it.

Step 16: Python Code

You need to put this in the python script remember to change the com port to the one the arduino is connected with.

(on the bottom of the instructable are downloads)



python code:

import serial
import time

ser = serial.Serial("COM4", 9600)

time.sleep(1)

ser.write("1")

Step 17:

Here do you have all the files to make this project enjoy :)

Share

    Recommendations

    • Spotless Contest

      Spotless Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Trash to Treasure

      Trash to Treasure
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    12 Comments

    (dont know how to edit already written comments on this sitw, this idea has to do something with my other commen) you could also add face recognicion so that GLaDOS moves and looks at you like in the game that would be awseome

    thanks for your reply. i will eventually hang glados on the ceiling and im bissy with puting ultrasonic sensors in her so she can follow you in the room :)

    heel veel succes met al je uitvindingen Douwe Miedema

    Awesome Douwe! I love it!

    Proud of my son Douwe♥️
    He is a REAL engineer!

    Fantastic, i'm so amazed what you did,my compliments

    this is simply amazing
    i will make somthing like this thanks for the tip and a push in the right direction.
    but it wil be next year. first i'm making my house completly remote controlledwith mqtt.
    thanks

    youre welcome. I love it that i inspired you and if have youre own system is working i would love to see a video of it !

    This is great! I love the look and functionality!