Welcome to
SIMPLE LEARNING
AWS Cloud Home Automation, Zero to Hero Series, where the readership, essentially Embedded System Engineer & Cloud Engineer will able to learn to create Automated IoT Solutions using ESP32 Module (Hardware), AWS IoT portfolio services (MQTT & Integration assistance) & Arduino sketch (Code). The entire series mainly focuses on the Hardware integration with AWS Cloud to make a system of interrelated computing devices. The following series split into four parts (refer below) with very simple and clear instructions to provision a home automation system to control house appliances through the web.
Everything covered from scratch you won't face any difficulty understanding. In case of any clarification, drop me a note on LinkedIn. Feel free to explore them with ease, skip to the one which is relevant to you.We are going to use ESP32 MCU which is a
low-cost & low-power device
, with inbuilt Wi-Fi module, thus acts as a Cloud Communication Module (CCM) & we can create wonders with the conjunction of sensors & modules if used in ESP32. Security of connected devices is of predominant concern. The widely used Transport Layer Security (TLS) version 1.2 is the de-facto standard used on the web for secure connections including banking and financial institute. There are very few micro-controllers that supports TLS 1.2 and ESP32 is one of them. Good news is that AWS IoT Core maintains TLS 1.2 and above, thus making the security robust
.
Prerequisites:
Learning Objectives:
Kindly look for the step-by-step screenshots to follow the instructions vividly, kept it separate to make the document minimalistic.
To Install the espressif/arduino-esp32 core, click here
for step-by-step instructions
. Too lazy to be redirected to a new tab, follow the below steps (Easy Hack). If you have already installed Arduino core for the ESP32 manually (ESP32 Essential Libraries & Board configuration) you can skip to the next part.In this part, we will install the Hornbill AWS library which integrates the micro-controller, ESP32 with AWS Cloud, securely and anchored the communication channel with TLS 1.2. Click here to download the AWS_IOT Hornbill library. Exact the Hornbill-Examples-master.zip & go-to Hornbill-Examples-master\arduino-esp32, copy AWS_IOT and paste it to C:\Users\{Your User Name}\Documents\Arduino\libraries.
3.1 Create AWS IoT Policy
to refer the step-by-step screenshots to create AWS IoT Policy
. Click Here to go to AWS IoT Console we will select Policies under the
Secure
option from the Sidebar and click Create [Top Right Corner]. In the next step, we will give a name to this policy (e.g. ESP32Policy), under Action copy-paste the following; iot:Publish, iot:Connect, iot:Subscribe, iot:Receive, under Resource ARN put *, under Effect mark allow and click Create to provision the policy. In short, we are trying to create an AWS policy which will provide limited access to ESP32 to AWS resources.
3.2 Register the ESP32 Thing
to refer the step-by-step screenshots to register the Thing.
Lastly, we will select Things under the
Manage
option from the Sidebar and click Create [Top Right Corner] and follow the below steps. 4.1 Certificates and Private Key Enrollment
to refer the step-by-step screenshots to enrol the Certificates and the Private Key.
Here comes the fun part where we can see our real progress, firstly we will register the certificates and private key to our AWS_IOT library. Go to the following directory, C:\Users\YourUsername\Documents\Arduino\libraries\AWS_IOT\src, open the file aws_iot_certficates.c in an editor (Notepad++). Here we need to attach the Thing Certificate and Private Key which we have downloaded in the previous section along with the CA certificate, click here to copy or download the CA certificate. Now the tricky part, as we can see the blank spaces, represented with multiple:x, here we will inscribe the certificates and the private key. In aws_root_ca_pem[] we will set the CA certificate, in private_pem_key[] we will set the private key and certificate_pem_crt[] we will set the Thing Certificate.
4.2 Arduino Code in ESP32
to refer the step-by-step screenshots to upload the Arduino Code in ESP32 Board and test the incoming messages in AWS MQTT Client.
Next, we will work on the Arduino IDE and upload the Arduino code in the ESP32 Board. Make sure, you have restarted the Arduino IDE after following the instructions in the beginning & Plug your ESP32 board to your Desktop/Laptop using a USB cable. In the code, we are going to send dummy Humidity and Temperature data, replicating a DHT11/22 Sensor to Topic ESP32/DHT11.
Voila! You did the integration successfully :)
Complete this bonus section. Refer the following Document for more details. If you find any difficulties. Connect me @ https://linkedin.com/in/dasgourav
In the next part, we will turn ON/OFF the inbuilt led of ESP32 using AWS Device Shadow.Hope to see you again :)
Kindly Share & Comment only if you find it useful and help me on my mission to educate and familiarize people in the world of digitization 💪 #This is a Free tutorial and all my upcoming tutorials will be free and accessible from Public forums# Appreciate if you drop me a note on
LinkedIn
& share your opinion. Don't worry, I don't bite 👻 so don't shy away 🏃🏻♀️ 🏃🏻. Your feedback will help me to come up with more awesome contents on the internet.