วันศุกร์ที่ 11 สิงหาคม พ.ศ. 2560

Voice recognize MIT App + Arduino Control relay

                             

Hardware 



1.Arduino UNO
2.HC06 Bluetooth
3.Relay Module
4.Smart phone
5.Wire

Wiring






4 Relay module to Arduino pin

GND >> GND
IN1 >> 2
IN2 >> 3
IN3 >> 4
IN4 >> 5
Vcc  >> 5 Volt


Bluetooth


Bluetooth to Arduino 

TX -----> 10
RX -----> 11


MIT application

Download and install to your smart phone







VDO






CODE

#include<SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX
String state;
int LED1=2;
int LED2=3;
int LED3=4;
int LED4=5;
void setup() {
  // put your setup code here, to run once:
       mySerial.begin(9600);
       Serial.begin(9600); //start serial communication
       pinMode(LED1, OUTPUT);//Pin2
       pinMode(LED2, OUTPUT);//Pin3
       pinMode(LED3, OUTPUT);//Pin4
       pinMode(LED4, OUTPUT);//Pin5

digitalWrite(LED1,HIGH);
digitalWrite(LED2,HIGH);
digitalWrite(LED3,HIGH);
digitalWrite(LED4,HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:




  while (mySerial.available()){ //Check if there is an available byte to read
     delay(10); //Delay added to make thing stable
    char c = mySerial.read(); //Conduct a serial read
 
    state += c; //Shorthand for voice = voice + c

}


if (state.length() > 0){
  Serial.println(state);

  if(state == "light on")
  {
    digitalWrite(LED1,LOW);
  }
 else if(state == "light off")
 {
  digitalWrite(LED1,HIGH);
 }
 if(state == "pump on")
  {
    digitalWrite(LED2,LOW);
  }
 else if(state == "pump off")
 {
  digitalWrite(LED2,HIGH);
 }
 if(state == "fan on")
  {
    digitalWrite(LED3,LOW);
  }
 else if(state == "fan off")
 {
  digitalWrite(LED3,HIGH);
 }
 if(state == "heat on")
  {
    digitalWrite(LED4,LOW);
  }
 else if(state == "heat off")
 {
  digitalWrite(LED4,HIGH);
 }

 state ="";}
 }




วันอังคารที่ 8 สิงหาคม พ.ศ. 2560

Voice command การสั้งงานด้วยเสียง MIT inventor app voice recognize




                                           Voice control

Requirement 

1. MIT Inventor Application
2. Bluetooth HC06
3. Arduino UNO



Wiring









Bluetooth to Arduino 

TX -----> 10
RX -----> 11






Motor Wiring


Arduino to Wheel motor
2 ---> ENA
3 ---> IN1
4 ---> IN2
5 ---> IN3
6 ---> IN4
7 ---> ENB

Arduino to Arm motor
A0 ---> ENA
A1 ---> IN1
A2 ---> IN2
A3 ---> IN3
A4 ---> IN4
A5 ---> ENB




MIT Application

Module Voice recognize


Link for download application : https://www.dropbox.com/s/l22e0u28w4hxtat/Speech.apk?dl=0

Download and install to your phone



Arduino Code