Full Transcript
https://www.youtube.com/watch?v=YZ0SOAFXVAQ
[00:00] on.
[00:01] on off.
[00:03] off hi this is Dr Ben finnio with science.
[00:05] hi this is Dr Ben finnio with science buddies and in this video I'll show you.
[00:07] buddies and in this video I'll show you how to set up voice recognition with an.
[00:09] how to set up voice recognition with an Arduino and the elec house voice.
[00:11] Arduino and the elec house voice recognition module V3.
[00:13] recognition module V3 let's start by taking a look at the.
[00:15] let's start by taking a look at the module there are several different ways.
[00:17] module there are several different ways it can communicate with the Arduino but.
[00:19] it can communicate with the Arduino but the manual recommends using the TX and.
[00:20] the manual recommends using the TX and RX pins for full functionality it does.
[00:23] RX pins for full functionality it does not come with header pins attached so.
[00:25] not come with header pins attached so you will need to solder those on.
[00:26] you will need to solder those on yourself so you can use it with a.
[00:28] yourself so you can use it with a breadboard it also comes with a small.
[00:30] breadboard it also comes with a small microphone that you can plug into the.
[00:32] microphone that you can plug into the microphone Jack here.
[00:35] microphone Jack here once you've put it in the breadboard you.
[00:37] once you've put it in the breadboard you have four pins to connect to your.
[00:38] have four pins to connect to your Arduino with jumper wires the ground pin.
[00:41] Arduino with jumper wires the ground pin is going to go to the arduino's ground.
[00:43] is going to go to the arduino's ground the VCC pin is going to go to the.
[00:46] the VCC pin is going to go to the arduino's 5 volts the RX pin will go to.
[00:50] arduino's 5 volts the RX pin will go to Arduino pin 3 and the TX pin will go to.
[00:54] Arduino pin 3 and the TX pin will go to Arduino pin 2. note that pins two and.
[00:56] three are what's used in the example.
[00:59] three are what's used in the example program that is provided but you can.
[01:00] program that is provided but you can change these pins in the software later.
[01:04] change these pins in the software later that is it for the hardware setup let's switch over to the computer and look at setting up the software.
[01:09] the first thing you will need to do is head over to their website you can find that link in the description of this video and download the Arduino Library.
[01:17] once you've downloaded that zip file extract it to your Arduino libraries folder on your computer and you should have a folder called voice recognition B3.
[01:27] once you've installed the library open the Arduino IDE then select file examples voice recognition V3 VR sample train.
[01:40] once you've opened the program make sure you have the correct Arduino board and com Port selected then upload it to your Arduino.
[01:49] after the program has finished uploading select tools serial monitor and make sure the baud rate is set to 115 200.
[02:01] in the serial monitor you will see a list of commands that you can use to control the voice recognition module.
[02:07] to train a voice recognition command type train and then a number that will be the index of the command.
[02:15] note that the module can store up to 80 commands total but only 7 can be active at one time.
[02:22] see the manual for more details.
[02:23] I am going to type train 0 because the index starts at zero.
[02:28] press enter and then follow the on-screen prompts to speak the command.
[02:33] it will try to get two matching recordings of the command before finishing.
[02:36] if it has trouble matching the commands it will prompt you to continue speaking.
[02:48] once you have recorded two successful matches of the command it will stay success and that that record is trained.
[02:55] I am now going to do the same thing to train the word off for record one.
[03:02] off.
[03:08] And just to give an example of what that might look like if you mess up, let's try record two.
[03:13] And I'm going to use the word hello for this one.
[03:15] Hello for this one.
[03:18] Hello.
[03:36] So there we go, don't panic if it doesn't work on the first two tries.
[03:39] It will continue prompting you to speak until it gets a match.
[03:44] After you have trained the commands, type load followed by the indices of the commands that you have trained.
[03:46] So I'm going to do 0 space 1 space 2.
[03:50] Press enter.
[03:54] Those commands are now loaded and I can test them.
[03:56] I can test them on.
[03:59] On.
[04:01] Off.
[04:03] Off hello.
[04:05] Hello on.
[04:07] On, so you see that when I speak each command and it is successfully recognized, the serial monitor will print out the index that I have stored that command in.
[04:16] Now let's use those commands to do something.
[04:18] You can use an example program to just control the built-in LED on the Arduino.
[04:22] So again, go to file examples, voice recognition V3, and select VR sample control LED.
[04:29] I am not going to go through this entire program.
[04:33] We are just going to look at two key parts.
[04:35] First, notice how it defines constants related to the indices where you have the records or commands stored.
[04:40] Remember that we have 'on' stored in index one and 'off' stored in index two.
[04:44] If we scroll down to the bottom of the program, we will see there is a switch case statement that uses digital write to turn the LED on or off depending on which record it detects.
[04:57] So if we upload this program and switch back over to our Arduino, we should be.
[05:04] Back over to our Arduino, we should be able to speak the words on and off to control the onboard LED.
[05:08] The Arduino's onboard LED is pretty tiny.
[05:11] Take a look right there and let's test it out on.
[05:15] Off.
[05:17] On.
[05:19] Off.
[05:21] On.
[05:23] Now, you will definitely not have a 100% success rate with this since it is running locally on the Arduino.
[05:25] This is much less powerful than something like a cloud speech to text service from Google or Amazon.
[05:32] And it is speaker dependent.
[05:35] It is trained to recognize the exact sound clip of you speaking that word.
[05:37] So if somebody else comes along and says on or off, it is not going to recognize their voice.
[05:46] The success can also depend heavily on factors like background noise and the distance from the microphone.
[05:48] Let's see what happens if I move a little farther away.
[05:55] On.
[05:57] Off.
[05:59] On.
[06:01] On.
[06:06] and then if I get closer again on off.
[06:07] off on.
[06:09] on off.
[06:11] off on.
[06:12] on so again you can see the success rate is.
[06:14] so again you can see the success rate is not 100 percent.
[06:16] not 100 percent however this is still a pretty quick and.
[06:19] however this is still a pretty quick and easy way to get voice recognition.
[06:20] easy way to get voice recognition working on an Arduino that does not.
[06:22] working on an Arduino that does not require an internet connection.
[06:24] require an internet connection for written instructions to set this up.
[06:26] for written instructions to set this up and instructions for controlling.
[06:28] and instructions for controlling external hardware like appliances that.
[06:30] external hardware like appliances that must plug into a wall outlet check out.
[06:32] must plug into a wall outlet check out the links in the description of this.
[06:33] the links in the description of this video.
[06:34] video on.
[06:36] on off.
[06:37] off for thousands of other fun Hands-On.
[06:39] for thousands of other fun Hands-On science and engineering projects visit.
[06:41] science and engineering projects visit us online at www.sciencebuddies.org.