---
title: "Visualization W5100S-EVB-Pico MQTT Using AWS + Grafana"
url: "https://maker.wiznet.io/pranchal/projects/Visualization-W5100SEVBPico-MQTT-Using-AWS-Grafana/"
markdown_url: "https://maker.wiznet.io/pranchal/projects/Visualization-W5100SEVBPico-MQTT-Using-AWS-Grafana/md"
type: "UCC: User Created Content"
author: "pranchal"
author_url: "https://maker.wiznet.io/pranchal/"
original_author: "pranchal"
original_url: "https://www.hackster.io/dlruddms5619/visualization-w5100s-evb-pico-mqtt-using-aws-grafana-a3041d"
published: "2022-03-28"
language: "en"
likes: 0
views: 207
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Visualization W5100S-EVB-Pico MQTT Using AWS + Grafana

> Visualization W5100S-EVB-Pico MQTT Using AWS + Grafana

Original author: pranchal (source: https://www.hackster.io/dlruddms5619/visualization-w5100s-evb-pico-mqtt-using-aws-grafana-a3041d)

## Article

## Things used in this project

| ### Hardware components |  |  |  |  |
| --- | --- | --- | --- | --- |
| ![W5100S-EVB-Pico](https://hackster.imgix.net/uploads/attachments/1364155/w5100s-evb-pico-side_%28medium%29_xCG7Vos8ax.png?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff) | \| [WIZnet W5100S-EVB-Pico](https://www.hackster.io/wiznet/products/w5100s-evb-pico?ref=project-a3041d) \| \| --- \| \| \| | × | 1 |  |
| ![Ethernet Cable, Cat6a](https://hackster.imgix.net/uploads/attachments/834333/06X8564-40.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff) | \| Ethernet Cable, Cat6a \| \| --- \| \| \| | × | 1 |  |
| ![USB-A to B Cable](https://hackster.imgix.net/uploads/image/file/96111/Adafruit_Industries-ADA62-image_75px.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff) | \| USB-A to B Cable \| \| --- \| \| \| | × | 1 |  |
| ### Software apps and online services |  |  |  |  |
| ![AWS IoT](https://hackster.imgix.net/uploads/image/file/85734/ha_2up_iot.png?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff) | \| [Amazon Web Services AWS IoT](https://www.hackster.io/AmazonWebServices/products/aws-iot?ref=project-a3041d) \| \| --- \| \| \| |  |  |  |
|  | \| Amazon Timestream \| \| --- \| \| \| |  |  |  |
|  | \| Grafana \| \| --- \| \| \| |  |  |  |

## **Story

### 1. W5100S-EVB-Pico + AWS IoT Core

**1) Connect components**

Connect W5100S-EVB-Pico and ethernet cable. And the board connect to PC using 5 pin USB cable.

**2) Setup AWS IoT Core**

Please see and follow the link below.

<https://docs.aws.amazon.com/iot/latest/developerguide/create-iot-resources.html>

**3) Setup Connect AWS IoT through MQTT Example**

-**?Git clone**

```
git clone --recurse-submodules https://github.com/Wiznet/RP2040-HAT-AWS-C.git
```

-?**Setup SPI port and pin**

Settings in the 'w5x00_spi.h' file located in the 'RP2040-HAT-AWS-C/port/ioLibrary_Driver/' directory.

```
/* SPI */
#define SPI_PORT spi0

#define PIN_SCK 18
#define PIN_MOSI 19
#define PIN_MISO 16
#define PIN_CS 17
#define PIN_RST 20
```

-?**Setup network config**

Set in the 'aws_iot_mqtt.c' file in the 'RP2040-HAT-AWS-C/examples/aws_iot_mqtt/' directory.

If the board is connected to the router, it is assigned automatically, so there is no need to edit the file.

```
/* Network */
static wiz_NetInfo g_net_info =
    {
        .mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC address
        .ip = {192, 168, 11, 2},                     // IP address
        .sn = {255, 255, 255, 0},                    // Subnet Mask
        .gw = {192, 168, 11, 1},                     // Gateway
        .dns = {8, 8, 8, 8},                         // DNS server
        .dhcp = NETINFO_DHCP                         // DHCP enable/disable
};
```

-?**Setup AWS IoT configurationMQTT_DOMAIN**?is AWS IoT Core > setting >?**device data endpoint**.

Replace my_rp2040_thing with the**?name of the device**?you created.

Username and password are not set.

```
/* AWS IoT */
#define MQTT_DOMAIN "account-specific-prefix-ats.iot.ap-northeast-2.amazonaws.com"
#define MQTT_PUB_TOPIC "$aws/things/my_rp2040_thing/shadow/update"
#define MQTT_SUB_TOPIC "$aws/things/my_rp2040_thing/shadow/update/accepted"
#define MQTT_USERNAME NULL
#define MQTT_PASSWORD NULL
#define MQTT_CLIENT_ID "my_rp2040_thing"
```

-**?Setup device certificate and key**

Set in the?**mqtt_certificate.h**?file in the 'RP2040-HAT-AWS-C/examples/aws_iot_mqtt/' directory.

Insert the authentication key issued when creating a device in AWS. Put the Amazon?**Root CA1**?certificate in root_ca. Put your?**certificate.pem**?in client_cert. Put RSA in the?**private key**.

You must enter it according to the input format below. Enclose each line in quotation marks and?**rn**.

```
uint8_t mqtt_root_ca[] =
"-----BEGIN CERTIFICATE-----rn"
"...rn"
"-----END CERTIFICATE-----rn";

uint8_t mqtt_client_cert[] =
"-----BEGIN CERTIFICATE-----rn"
"...rn"
"-----END CERTIFICATE-----rn";

uint8_t mqtt_private_key[] =
"-----BEGIN RSA PRIVATE KEY-----rn"
"...rn"
"-----END RSA PRIVATE KEY-----rn";
```

-?**Setting MQTT Message**

In RP2040-HAT-AWS-C, in the file examples/aws_iot_mqtt/aws_iot_mqtt.c, change the line 207 code to temperature, humidity and build.

![](https://hackster.imgix.net/uploads/attachments/1411985/image_9oXcf8ZYuO.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**4) Build**

When you have finished editing the file, click the build button in vs code or press f7. When the build is completed, the?**'aws_iot_mqtt.uf2'**?file is created in the 'RP2040-HAT-AWS-C/build/examples/aws_iot_mqtt/' directory.

**5) Upload and Run**

Press the BOOTSEL button of W5100S-EVB-Pico and connect the USB port to mount the RPI-RP2 drive automatically.?**Copy and paste the 'aws_iot_mqtt.uf2' file in the drive.**

-?**AWS MQTT Test client**

Select the?**Test Client**?menu in the AWS IoT console. Subscribe to a topic and publish a topic.

![](https://hackster.imgix.net/uploads/attachments/1411962/image_AZR6TKxCyC.png?auto=compress%2Cformat&w=740&h=555&fit=max)

### 2. AWS IoT Rule + Timestream

**1) Setup Amazon Timestream**

-**?Create DB**

Enter the Timestream console and create a DB. Select?**Standard database**, set only the?**DB name**?and click the?**Create database**?button.

![](https://hackster.imgix.net/uploads/attachments/1411964/image_NfhbOFrTJ3.png?auto=compress%2Cformat&w=740&h=555&fit=max)

-?**Create Table**

Create a table in the DB created above. Set the?**name**,?**data retention period**?and click the Create table button.

![](https://hackster.imgix.net/uploads/attachments/1411965/image_6yi62SwBxE.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**2) Setup IoT Rule**

-?**Create Rule**

AWS IoT Core > Rule > Create

![](https://hackster.imgix.net/uploads/attachments/1411966/image_jJAw9P1BAK.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**Set rulename.**

![](https://hackster.imgix.net/uploads/attachments/1411967/image_ai12m7sj63.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**Set query.**?Enter the?**topic**?set above.

![](https://hackster.imgix.net/uploads/attachments/1411969/image_Cc2PZG7P5n.png?auto=compress%2Cformat&w=740&h=555&fit=max)

Timestream job configuration.

![](https://hackster.imgix.net/uploads/attachments/1411970/image_yilCyrN19D.png?auto=compress%2Cformat&w=740&h=555&fit=max)

Set the DB and Table created above, and set the dimension to clientId.?**${clientId()} is the value received from the device.**?There are only Temperature and Humidity in the MQTT message, but if you do this, the clientId is automatically inserted into the table.

![](https://hackster.imgix.net/uploads/attachments/1411971/image_1LVNgTqud1.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**Click Create Role and create a new one.**

You can set it up by going to the IAM page, but if you set only a name and create a role here, the role is automatically set with permission to write data to Timestream, so it is convenient to create it here.

Also, if a pre-made role is used, even if the role can write to the timestream table, the role has limited privileges only for a specific table, so the operation is not performed properly.

It is recommended to make a new one and use it.

![](https://hackster.imgix.net/uploads/attachments/1411972/image_8wxOOJjVxD.png?auto=compress%2Cformat&w=740&h=555&fit=max)

![](https://hackster.imgix.net/uploads/attachments/1411973/image_xT7VyE2oyT.png?auto=compress%2Cformat&w=740&h=555&fit=max)

Error actions and tags create rules without separate actions.

![](https://hackster.imgix.net/uploads/attachments/1411975/image_plJIAouE0P.png?auto=compress%2Cformat&w=740&h=555&fit=max)

-?**Check Timestream table**

Check whether the rule is executed properly through the Query editor in Timestream.

![](https://hackster.imgix.net/uploads/attachments/1411976/image_CgZ14KnmQE.png?auto=compress%2Cformat&w=740&h=555&fit=max)

### 3. Timestream + Grafana

**1) Connect Timestream to GrafanaSetup Data sources.**

Enter Grafana - Configuration - Data sources > Amazon Timestream

![](https://hackster.imgix.net/uploads/attachments/1411977/image_mZR8kDBpBh.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**Timestream settings**

Select?**Access & secret key**?from Authentication Provider and enter.?**Default Region**?is set to the region where Timestream exists.?**Default Query Macros**?set Timestream DB and Table. After completing the settings, click the?**Save & test?**button below, and if the connection is successful, a message of Connection success appears.

![](https://hackster.imgix.net/uploads/attachments/1411978/image_j4lgtIdBaf.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**2) Setting DashboardCreate - Dashboard**

![](https://hackster.imgix.net/uploads/attachments/1411979/image_tONheEHHzl.png?auto=compress%2Cformat&w=740&h=555&fit=max)

New dashboard created. Choose?**Add a new panel.**

![](https://hackster.imgix.net/uploads/attachments/1411980/image_JzVuERdJMS.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**Set queries.**

![](https://hackster.imgix.net/uploads/attachments/1411981/image_3ELJsyX1js.png?auto=compress%2Cformat&w=740&h=555&fit=max)

![](https://hackster.imgix.net/uploads/attachments/1411982/image_eBi0PTr4iT.png?auto=compress%2Cformat&w=740&h=555&fit=max)

Timestream data can be monitored in real time.

**Currently, data is passed as a fixed value, but it can be implemented by connecting a sensor to receive the sensor value.**

![](https://hackster.imgix.net/uploads/attachments/1411983/image_E2ngtjdTsO.png?auto=compress%2Cformat&w=740&h=555&fit=max)

By pressing the Apply button above,?**you can visualize the MQTT message sent by W5100S-EVB-Pico in real time.**

![](https://hackster.imgix.net/uploads/attachments/1411984/image_OhzQBhy5o0.png?auto=compress%2Cformat&w=740&h=555&fit=max)

---

Source: https://maker.wiznet.io/pranchal/projects/Visualization-W5100SEVBPico-MQTT-Using-AWS-Grafana/
