Video 2.4 connecting the ESP 32 thing to AWS IoT the first steps. In this video, we will learn the following registering ESP 32 creating a policy attaching a policy making hardware connections. In the previous videos, we learned how to register a microcomputer Raspberry Pi to AWS cloud. In this video, we will register a microcontroller sparkfun ESP 32 thing. The registering process for any device is almost the same. So we'll quickly register ESP 32 thing.
First log into AWS IoT account, check the region for me. It's not Virginia only then IoT Core, go to manage things. Here you can find create selected. Now this registration process is same as Raspberry Pi registration Select Create a single thing. Now giving name my ESP 32. Here also we are not giving anything type or group name, select Next.
Now, let's create a certificate selecting create certificate. Now downloading the three certificates, the thing certificate, the private key, and we will download the root ca certificate again. Select it now amazing root ca one. This will again open another window. Now copy the text and paste it in a file with name Amazon underscore root underscore c underscore one dot p m save it with dot p m extension only. Don't forget to activate next attach a policy Since we have not created a new policy, select this thing.
Yes, our thing has been successfully registered. Now, we will create a new policy and attach it to the certificate, creating a policy. Now, select secure. Here we can find the certificate offer Raspberry Pi and ESP 32 thing. Now, select policies. The policy creation process is similar for any device clicking on Create.
Now, we'll create a policy by giving a name. Here I'm giving my ESP 32 underscore policy as the name next, adding statements. The give the action as IoT colon asterisk, and then in resource giving an asterisk select Hello clicking on Guess the policy is created. Now we should attach this policy to the certificate that we have created just a few minutes ago. Select secure and then certificates. Attach policy.
Choose my ESP 32 underscore policy, then attach to verify if the thing certificate and policies are attached correctly. Select the certificate policy here. This is the policy that we created for ESP 32 thing. Next thing, this is the tng name of our ESP 32. Yes, we successfully completed registering ESP 32 now let's jump into our main project. We will first connect the HD 11 the temperature sensor to the microcontroller sparkfun ESP 32 thing, and then send this sensor data to AWS IoT Core.
Now let's start with Canary. The hardware the d h 11 sensor module has three pins Vcc data and ground, we can directly connect the sensor to sparks on ESP 32 thing. For more details about the sensor, you can refer to the datasheet present in the resources section, the operating voltage of the DHT 11 sensor is three to five volts. So, connecting the 3.3 volt output pin of sparkfun ESP 32 thing to Vcc then connecting ground pin of ESP 32 to ground pin of DHT level. Finally connecting the data pin here I'm using GPIO four. So connecting the data into four.
Finally, we are done with the hardware. I have also attached this circuit diagram in the resources section. So come let's install the required libraries before we start programming. I hope everyone is familiar with it. No ID If not, please check out the resources section and install it onto your PC. Open Arduino ID, select sketch.
Then include library, then manage library. In free do a search enter unify. On scrolling down you will find at our throat unified sensor, then install the latest version. This library allows us to use any supported sensor with only little impact on rest of the system. Now, we will install the DHT sensor library by Adafruit. Search for DHT.
Select Install is completed. Now go to Tools and then boats manager selected you can see a list of booths. Now we will install ESP 32 board searched for ESP 32. Okay, did you find it? I guess no. This is because we need to install a third party code for ESP 32.
To do this, go to File, and then select Preferences. You can find a field with additional board manager URLs. Here we can specify the type of file, you will find a link in the resources section, copy the link, the additional boats manager will fetch the ESP 32 code developed by expressive systems. Now paste the link here like this. Then click on OK and exit the Preferences window. Now go to the boats manager and search for ESP 32 Now install this I'll install the latest version.
This will help us make ESP 32 compatible with the Arduino for using Arduino libraries and source code Now if you go to Tools and scroll down to check for the bolts, you will find the ESP 32 Arduino. Here, I will select the sparkfun ESP 32 thing. In this video we learned the following registering ESP 32 creating a policy attaching the policy making hardware connections. In the next video, we will connect ESP 32 to AWS IoT Core