Devices & Components
Arduino Uno Rev3
2.2k Resistor
BD139 Transistor
Jumper wires (generic)
Car door lock actuator
HC-05 Bluetooth Module
Relay (generic)
12 volt Adapter
Hardware & Tools
Soldering iron (generic)
Hot glue gun (generic)
Software & Tools
Arduino Voice controller
Project description
Code
Voice Door lock
arduino
1String voice; 2 3#define lockPin 12 4#define unlockPin 11 5void setup() 6{ // put your setup code here, to run once: 7 Serial.begin(9600); 8 pinMode(lockPin, OUTPUT); 9 pinMode(unlockPin, OUTPUT); 10 11} 12void loop() { 13 14 while (Serial.available()) //Check if there is an available byte to read 15 { 16 delay(10); //Delay added to make thing stable 17 char c = Serial.read(); //Conduct a serial read 18 voice += c; //Shorthand for voice = voice + c 19 } 20 21 if (voice.length() > 0) { 22 Serial.println(voice); 23 if(voice == "door lock")// 24 { 25 26 digitalWrite(lockPin,HIGH); 27 delay(3000); 28 digitalWrite(lockPin,LOW); 29 30 } 31 else if(voice == "door unlock")// 32 { 33 34 digitalWrite(unlockPin,HIGH); 35 delay(3000); 36 digitalWrite(unlockPin,LOW); 37 } 38 voice=""; //Reset the variable after initiating 39 }}
Voice Door lock
arduino
1String voice; 2 3#define lockPin 12 4#define unlockPin 11 5void setup() 6{ // put your setup code here, to run once: 7 Serial.begin(9600); 8 pinMode(lockPin, OUTPUT); 9 pinMode(unlockPin, OUTPUT); 10 11} 12void loop() { 13 14 while (Serial.available()) //Check if there is an available byte to read 15 { 16 delay(10); //Delay added to make thing stable 17 char c = Serial.read(); //Conduct a serial read 18 voice += c; //Shorthand for voice = voice + c 19 } 20 21 if (voice.length() > 0) { 22 Serial.println(voice); 23 if(voice == "door lock")// 24 { 25 26 digitalWrite(lockPin,HIGH); 27 delay(3000); 28 digitalWrite(lockPin,LOW); 29 30 } 31 else if(voice == "door unlock")// 32 { 33 34 digitalWrite(unlockPin,HIGH); 35 delay(3000); 36 digitalWrite(unlockPin,LOW); 37 } 38 voice=""; //Reset the variable after initiating 39 }}
Downloadable files
Door Lock
Door Lock

Comments
Only logged in users can leave comments