WEBVTT

00:00.290 --> 00:05.420
In this lesson, we are going to establish the communication between Alexa and our PC.

00:05.990 --> 00:12.980
In practice, we are going to enable the communication between the Alexa Voice assistant and a web server

00:12.980 --> 00:17.000
on our PC that is going to be provided by Ngrok.

00:17.180 --> 00:22.880
This way our PC will be able to receive messages from the voice assistant and also to process these

00:22.880 --> 00:25.730
messages to actuate the robot accordingly.

00:26.440 --> 00:27.730
To enable this communication.

00:27.730 --> 00:32.980
As I said, we are going to use the Ngrok software, so let's start by downloading it.

00:32.980 --> 00:36.730
So in Google, let's look for Ngrok.

00:37.970 --> 00:43.100
And then let's click on the first one and here you are going to need an account to this website.

00:43.400 --> 00:46.190
So if you don't have yet, please sign up.

00:46.430 --> 00:50.360
Otherwise, if you have it, as in my case, just log in.

00:51.030 --> 00:55.000
And now once we access this web page, let's download.

00:55.020 --> 00:57.990
So let's download Ngrok for Linux.

00:58.170 --> 01:00.810
So this is going to download an archive.

01:01.080 --> 01:08.810
So let's open then the download folder in which it was downloaded and let's extract all the content.

01:08.820 --> 01:12.750
And so now we have ngrok here that is ready to be used.

01:13.200 --> 01:17.550
Now in order to use Ngrok, we need to open a new terminal.

01:18.420 --> 01:22.260
And so let's go to the folder in which we just downloaded Rock.

01:22.530 --> 01:26.970
And so in my case this is the downloads folder.

01:27.300 --> 01:29.280
And then we did the downloads folder.

01:29.280 --> 01:31.710
I downloaded a folder called Ngrok.

01:32.430 --> 01:37.200
And then within this folder we can see that there is an executable called Ngrok.

01:37.290 --> 01:44.430
We can start this executable with the command dot slash followed by the name of the executable that

01:44.430 --> 01:45.660
is Ngrok.

01:45.660 --> 01:50.700
And then we need to configure Ngrok in order to associate it with our account.

01:50.700 --> 01:57.450
So here, as you can see in the point number two, we can copy this command here which contains a key

01:57.450 --> 01:58.940
for your account.

01:58.950 --> 02:01.530
So let's copy the command.

02:03.350 --> 02:05.660
And let's paste it within the terminal.

02:07.020 --> 02:08.760
And so let's press enter.

02:08.760 --> 02:10.890
And this will have saved your key.

02:10.890 --> 02:14.130
And so we'll have activated also your lock account.

02:14.130 --> 02:17.070
And so from now on, we can start using this software.

02:18.220 --> 02:23.170
Now, in order to use it, we can still run the executable.

02:23.320 --> 02:25.060
So andyrock.

02:25.360 --> 02:30.880
And now we need to specify the communication protocol that we want to use for the web server that we

02:30.880 --> 02:31.960
are going to host.

02:32.180 --> 02:34.900
And so let's use the Http protocol.

02:35.080 --> 02:37.030
And now let's also specify the port.

02:37.030 --> 02:41.110
So which is the port of our PC, which we want to open to the outside.

02:41.110 --> 02:46.480
So to the internet and so which is the port that will be able to receive messages from the Amazon.

02:46.480 --> 02:51.400
Alexa assistant, let's say the port number 5000.

02:51.550 --> 02:53.260
So let's press enter.

02:53.260 --> 03:00.580
And now Ngrok will make the port 5000 of our PC so the local host accessible to the external world and

03:00.580 --> 03:01.780
so to the internet.

03:02.350 --> 03:05.260
It also provides us an unique address.

03:05.260 --> 03:11.700
So this one here, this is a unique address that is automatically generated by Ngrok.

03:11.710 --> 03:17.920
And this address is what we need to configure in the Alexa developer console in order to allow the voice

03:18.020 --> 03:20.300
assistant to send messages to our PC.

03:20.870 --> 03:22.550
So let's copy this one.

03:22.580 --> 03:25.220
The one that says Https.

03:25.490 --> 03:27.350
So let's copy this link.

03:27.350 --> 03:32.870
And now let's go back to the Alexa developer console and let's go back to the Arduino bot skill that

03:32.870 --> 03:34.310
we are implementing.

03:34.610 --> 03:40.460
Now let's take this on one side so that we can see the message exchange.

03:40.730 --> 03:47.480
And here let's go to the endpoint section and in the default region in which we inserted a placeholder

03:47.480 --> 03:53.030
address, now we can paste the actual address of our web service.

03:53.030 --> 03:58.700
So the one that Nroc makes available on our PC, let's save the endpoint.

03:59.450 --> 04:00.970
And now let's test this skill.

04:01.010 --> 04:01.610
Communication.

04:01.610 --> 04:05.810
So the communication between the Alexa developer console and our PC.

04:05.900 --> 04:11.290
So this is running on our PC and this is running on the Amazon Alexa servers.

04:11.300 --> 04:14.870
So now let's test the communication between these two systems.

04:15.260 --> 04:17.120
So again, in the test tab.

04:18.170 --> 04:20.870
Let's again activate the skill.

04:21.800 --> 04:23.270
Activate robot.

04:25.610 --> 04:28.640
There was a problem with the requested skills response.

04:28.790 --> 04:33.960
And you can notice that two messages have been printed here in the terminal.

04:33.980 --> 04:40.820
So in the Ngrok console, although these are error messages from the server indicating that it wasn't

04:40.820 --> 04:47.300
able to process the message that it received, this still means that the Alexa console was able to contact

04:47.300 --> 04:55.340
our PC, so was able to send a message to our PC through Ngrok and so through this address here that

04:55.340 --> 04:56.600
ngrok provided.

04:57.280 --> 05:03.210
I now that the Alexa voice assistant can communicate and so can send messages to the web server on our

05:03.210 --> 05:03.540
PC.

05:03.750 --> 05:10.950
We can finally add the logic that processes the messages that Alexa sends us and use their information

05:10.950 --> 05:13.050
to send commands to our robot.
