Skip to content

Latest commit

 

History

History
146 lines (108 loc) · 10.3 KB

10_AWS_QuickstartGuide.md

File metadata and controls

146 lines (108 loc) · 10.3 KB

Getting Started Guide for AWS IoT Core


SourceCode: InfluxDB to AWS


Before you start this tutorial, it helps to get familiar with Getting started with AWS IoT Core

Overview

The Phoenix Contact EPC 1502 and EPC 1522 devices combine the robustness of a proven industrial PC with the openness of the PLCnext Technology ecosystem. The EPCs connect the OT and IT world like no conventional PLC. On one hand, the EPC is a full-featured PLCnext PLC, can collect data through a variety of protocols, and perform automation tasks. On the other hand, pre-installed open-source software like Node-RED, the InfluxDB database, and a simple Docker container implementation make building IoT applications easier than ever.

The EPC product line offers multiple benefits compared to a traditional PLC. This includes integrated additional edge software packages, easy update during operation, over-the-air update without any data loss after a firmware update, qualified and configured open-source packages, and usability and security capabilities with focus on extensibility to program your IoT application! Simple connection to AWS IoT allows data to be collected, stored, and processed.

With AWS, data can be easily managed in the cloud.

Hardware Description

Datasheet

A datasheet can be found on the official Phoenix Contact homepage:
Link to EPC 15x2 datasheet
The datasheet is valid for both devices.

Set up your Development Environment

Your EPC 15x2 comes with all the software you need pre-installed. If you want to use PLCnext Engineer (IEC61131 OT side programming), you must install PLCnext Engineer on your development-PC (Windows 10 required) PLCnext Engineer can be installed here

Node-RED and InfluxDB are pre-installed. Local processed data will be sent into AWS via Node-RED.

Set up your hardware

Choose the desired mounting method and follow the appropriate procedure.

Wall mount

Order No. 1147655
The EPC 15x2 can be attached to a flat surface in a wall-mount orientation using the four key holes. The mounting surface must be flat and not subject to vibration.

NOTE: The EPC 15x2 must be installed with the connectors oriented down to allow the convection cooling to function efficiently

Installation:

  1. Attach the two brackets to the EPC... using the included M3x5 screws. Torque the screws to 0.5 Nm.
  2. Use the EPC 15x2 as a template and mark the locations of the mounting holes on the mounting surface.
  3. Use the correct anchor type for the mounting surface and securely attach the EPC 15x2 to the wall. Ensure the attaching hardware is in the small section of the mounting holes.
    EPC_Wall_Mount

DIN rail mount

Order No. 1147464

  1. Install the mounting bracket on the EPC... with the included M3x5 screws so the connectors will be oriented downward after installation. Torque the screws to 0.5 Nm
  2. Angle the EPC 15x2 so the top edge of the mounting plate hangs on the top edge of the DIN rail.
  3. Rotate the EPC 15x2 down against the lower edge of the DIN rail. Press in until the latch snaps closed.
  4. Secure the device on the rail with clamps.
  5. If necessary to remove, release the latch using a screwdriver, rotate the bottom of the EPC away, and then lift it straight up off the DIN rail
    EPC_DinRail

Connecting the power supply

A removable plug (Order No. 1847055 on the EPC 15x2 accepts wire sizes of 0.2 ... 2.5 mm² (12 ... 24 AWG).

NOTE: To ensure safe operation, use safety extra-low voltage (SELV) according to DIN EN 61131 as supply voltage. This device is protection class I item of equipment.

  1. Connect the power conductors to the appropriate terminal in the connector.
  2. Connect the ground/earth to the screw (5).
  3. Insert the connector into the IPC.
    EPC_PS

Setup your AWS account and Permissions

Refer to the instructions at Set up your AWS Account. Follow the steps outlined in these sections to create your account and a user and get started: • Sign up for an AWS account and • Create a user and grant permissions. • Open the AWS IoT console Pay special attention to the Notes.

Create Resources in AWS IoT

Refer to the instructions at Create AWS IoT Resources. Follow the steps outlined in these sections to provision resources for your device: • Create an AWS IoT Policy • Create a thing object Pay special attention to the Notes.

The certificates and key you downloaded will be used in subsequent steps. Rename the certificate to DemoThing.cert.pem and the key to DemoThing.private.key.

Provision the Device with credentials

  1. Login from your development-PC to your EPC using any SFTP Transfer-Tool. In this example the tool "WinSCP" was used. WinSCP can be downloaded here.
  2. Create a new folder on your EPC under /opt/plcnext/apps and copy all the certificates downloaded when you created the AWS Things corresponding to your device.
    AWS-CertFolder

Demo Application

Following tasks shall be performed for interfacing with Amazon’s AWS cloud:

AWS-ExampleDesc

• Integrate custom output nodes for AWS-IoT from the open-source node repository to provide cloud connectivity with AWS.

• Create and validate flow to publish telemetry data from Time Series Database to AWS cloud endpoint, using the custom nodes that send data to AWS IoT Subscription.

• Create and validate flow to write data from Amazon AWS Cloud endpoint to OPCUA server, using the publishing nodes.

• Create and validate flow to write data from Amazon AWS Cloud endpoint to Modbus RTU Slave, using the publishing nodes.

  1. Create a similar flow as shown below:
    AWS_Sub
  2. Edit the AWS MQTT nodes.
    Those nodes will be pre-installed on your Node-RED of your EPC 15x2.
    AWS_MQTT
  3. Click on edit icon against Device.
    AWS_Edit
  4. Enter Name for the node, type as MQTT broker, AWS Thing name as Client ID. To find the Endpoint, navigate to the AWS IoT console and choose Settings in the navigation pane on the left - the endpoint can be found under Device Data Endpoint. Also enter the location where the certificates have been copied in the AWS Certs field.
    AWS_Edit2
  5. Navigate back to AWS Console, in the left menu, choose Test and choose MQTT test client.
    AWS_Test
  6. Continuing with the getting started example, on the Subscribe to a topic tab, in the Topic filter field, enter #, and then choose Subscribe.
    AWS_Sub
  7. The topic message log page, # opens and # appears in the Subscriptions list.
    AWS_Sub2 If the device that you configured in Configure your device is running the example program, you should see the messages it sends to AWS IoT in the # message log. The message log entries will appear below the Publish section when messages with the subscribed topic are received by AWS IoT.
    On the # message log page, you can also publish messages to a topic, but you'll need to specify the topic name. You cannot publish to the # topic.
    Messages published to subscribed topics appear in the message log as they are received, with the most recent message first.

Troubleshooting

The following information might help you troubleshoot common issues in AWS IoT: Link to Troubleshooting AWS IoT.

Also, feel free to ask your question in our PLCnext Forum.