MicroZed Chronicles: IoT with AWS & the MicroZed

FPGA and SoC are key components of the Internet of Things (IoT) and its industrial partner the Industrial Internet of Things (IIoT). This…

adam-taylor
over 5 years ago

FPGA and SoC are key components of the Internet of Things (IoT) and its industrial partner the Industrial Internet of Things (IIoT). This is especially true for system on modules like the MicroZed which can be used for both development and the final product.

MicroZed and AWS all up and running

Amazon Web Services (AWS) is a very popular service for a range of cloud computing services and IoT. Indeed, I recently created a Hackster project showing how we could use the Amazon F1 Instance.

In this blog, we are going to look at how we can use the AWS FreeRTOS to connect our MicroZed to the AWS IoT.

The first stage in this journey is to start with a AWS account. Once we have an AWS account, we can sign in to the AWS IoT console. It is within this console that we are going to access the software example we will use and configure out IoT end point.

First, let’s grab the software — we can do this by clicking on the software option on the left hand menu.

AWS IoT welcome page

Clicking on the software menu will present us with several possible options. For this example, we want to click on the option to configuring the Amazon FreeRTOS device software.

Selecting the SW we desire

This option will provide us a list of predefined example applications for a range of devices. For this application, select the “Connect to AWS IoT — Xilinx.”

Downloading the AWS source code

This will download a ZIP file which we need to extract. When we do this be careful to ensure the path length is less than 255 characters if you are using Windows.

The next stage is to create the end point. You can find the name of this from the settings menu also on the left-hand menu.

Creating the end point

Once we have the end point created, the next step is to create a thing. We can do this from the manage menu.

Register a IoT thing

From there, register a single AWS IoT thing.

Creating an IoT thing

As we register it, we can define its name and create the necessary security certificates and keys.

Creating the IoT thing in detail
Obtaining the certificates

Be sure to download the certificates, as we will need these later. Once this is completed, you will see the IoT thing we just created.

Successful thing creation

We are now ready to start working with the software.

For starters, we need to add in the end point name and the name of the IoT thing we just created. We add this into file:

\demos\common\include\aws_clientcredential.h

Updating the AWS credentials

We also need to generate the keys required to access our AWS IoT system, in a format that can be used in the C application. This is achieved using the certificate configuration tool — the tool is run in a web browser and can be found under the directory:

\AmazonFreeRTOS\tools\certificate_configuration

Run the CertificateConfigurator.html

Within the tool, select the necessary files and generate the AWS_Clientcreddnetial_keys.h file.

Save this file to the following directory:

AmazonFreeRTOS\demos\common\include

If you are prompted to overwrite the file, please allow this:

Certificate configuration tool

Back in our AWS IoT console, the next step is to set up a subscription. We can do this using the test menu.

Subscribe to freertos/demo/echo

Creating the Subscription

The next step is to Open Xilinx SDK, and select the workspace located at:

AmazonFreeRTOS\demos\xilinx\microzed\xsdk

However, when this opens you will see no projects. To see them we need to import the projects.

Select File->Import and from within the dialog select General, choose Existing Projects into Workspace.

Select the root directory to be AmazonFreeRTOS and you will see the four projects which can be imported.

Importing the projects

Before we can build the project, though, we need to set a string substitution to the root directory of our project.

Performing the string substitution

We can now perform a clean of the project and rebuild the project. There should be no errors.

Once we have the ELF file, we can set up a debug application and download the ELF to the MicroZed and run the application.

Application built and downloaded, ready to run on the target

When the application is running, we can see the progress in a terminal window over the USB UART.

UART output

We can also confirm that our AWS IoT is receiving connections and publishing messages.

We can do this on the monitor menu — the results of which for this application can be seen below.

Number of successful connections
Number of messages published

We are now able to communicate between our MicroZed and the AWS IoT, can start adding more functionality to our application.

See My FPGA / SoC Projects: Adam Taylor on Hackster.io

Get the Code: ATaylorCEngFIET (Adam Taylor)

Access the MicroZed Chronicles Archives with over 250 articles on the Zynq / Zynq MpSoC updated weekly at MicroZed Chronicles.

adam-taylor

Adam Taylor is an expert in design and development of embedded systems and FPGA’s for several end applications (Space, Defense, Automotive)

Latest Articles