---
title: "Alert system using W5100S-EVB-Pico and AWS SNS"
url: "https://maker.wiznet.io/Acorn_/projects/alert-system-using-w5100s-evb-pico-and-aws-sns/"
markdown_url: "https://maker.wiznet.io/Acorn_/projects/alert-system-using-w5100s-evb-pico-and-aws-sns/md"
type: "UCC: User Created Content"
author: "Acorn_"
author_url: "https://maker.wiznet.io/Acorn_/"
original_author: "acorn"
original_url: "https://velog.io/@dlruddms5619/Alert-system-using-W5100S-EVB-Pico-and-AWS-SNS"
published: "2023-12-03"
language: "en"
hardware: ["WIZnet W5100S-EVB-Pico"]
likes: 0
views: 229
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Alert system using W5100S-EVB-Pico and AWS SNS

> The IoT core receives the MQTT message sent from W5100S-EVB-Pico, sets a rule, and sends outlier data to SNS to receive email notifications.

Original author: acorn (source: https://velog.io/@dlruddms5619/Alert-system-using-W5100S-EVB-Pico-and-AWS-SNS)

## Components

- **WIZnet W5100S-EVB-Pico** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5100S/w5100s-evb-pico))
- Software: **AmazonWebServices AWS SNS** ([docs](http://aws.amazon.com/sns/))

## Article

## 1. Concept

Sensor outlier detection alarm.
Set to receive a notification when the value sent from the sensor exceeds the set threshold.
The IoT core receives the MQTT message sent from W5100S-EVB-Pico, sets a rule, and sends outlier data to SNS to receive email notifications.

![](https://velog.velcdn.com/images/dlruddms5619/post/ada0bdee-93ab-4813-8411-30e870aff7fb/image.png)

## 2. Implementation

### 1) Connect AWS IoT Core + W5100S-EVB-Pico

#### Create Thing

- Click "Create things"

![](https://velog.velcdn.com/images/dlruddms5619/post/1ffb0665-a33e-4e99-906b-3bfc4117c6c9/image.png)

- Select "Create single thing"

![](https://velog.velcdn.com/images/dlruddms5619/post/c88d03ae-6780-4626-83d3-b1021aeb9d27/image.png)

- The thing name is set to be identifiable.

![](https://velog.velcdn.com/images/dlruddms5619/post/dc3675b4-bb2a-4c05-a9fa-9d6d03638c26/image.png)

- Select Automatically generate certificate.

![](https://velog.velcdn.com/images/dlruddms5619/post/9fbb66c8-8df9-422b-8c83-c516fd5ba924/image.png)

- Create and connect policies for IoT Core use.

- The policy details are as follows.

```plaintext
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iot:Connect",
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "iot:Publish",
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "iot:Receive",
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "iot:Subscribe",
      "Resource": "*"
    }
  ]
}
```

#### Publish MQTT Message

- We used the SDK that connects RP2040 and AWS, and can be used by following [the GitHub link .](https://github.com/Wiznet/RP2040-HAT-AWS-C/tree/main/examples/aws_iot_mqtt)

- I changed the thing name to the thing name created above.

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

- The message payload currently being sent by W5100S-EVB-Pico is as follows:

```plaintext
{"temperature":23, "humidity":25}
```

![](https://velog.velcdn.com/images/dlruddms5619/post/ed29e98e-a4ec-404a-be6a-118bc8b087f3/image.png)

### 2) SNS settings

#### Create Topic

- In the AWS SNS Console window, click Topics > Create topic.

![](https://velog.velcdn.com/images/dlruddms5619/post/9d9f5b32-4294-4076-b381-e08abe0eb997/image.png)

- Select Standard as the Type and set the Name of the Topic.

- FIFO supports only SQS subscription protocol.

![](https://velog.velcdn.com/images/dlruddms5619/post/badbdbd0-f906-4190-b01f-e3ab95c78c33/image.png)

#### Create Subscriptions

- Go to the details page of the topic you created and select create subscription.

![](https://velog.velcdn.com/images/dlruddms5619/post/73af55eb-25a0-499d-bd2d-1b91ac7e152e/image.png)

- Subscription is where you will receive notifications, and the endpoint is set to email.

- Confirmation is required after creation.

![](https://velog.velcdn.com/images/dlruddms5619/post/7be9e6e9-1f28-45e2-b0aa-24dc4de73646/image.png)

- After creation, a verify email is sent to the corresponding email address. It can be used only after confirmation via email.

- Go to your email and click Confirm subscription

![](https://velog.velcdn.com/images/dlruddms5619/post/b6acc868-84f9-45dc-a1ac-6dcade66a9ba/image.png)

- When you click, the screen below will appear, and when you enter Subscription on SNS, the status of the subscription will change to Confirmed.

![](https://velog.velcdn.com/images/dlruddms5619/post/25af3aa3-956e-4bcd-a4f3-270f8efbaa68/image.png)

#### Test SNS

- Go to topic and click Publish message

![](https://velog.velcdn.com/images/dlruddms5619/post/cf9a04be-61bb-4a72-abeb-61ced3c932b4/image.png)

- Enter test message in messgae body and click publish message.

![](https://velog.velcdn.com/images/dlruddms5619/post/92abe529-0623-47d8-aa27-28aaf171a25e/image.png)

- You can confirm that a test message has been sent to your email.

![](https://velog.velcdn.com/images/dlruddms5619/post/70962a4b-c976-48e6-a5f7-5eebaba011fc/image.png)

### 3) Creation of IoT Core Rule

- Select Message Routing > Rules > Create rule in AWS IoT

- Set rule name

![](https://velog.velcdn.com/images/dlruddms5619/post/98ff8c15-54e2-4ed0-8730-4501f2e88f62/image.png)

- Enter SQL statement. The format is

- SELECT FROM WHERE

- Triggered when the temperature value is 1 (specific value) or higher.

![](https://velog.velcdn.com/images/dlruddms5619/post/da224cbc-532c-4543-a47f-db808d7c726d/image.png)

- Select SNS from rule actions and select the TOPIC you created.

- Create a new role, or select a previously used role.

![](https://velog.velcdn.com/images/dlruddms5619/post/b9406d29-bdeb-453e-8924-7e73ce3e4d0c/image.png)

### 4) Test

- Since Pico is connected, if you activate the rule created in IoT Core,

- When the conditions are met, a notification is sent to the subscription you have set.

![](https://velog.velcdn.com/images/dlruddms5619/post/3ae5f0a8-2c8e-4c3a-bae3-371a5ec1201c/image.png)

---

Source: https://maker.wiznet.io/Acorn_/projects/alert-system-using-w5100s-evb-pico-and-aws-sns/
