Offline Arduino Voice Command Light On and Off

0

 

Offline Arduino Voice Command Light On and Off


Arduino has 10-bit ADC and 8-bit DAC so this is a very low resolution for making a voice command, even the Processor RAM and ROM are also very low, so one thing is clear, this configuration does not allow me to do sufficiently. Even in this topic, didn't find any suitable library for this purpose,

but I don't lose Hope.....

For this project, you need  

Arduino

Microphone

DF Player

SD card 

jumper wire

speaker

100 mf capacitor

1k resistor


Offline Arduino Voice Command Light On and Off

How it works?


The first thing is what is going on in my mind? And how do I do it? To know that I must understand a condenser microphone. 

If I give a 5-volt logic supply to a condenser microphone, if I want to see the value of the microphone then I have to connect it with a voltage divider and see the zero one binary value showing the graph on my oscilloscope, 


Offline Arduino Voice Command Light On and Off



we will see the signal is a tiger on 0.5 microseconds.

Now if I tap the microphone then you will see a very small 0.1 binary value. That is my mic-taping graph.

This voltage is very low, which Arduino's ten-bit ADC cannot analyze properly. because Arduino doesn't like below 5-volt, For that, I need to use a sound sensor module so that the correct value can be measured by the Arduino.

Actually, I mean the five-volt value here is 1024 to the Arduino, if it's 2.5 volts, that means 512, then my resolution is halved here. So it is wise to keep the voltage as high as possible.

I hope now you understand everything pretty well, How important it is!!


Step 1

Mic setup

now at first, I connected the microphone with Analog pin A0, next should had to connect logic 5 volts to run the mic Module.

Now I want to analyze the microphone captures sound so that is why I will connect my USB cable to this Arduino and another to my PC,

Offline Arduino Voice Command Light On and Off

next, I write an Analog read code and the value will be printed on a Serial monitor,

If you look carefully, you will see that I have given a delay of 50 milliseconds here (delay(50);

which is the timeline, which means that the amount of information value of my voice will be collected and how much less will be collected, depends on this delay.

Since the Arduino can't do a lot of numbers, I use a proper delay here to get the correct information from my voice.

Offline Arduino Voice Command Light On and Off




Offline Arduino Voice Command Light On and Off

here you can see the "Arduino light on" command value. 


light on ADC Valu

743

724

746

721

761

718

758

746

742


Arduino analyzed the voice ("Arduino light on")


if((micvalu==743)||(micvalu==724)||(micvalu==746)||(micvalu==721)||
(micvalu==761)||(micvalu==718)||(micvalu==758)||(micvalu==746)||(micvalu==742))
{
(LEDStatus==true);
digitalWrite(led,HIGH);
Serial.println("light off");
myDFPlayer.play(2);
}



light off ADC Valu

721

761

718

751

740

749

here you can see the "Arduino light off" command value. 


Arduino analyzed the voice ("light off")

else if((micvalu==721)||(micvalu==761)||(micvalu==718)||(micvalu==751)||
(micvalu==740)||(micvalu==749))
{
digitalWrite(led,LOW);
Serial.println("light ON");
myDFPlayer.play(1);
}

Offline Arduino Voice Command Light On and Off


Step-2 
Play Voice

now I want, someone to tell me the light is on even someone to tell me the light is off.
so that is why here I am using DFplayer to store voice

Offline Arduino Voice Command Light On and Off


For that reason, I recorded the voice of my wish with my niece's voice
Offline Arduino Voice Command Light On and Off


I will save the files to the SD card by naming the mp3 files 1 and 2 
Offline Arduino Voice Command Light On and Off


Download mp3 files 



Even in the code, I will define when the voice will be played


{
digitalWrite(led,LOW);
Serial.println("light ON");
myDFPlayer.play(1);
}
digitalWrite(led,HIGH);
Serial.println("light off");
myDFPlayer.play(2);
}
yes, it is working great, but there are also too many bugs because Arduino does not have enough calculation power to calculate a lot of Voice Command values.

 so sometimes it gets stuck. Sometimes it does not listen properly.
 so this is just an experiment for fun.


Download Code 

you can watch this video on my YouTube channel











Tags

Post a Comment

0 Comments

please do not enter any spam link in comment box

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top