How To Control Light/Fan Through Voice

The INTERNET OF THINGS

 
IoT is the network of physical devices, vehicles, home appliances, and other items embedded with electronics, software, sensors, actuators, and network connectivity which enable these objects to connect and exchange data. Each thing is uniquely identifiable through its embedded computing system but is able to inter-operate within the existing Internet infrastructure. Experts estimate that the IoT will consist of about 30 billion objects by 2020.
 
Requirements
 
Arduino UNO,5 Volt 2 Channel Relay, HC 05 Bluetooth Module, Programming cable, Connecting Wires, Bug Strips, Zero Voltage Bulb, and Electrical Wires.
 
Procedure
  • For our experiment, we are using 5V 2channel Relay by using this Relay we can connect two devices.
  • First of all, we need to check whether our relay is in a working state or not.
STEP 1 - TO TEST OUR RELAY WE NEED TO FOLLOW THE FOLLOWING STEPS
 
Connections
  • First, we need to connect GND of Relay to GND of Arduino
  • VCC of Relay to 5V of Arduino
  • IN1 of Relay to pin no. 2 of Arduino Digital section
  • After completing all the connections we need to connect our Arduino to the PC/LAPTOP through programming cable and check whether it is connected or not
  • Then compile and upload the program into the Arduino board
  • If our relay starts blinking ON and OFF for 2 seconds then we can confirm that our relay is in a working state.
 
 
 
 
 
STEP 2 - TO CHECK OUR BLUETOOTH MODULE IS WORKING OR NOT
 
Here, we are using HC 05 Bluetooth Module
 
Connections
  • Connect the VCC of Bluetooth to VCC of Arduino
  • Connect the GND of Bluetooth to GND of Arduino
  • Then connect our Arduino to the PC/LAPTOP.
  • If our Bluetooth module starts blinking, then the module is in a working state
 
  • If it shows a light then our Module is in a working state.
  • We need to pair our HC 05 Bluetooth Module with our mobile Bluetooth.
  • Now, Download "BT VOICE CONTROLLER FOR ARDUINO" APP from the PlayStore and connect our Bluetooth Module through the APP.
 
 
After testing these two products our actual concept starts from step 3.
 
STEP 3 - OVERALL CONNECTIONS
  • Now, take one male to the female wire, connect the male part to VCC of Arduino and the female part to Bugstrip.
  • Take one female to female wire & connect one female end to VCC of the relay & another end to the Bugstrip.
  • Take one male to the female wire, connect one male end to the GND of Relay & female end to the GND of Arduino.
  • Take one male to the female wire, connect one female end to the IN1 of Relay & male end to pin no. 2 of the Arduino Digital section.
  • Take one female to female wire & connect one female end to the VCC of Bluetooth & another end to the Bugstrip.
  • Take one male to the female wire, connect one male end to the GND of Arduino & female end to the GND of Bluetooth.
  • Take two electrical wires to connect one end to the black holder & another end to white plug. The yellow wire is cut into 2 parts, & connect as shown in the figure below.
 
  • The one end of the yellow wire goes to "COM1" of Relay & another end goes to "NO1" of Relay.
  • Then connect your Arduino to PC/LAPTOP using Programming cable. Now, compile and upload the below-given program over all connections.
 
 
Use the Arduino IDE or run the code:
 
String voice
  1. #define relay1 2  
  2. # define relay2 3  
  3. void setup() {  
  4.     Serial.begin(9600);  
  5.     pinMode(relay1, OUTPUT);  
  6.     pinMode(relay2, OUTPUT);  
  7.     digitalWrite(relay1, HIGH);  
  8.     digitalWrite(relay2, HIGH);  
  9. }  
  10. void loop() {  
  11.     while (Serial.available()) {  
  12.         delay(10);  
  13.         char c = Serial.read();  
  14.         if (c == '#') {  
  15.             break;  
  16.         }  
  17.         voice += c;  
  18.     }  
  19.     if (voice.length() > 0) {  
  20.         Serial.println(voice);  
  21.         if (voice == "*light on") {  
  22.             lighton();  
  23.         } else if (voice == "*light off") {  
  24.             lightoff();  
  25.         } else if (voice == "*fan on") {  
  26.             fanon();  
  27.         } else if (voice = "*fan stop") {  
  28.             fanoff();  
  29.         }  
  30.         voice = "";  
  31.     }  
  32. }  
  33. void lighton() {  
  34.     digitalWrite(relay1, LOW);  
  35. }  
  36. void lightoff() {  
  37.     digitalWrite(relay1, HIGH);  
  38. }  
  39. void fanon() {  
  40.     digitalWrite(relay2, LOW);  
  41. }  
  42. void fanoff() {  
  43.     digitalWrite(relay2, HIGH);  
  44. }  
  • After uploading the program to the Arduino Board:
  • Then connect TX of Bluetooth to RX of Arduino & RX of Bluetooth to TX of Arduino.
  • Now, connect a zero volt bulb to the holder and connect the plug to the 230V power supply.
  • After connecting to the power supply don't touch any wires or boards in the experiment be careful.
  • Then connect your mobile to the internet & open "BT VOICE CONTROLLER FOR ARDUINO" APP & connect it to our HC 05 Bluetooth Module through the APP.
 
 
Then if you give the command "LIGHT ON" then the zero volt bulb is ON,
 
 
 
When you give the command "LIGHT OFF" then the zero volt bulb is OFF.
 
 
Thank you for reading my article.