Artificial Intelligence Do It Yourself - Voice kit, project to create a Google Assistant using a Raspberry Pi Zero and a Voice bonnet. And not only that: we experiment a little more and see more possibilities, as control a servo motor by voice. Kit version 2, with Raspberry Pi Zero. Música by internia.
Hi, I'm Anonymous Hacker, I'm here to present a very interesting video about the aiy Voice Kit, this little box that you see here and it's talking. This is without a doubt my favorite video, and I'm sure you'll give it a like before it goes halfway. Well, I'll leave you with Virtus Dante.
Greetings to you too, Anonymous. What uncle. Well, yes, today I bring you the Artificial Intelligence Voice Kit, a do it yourself (do it yourself), made by you with google (done by you with Google). Why with Google? Because it will allow us to build a google Assistant, an assistant from google to which we can ask questions and he will answer us in his own way, very funny. Yes, Without a doubt very cool, the 3-4 days that I have spent doing things with him I have had a great time.
In addition, there are many little things that are practiced, I have even had to make a little cutlet to be able to follow the video. And some of those little things are mid-level, even advanced, so let's have a good time huh?
Well, how has the project gone? Well, it went very well, we have completed it successfully. This has been thanks to following the guide that comes on the website, very well explained, here we have it, and As you can see, it is in English, yes, everything in English, you have to handle English well (to read it is not problem, to talk is something else right? Oh well). And here you see that everything is very well explained.
What have we had to do? We had to toast the SD, that is, record on the card SD memory the Raspbian operating system, a specific image for this project, which has pre-installed the Voice Bonnet, the hat that goes over the raspberry for the sound, and that contains the libraries and the source code of the examples that we are going to use. We also had to assemble the box.
It is not a Rubik's cube, it is a box for the Voice Kit. And it was easy thanks to the instructions.
Let's see, look at the photos, all very well explained, easy, easy, this easy part too. Has been than connecting our raspberry Zero to Wi-Fi, which is easy, it is nothing to write home about, and it has been necessary to enable and configure the google assistant API in the google Cloud Console, and this here it is already swampy terrain, because they are things that, if you do not follow the guide and they explain them well, if you do not have never seen, by yourself it is difficult to do it, because the interface is not intuitive and all you have to do to find out for yourself would be really difficult, so you have to do it with help. And here, I also had, we continued, the help to complete that step.
Finally, we also had to authorize the application to access our account of google and to be able to use the google assistant API and to communicate with us, of course, you have to understand what we say and give us an answer. And what is the result? Well here we have it the google assistant box, let's see a little how it works ... Hi, how are you? Very well thanks.
I'd like to have some beer.
Sorry, I didn't understand you. I want to order beer and pizza.
Here you have restaurants nearby. The first is the Stromboli pizzeria on Calle Pescadores 30, Isla Cristina. The second is Pasta Gansa, on Plaza La Lota street, at 8, Ayamonte. The third is the Casa Barberi restaurant, in Plaza de la Coronación 13, Ayamonte. I think it has geolocated me a bit far from where I really am, but hey.
I already have it assembled, so what I am going to do is show you a little how the box is, and open it so that you can see it inside. There you have the button cables.
There we are going to see the speaker, and below is the Voice Bonnet with the raspberry Pi Zero. Plus It cannot be simple. The assembly of the cables, because with the pins, super simple, there is no drop anything, all this comes to put it directly, it stays perfectly fitted.
Maybe the most complicated thing now is to put the cables here, but hey, It's not like it's the best thing in the world.
It is closed and, as you can see, I have the ports on the air. GPIO, HDMI, USB It is the Data, the Power to feed it, Audio is a headphone output.
There that hole helps us to see the light inside the raspberry if it is on, if it is working.
A speaker. The button to interact.
And here we have access to the SD card.
Very cool right? Well, when we already have our box with the toasted SD inside, We can connect it to power so that we can turn it on, and the next step would be to connect it to wifi. There are two ways to do it, one is through a smartphone application, there we have it, it is called google aiy Projects, and through this application it is very simple, it is the same as others applications that exist to connect smart devices to Wi-Fi, such as plugs and things like that, because it is specifically made to help connect our voice kit to Wi-Fi.
And the other way to connect to Wi-Fi is by connecting our raspberry Pi to a monitor and We access the Raspbian desktop and from there we configure it. Be careful with this, because The initial Raspbian configuration wizard is going to appear and there is a moment that we you are going to ask, you are going to ask us to update the software, and we should not do this, no, because the voice kit would screw us up, the Voice Bonnet installation will be lost and we will to screw everything up. So do not give him to update the Raspbian software. In the same way, since console do not do apt-get update or apt-get upgrade Ok, folks, huh? Do not update the Raspbian software. Why do you give me the option to connect through the app, when I could do it directly from the Raspbian desktop? Well, because really, to carry out the project, I do not need to enter, it is not essential, enter at any time to the Raspbian desktop, I will simply connect by SSH to the raspberry and from there I will be able to execute the commands and I will be able to launch the example programs, I will even be able to modify them, and test the Voice Kit. However, I have entered the Raspbian of the voice kit to see what it was like, to see what things it had, and, well, we'll see it now after a bit.
And what do you think if we do little things ... Well, first I wanted to show you what it brings the kit, is the box and everything that is inside, we have already opened it before and we have seen a little, and also brings the cable, the cable for USB power, but it does not bring the charger. It will serve us, and it will be essential that we have some, any charger of these, like this one that is fast charging, and can be the charger of any smartphone that we have. This is why it does not bring it, thus reducing costs, and assuming that all We have a smartphone and, therefore, a charger to be able to use the Voice Kit. I'm going to prepare it ...
Good, but also, if we want to connect it to the monitor, well what it brings is a mini HDMI port, and if we have a normal HDMI cable, as we will need a normal HDMI to mini HDMI adapter.
And if we need to connect a USB device, as what you have here is a mini USB, so i make it a normal usb port. And this is a keyboard, a wireless keyboard, also to be used as a mouse, as a mouse pad, that goes by bluetooth and connected to USB. Finally, I am going to connect the HDMI and food. As soon as I connect the power, it will work, and I have it prepared so that, as soon as it starts, the google assistant program runs, and We will know because the button's pilot is going to light up. The raspberry Pi Zero takes longer to start up, it is less powerful, I don't know if it had half a gig of RAM. Well it has already started, and now we are going to test it.
Hi how are things? What is the weather today in Granada?
Today in Granada it will be partly cloudy.
A maximum temperature of 65 and a minimum of 39 is expected. There are 60 with sunny skies.
Hello, prairie sinner, born after sorrows. For the glory from my mother, tell me sinful fistro, how can I help you? Well this is to die for right? The google assistant what tells me.
How funny you are, you have made my day, thank you very much.
Where are snowmen sheltered in summer? On the cloud.
Good grief, on top of it with jokes. Well, let's go to see the desktop, this is ours raspberry Pi Zero of the Voice Kit. Well, here you see the desktop background they have customized it with this from Artificial Intelligence Yourself projects. These files here are executables to check the audio, check the operation of the cloud, check the wifi, here we have a little program to configure the sound. You will see that everything here takes time to load.
There is. Output device speaker, recording, playback, ...
and now I'm going to launch the python editor and we will load one of the examples that come from code for to do with the Voice Kit. It takes time to load, you see. There we have it. This is the example of the voice recorder, which is a little program that what it does is that it waits for us to hit the button, when we give it begins to record, when we give it again for the recording, and it repeats, let's repeat, reproduces what you have recorded, our own voice. You see, press the button to start recording ...
And now I'm going to launch the recorder program.
There, you see. "Press button to start recording", I give ...
Hi how are things? I am Virtus Dante.
And now I give you to reproduce it.
"Hi, how are you? I'm Virtus Dante." Well, the playback, the sound records it a little bad, but it was an example right? And as you can see, the little program is very simple, here, a little program in python, very simple.
Well, this is interacting with the raspberry Pi of the voice kit from the desktop itself, the interface of the own desktop of the Raspberry, of the Raspbian, but we are going to do it now by SSH. We will come back to the PC and we are going to connect by SSH to the Voice Kit, and from there we are going to use the console, for the terminal, we are going to give it all the commands and we are going to try more things that can be done, eh?
Well, the guide, the tutorial on the web page that we follow to make the Voice Kit, the voice kit project, recommends us to use Chrome with the Secure Shell Extension to connect by SSH to the raspberry Pi of the Voice Kit, and work with it through the terminal, but I'm going to use Putty, which is a little program, an executable, very simple for Windows that will open a terminal and I will connect with the raspberry Pi.
Here you see, let's open ...
Here we have it.
User and password.
Well, we are already connected. Here, since this is a linux, I can make a list of folders and files, and we see the ones from the Artificial Intelligent Yourself, are the ones that We come with this specific Raspbian distribution for this draft. Let's try, for example, a little program that exists to synthesize voice, and what the text that I say here will say, for example "hello world".
"Hello world". You have seen that the pronunciation is, well, regular. Let's tell him to say something else ...
"Hello world, I am a machine". What I wanted to tell you is a voice synthesis that is done from the machine itself, with this little program I am not consulting, I am not using any google service, nor any API, and that synthesis has a quality a little worse than the one I get with the google Text to Speech API, which is an API that I pass a text a text written, a text string, and it returns the audio of that text string read. And I He does it very well, and being able to choose a voice and such. What happens? That this is paid, and this little program Well, since it is in the machine itself, it is not consulting anything, it is free. Default He speaks to me in English, he is prepared for English. If I want him to say something in Spanish, I have, first of all, what I want you to say in Spanish and I have to tell you, specify, language. "Hello, I am a machine." It also has parameters to change the pitch, speed and even the volume. This is the little program with which I made the introduction with the voice of Anonymous. "Hi, I'm Anonymous Hacker." Well as I said the google Text to Speech API gets me a much better voice, much more natural, like the one that the google assistant brings out, but it is paid, That API is paid, very cheap, but they are going to charge me something. So what's up? Well, according to what project You may be interested in using a better voice, or maybe this type of voice synthesis is enough for you, that has been known for a long time, but that does not give you that quality. You will not depend on a connection from Internet, nor will you depend on a paid service. And some of you may be asking us about that Text to Speech is paid, while google Assistant, which is another API, is not paid.
It is very simple, because through google assistant google will get to know you and that information you do not pay with anything, it is information that, you use the google Assistant, and google sucks, sucks, sucks, and is collecting information about us, what we are going to do, in exchange we have the service that it offers us, and the truth is that it is very good, but each one will do what they want. And the Text to Speech is from I pay because I may want him to say things that have nothing to do with me, they will not be useful things for Google, they are texts that, maybe, I want my program to say, and they are texts that google is not interested in, they do not give user information. So it is a useful tool for applications that we want to have a clear and more human voice than this box as we have seen before, and then it is a paid service. Well, now let's see a little program that works for us to allow us to give our voice kit instructions by voice commands, we will be able to say what to do something, we tell him talking and he will do it. Let's see the program, here we have it have, the cloud speech demo. This little program does use a google API, which is the Speech to Text API, the opposite that I commented before, the Text to Speech is that a text written by google is goes to sound, and the Speech to Text is that what I speak is going to be converted into written text, and then with this written text I can handle it in the program, compare if it has told me what I hope or not. We are going to see the program, the code, with the text editor here by console, the Nano.
Well, this is the program code, the source code.
It's in python too, and look here, the original program came with the instructions for, these four instructions in English, and I have prepared you for the same instructions in Spanish, and also I have added four more instructions, one repeats with me, move a motor, yes, yes, a motor, because now you will see that a motor is connected to the Voice Kit. And here, this is where I process the instructions, the commands. You see, there are the written commands, in literal strings, "turn on the light" (turn on the light) I added this to him, this "turn on the light", "turn off the light", "blink the light", and he just goes to search for this string in what the google service told me it understood by listening to my voice.
This is where I have added the commands to move a servo, a motor, which we are going to see now.
You see, here in the GPIO post of the raspberry Pi Zero I have connected some cables that I go to this motor, a servomotor, it is very basic, the most basic thing out there.
And so I, now when I run the program, let's test the commands.
There we have the program launched, it tells me that it is listening.
You see that he tells me what he understood, what I said "Aitana is scheduled to be launched." He tells me the things I can say, and keeps listening to the show.
I put it for you to see. And now, if I say for example "turn on the light", you see, it has been turned on.
It has been understood, it has understood that I have said "turn on the light" and it has been turned on. If I say "turn off the light", I turn off the light, and if I say "the light flashes" ...
I have to tell you the command as a single phrase.
"turn off the light" And now, the little motor, "moves the motor to the maximum".
"move the engine to minimum" Very cool. Well imagine the amount of things that can be done with this right? A box that can talk, that can move motors, that turns things on ... well great. Let's see, let's turn off the little program now.
So, from the applications with python we will be able to interact with the raspberry Pi, with the Voice Kit, and do our little programs and our little things, fiddle with a little ... There is a lot of code in reference github, which you can find an example, and everything is done by handling with ease an SDK that is available to interact with google services, with the Voice Bonnet, with the device ... Everything prepared, very easy, you have seen that the programs are short really, because we use the SDK, which is a great library where everything is done, everything is already fat.
done, and we only need to use it from our program, with commands, very easy.
Well, your imagination is the limit. If you have the possibility to control devices, the machine talking, the machine listening, using the google ... Well, imagination is the limit. One thing I did want to point out: you have seen that this wizard did not say "ok google", it does not work like that. It originally came with an example, a little program that worked like the traditional "ok google", waiting for me to say "ok google" and what I want to do, but that example program when you try to run it now tells you that it is outdated and not working properly. It's a shame, because it would also have been cool to try it, say "ok google tell me what can I do", but anyway. Well, friends, we have reached the end of the video. If you You liked what you have seen, the tests we have done with the Voice Kit, because a like and in the comments you can ask me questions, queries, comment what you want, and until next time!