GLADOS Home Automation (voice Recognition)
by douwe1230 in Circuits > Remote Control
65788 Views, 224 Favorites, 0 Comments
GLADOS Home Automation (voice Recognition)
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.
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).
Start With Voice Attack
If you want to make new voice commands press on edit profile.
Make New Command
Press new command.
as you can see i have allready created a lot of commands.
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".
Run Aplication
now press on "other -> windows -> run aplication".
Look for the Python Code
Press the button "browse for application".
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.)
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
Find Your Sound
Press on browse for application.
Select the Sound
Select the sound in this case it is activate light.
Press Ok
Press now the ok button.
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.
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
}
}
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);
}
}
Electric Circuit
I made a drawing of how you need to wire it.
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")
Here do you have all the files to make this project enjoy :)