This is a tutorial for people with AWS account and familiar with Arduino IDE. Both are free.
Got an email from Seeed offering a free Wio Terminal to play with. Couple of weeks later I received the device, and it is amazing! Started looking for ideas to publish as a project here and found plenty of tutorials on:
https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/
The one tutorial I didn't find was how to connect to AWS IoT Core, and I thought that would be my opportunity to shine.
If you try to skip the bla bla and jump straight to the code like I did you may run into an issue. To avoid that issue head over to https://wiki.seeedstudio.com/Wio-Terminal-Network-Overview/ and follow two steps to "Update the Wireless Core Firmware". Go ahead, I'll wait here.
That was easy, wasn't it?
In this tutorial we will publish some numbers every 30 seconds, but the code can be easily modified to publish something more useful such as temperature or output from light sensor. The code I used to publish MQTT messages to AWS can be found at the end of this tutorial. Few things will need to be saved in secrets.h and they will be covered during working with AWS in the following steps.
Login to AWS and type "iot core" in the search bar at the top then click IoT Core
Expand Secure and click Policies then create a new Policy.
This policy will allow all actions on all resources so it will be used for testing only. Scroll down and click Create.
Next, expand Manage and click Things
Click Create things.
We're creating one thing only, so click Next.
Give this thing a name which will be used later in the Arduino sketch.
Scroll down then click Next.
Click Next to auto generate certificate.
Attach the policy we just created then click Create thing.
We will need to download Device Certificate (AWS_CERT_CRT), Device Private Key (AWS_CERT_PRIVATE), and Amazon Root CA 1 (AWS_CERT_CA) to use them in secrets.h. We will also need to download Public key file just to close this dialog box.
Scroll down and click Done.
Click Settings in the left side of the screen.
We will need to use this Endpoint.
Uncollapse the left menu then click MQTT test client.
Subscribe to # to see all topics.
Leave this window open to watch messages come in from Wio Terminal.
We can now go to secrets.h and fill out all the missing information. The code is now ready to be uploaded to Wio Terminal.
Success!
I really enjoyed working with Wio Terminal and look foreword to use it in future projects.
Comments