GLADOS Home Automation (voice Recognition)

Introduction: GLADOS Home Automation (voice Recognition)

About: i love to make robotics in my spare time

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.
For the person who made the body this is the link to his instructable:
https://www.instructables.com/id/A-fully-3D-printable-GlaDOS-Robotic-ceiling-arm-la/

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.

25/04/2018
for all the people who voted for me on the voice activated contest THANK YOU (i know i am really late with thanking you guys).
Without your'e help i woudnt have made it. The project stands now still for a while becaue is have an intership with school but when i have the time to work furter on it i will.
If you want to stay up to date on the glados project subscribe on my youtube channel my name is douwe miedema on youtube. When i have something to show you guys i will upload it there.

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 :)

Voice Activated Challenge

Grand Prize in the
Voice Activated Challenge

Be the First to Share

    Recommendations

    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge

    31 Discussions

    0
    jportuguezdoge
    jportuguezdoge

    2 months ago

    Is it just for me that the video on step 8 says it's private?

    0
    LuigiTime9.
    LuigiTime9.

    2 years ago

    (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

    1
    douwe1230
    douwe1230

    Reply 2 years ago

    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 :)

    0
    raagamparmar
    raagamparmar

    Reply 2 months ago

    Superb idea!

    0
    Chambersofsecret666
    Chambersofsecret666

    Question 1 year ago

    how powerful of a computer do you need to run this? Could I run it off a raspberry pi?

    1
    douwe1230
    douwe1230

    Answer 1 year ago

    the raspberry pi is powerfull egnough but the problem is that voice attack only works on windows and not on linux

    0
    ChambersOfSecret
    ChambersOfSecret

    Reply 1 year ago

    Can you run voice attack on Windows 10 IoT?

    0
    raagamparmar
    raagamparmar

    Reply 2 months ago

    I think you can, even I am going to try out!

    0
    Jack Meindhert
    Jack Meindhert

    1 year ago

    Would it be possible if i could somehow get her to be able to turn on and off my fan? I wouldn’t be asking if i knew more about this kind of stuff.

    0
    raagamparmar
    raagamparmar

    Reply 2 months ago

    connect fan(s) in place of light(s).

    0
    chiffa.the.fox
    chiffa.the.fox

    5 months ago

    Wow! It's amazing! Is it possible to see list of voice attack commands to GLaDOS? I trying to make it, but don't have enough fantasy to make such big list of commands

    0
    raagamparmar
    raagamparmar

    Reply 2 months ago

    you can take reference from alexa or google home commands from internet

    0
    alfreaguirre01
    alfreaguirre01

    Question 2 months ago

    i dont get how the python code, the arduino and the voice attack connects with each other what am i missing?

    0
    douwe1230
    douwe1230

    Answer 2 months ago

    the voice attack software listens to the voice. You can schoose in voice attack to start a program, what in this case is the python script.
    the python script sends serial dat over the com port (the port that is connected with you arduino) it depents what you send (i use 0 til 9 and the alphabet)
    in the arduino i made a code that react to surten signals wich makes I/O pins high or low

    0
    LorenH16
    LorenH16

    Question 6 months ago on Step 17

    does anyone now which python program is good for this

    0
    LuigiTime9.
    LuigiTime9.

    1 year ago

    Wouldn't it be easier to just use one arduino and directly go to the relay like if you pull it high, the relay goes on and if you pull it low it goes off. I don't really see the need of a second arduino doing this. Or what am I missing out, would this work?

    0
    douwe1230
    douwe1230

    Reply 1 year ago

    you are partly right i also tried this first. but the point is that evrytime you you make a connect with the arduino wille de arduino reboot so ecry light you already have turend on wil reset to off.
    or you need to find a onther way like ahev wone script that sends al the data to the arduino that is alwys connected to the arduino.
    but if you want to do it like i did it ypu need tp use 2 arduinos

    0
    amitdvir583
    amitdvir583

    Question 1 year ago

    Can you use an Mega 2560 R3 instead of the uno 3?

    0
    douwe1230
    douwe1230

    Answer 1 year ago

    yes

    0
    JaeyoonP
    JaeyoonP

    1 year ago

    That is one heck of a job to do!!!
    Well done!
    I'm not a portal fan, but I should try it out later.
    It's so interesting!