Hello Everyone,
In this project I am going to demonstrate how we can send data to AWS IoT Core using Wio Terminal as Google Cloud has update that they are going to close their IoT Core service till 2023 and it's great time to get started with AWS IoT Core.
Why I choose the Wio Terminal instead of ESP32? well soon I will share the Article for ESP32 with AWS IoT so let's come to point, actually I am using Wio terminal as it's an awesome product by SeeedStudio which contains alot of built in sensors such as Mic, Light, Infrared, Accelerometer and awesome built-in display as well as WiFI & BLE Connectivity and have 2 Grove Connector to extend it's functionality as well as 40 GPIO pins which are Raspberry pi compatible in reasonable pricing.
I am assuming that you have Wio terminal if not then please buy 1 from seeedstudio and setup the board in Arduino IDE by following that link https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/
after installing SeeedStudio board and relevant libraries now we are moving towards AWS IoT Core.
Step#1Navigate to aws.amazon.com/
and type IoT Core in Search bar and click on IoT Core.
Click on the All Devices->Things and then Click on Create things
Select "Create Single Thing" and Click on "Next" button.
Type the thing name "Wio Terminal" or any thing that you want and leave the Additional Configuration. Select "No Shadow" and click on "Next" button
Select 'Auto-generate a new Certificate(recommended)" and click on "Next" button
In AWS every resource have access policy so here we also need to create a policy regarding access so click on 'Create Policy" and you will be on next page where you can select the permissions for your device.
Below is the policy page type the Policy name I am giving it "Wio_Policy" but you can what ever you want, and below Select "Allow" under Policy effect and select different policy opitons like iot:Connect, iot:Publish, iot:Receive, iot:Subscribe" under Policy Actions and put * under Policy resource.
After adding these policies just switch back to your previous tab and refresh the page so you can get the policy.
Hurry our policy is there just select and click on 'Create thing' button
Congrats your device has been setup and now just download the 3 Certificates which are Device Certificate, Private Key File and Amazon trust services end Point.
Now our cloud setup has been completed and from onward we are moving back to arduino IDE for Coding.
Download the AWS_IoT library for Wio Terminal from github https://github.com/Seeed-Studio/Seeed_Arduino_rpcAWS
and Install the Library in Arduino IDE by Navigating Sketch ->Include Library -> Add.Zip Library..
Copy the code from code section there are 2 files one is main.ino and other is.h file.
Step#11In the secrets.h just update your Wi-Fi SSID, Password, HOST Address (you can get the host information from your AWS IoT Portal by click on Settings.
Later just Open the Amazon trust services end Point,Device Certificate, Private Key File and paste the keys into code according to red marking area.
Change the topic in wio_aws_iot_core file or use the topics that I placed in the code. finally upload the code to Wio Terminal.
after uploading the code to Wio Terminal now hit back to AWS IoT Core dasboard and click on Test -> MQTT Test Client. and type the Pub Topic which is "Wioterminal/pub" and click on Subscribe button and below you will see the data packets in real time which has been sent by device.
After practicing that simple project I hope you will get some happiness, if you face any issue during your practice please leave a comment and I will try my best to help you. I will try my best to make new article soon in which I will share how to store the thing/device data on AWS Cloud for further process.
if you want to learn more about MQTT and want to host your own MQTT Broker then here is my Course at Udemy look it
here.
Comments