element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Achievement Levels
    • Benefits of Membership
    • Feedback and Support
    • Members Area
    • Personal Blogs
    • What's New on element14
  • Learn
    Learn
    • eBooks
    • Learning Center
    • Learning Groups
    • STEM Academy
    • Webinars, Training and Events
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Arduino Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Project Groups
    • Raspberry Pi Projects
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Or choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Connected Cloud Challenge
  • Challenges & Projects
  • Design Challenges
  • Connected Cloud Challenge
  • More
  • Cancel
Connected Cloud Challenge
Blog Set up AWS & WICED for IoT development with Cypress PSoC 6
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Catwell
  • Date Created: 29 Jul 2020 8:58 PM Date Created
  • Views 954 views
  • Likes 3 likes
  • Comments 0 comments
  • tutorial
  • internet of things
  • aws
  • cabeatwell
  • iot
  • amazon
  • cypress
Related
Recommended

Set up AWS & WICED for IoT development with Cypress PSoC 6

Catwell
Catwell
29 Jul 2020

I attempted to connect a Cypress PSoC 6 WiFi-BT Pioneer Kit to AWS (Amazon Web Services). The process had many steps just to get some code loaded. So, I put together this guide to walk you through the setup.

In this example I wanted to send the data from the onboard accelerometer, or any sensor, to AWS.

 

Setup AWS IoT. You can make a free account at their site: https://aws.amazon.com/

 

Logon as a root user (under your already created AWS account):

Open the https://aws.amazon.com/ address:

image

 

Press «Sing in to the Console», then sign in as a «Root user»:

image

 

 

Enter your account`s name press Next, then password and log in.

You should get the following screen:

image

 

Select «Services» and then «IoT Core» on the following page:

 

image

 

The AWS Console page will appear:

image

 

Select «Manage» on the left panel then choose «Things»:

image

If you already have a thing choose «Create», if it is the first thing on the account choose «Register a thing»:

image

 

On the Creating AWS IoT things page, choose «Create a single thing»:

image

 

On the next page enter a name for your IoT thing (for example, «SENSOR»), scroll the page down and then choose Next.

image

 

On the Add a certificate for your thing page, choose «Create certificate».

image

 

 

Click «Download» links to download certificate, keys, and a root CA certificate.

 

This is the only time you can download your certificate and private key!

 

image

 

This is the only time you can download your certificate and private key!

 

Then scroll down and choose «Activate» button.

 

Then choose «Attach a policy» if you already have one.

 

image

 

If no policies are defined then choose «Secure» on the left panel, then «Policies — Create»:

image

 

Fields of the page to fill are:

image

 

Name: is a policy name.

Action: should be set to iot:*

Resource: should be set to *

Effect: Allow

 

The same policy could be set in advanced mode by copying the fragment

 

{

"Version": "2012-10-17",

"Statement": [

    {

"Effect": "Allow",

"Action": "iot:*",

"Resource": "*"

    }

  ]

}

 

 

to the text field:

image

 

Press «Create» button to create the policy.

 

Example of the SENSOR_POLICY page:

image

 

Now the created policy should be attached to the certificate of the Thing (SENSOR):

 

Choose «Secure» then «Certificates» on the left panel of AWS console:

image

 

 

Then press «...» sign at the upper right corner and select «Attach policy»:

image

 

Select «sensor_policy» created before and then «Attach».

image

 

 

Modify WICED iot-publisher project

 

You need AP with Internet access and known login credentials (Wi-Fi SSID and WPA2-PSK key).

 

Open the Device Manager and find the PSoCRegistered 6 WiFi-BT Pioneer Kit serial port (COM5 on the the picture).

 

image

 

 

Save the COM-port name to insert it into the Make Target config later.

 

Start WICED IDE and open in the Project Explorer (the left panel with folder tree) and open demo project source file /43xxx_Wi-Fi/apps/demo/aws/iot/pub_sub/publisher/publisher.c

image

 

 

 

To compile, build and upload the code you should create «Make Target» item at the right panel (Make Target panel).

Right-click on the 43xxx_Wi_Fi folder and select «New…»

 

image

 

Paste the following string to the «Target name» field of the «Create Make Target» window:

 

demo.aws.iot.pub_sub.publisher-CY8CKIT_062 download_apps download UART=COMXX VERBOSE=1 run

 

where COMXX is a COM name in the Device Manager.

 

image

 

 

Do not change other controls and click OK.

Double-click the appeared item and look for the console output for the strings:

 

Downloading Application ...

Download complete

Resetting target

Build complete

xx:xx:xx Build Finished (took Xm:Xxs.XXXms)

 

Wi-Fi credentials to change are stored in

 

/43xxx_Wi-Fi/apps/demo/aws/iot/pub_sub/publisher/wifi_config_dct.h

 

path. Double-click this file in the WICED Project Explorer (the left panel) to open it.

If your Wi-Fi net is a WPA2-PSK protected infrastructure type you should change the following lines:

 

            #define CLIENT_AP_SSID "AWS_IOT_PUB_AP"

            #define CLIENT_AP_PASSPHRASE "YOUR_AP_PASSPHRASE"

            #define CLIENT_AP_CHANNEL    1

 

Replace AWS_IOT_PUB_AP by your wireless Access Point SSID, YOUR_AP_PASSPHRASE by your WPA2-PSK key, 1 by the real Wi-Fi channel number. Leave quotes intact and save the file (Ctrl-S or File-Save).

 

You need to add your AWS key and certificates required to connect to the directories of the WICED IDE project tree.

 

WICED IDE directories which should contain AWS keys and certificate

 

 

            /43xxx_Wi-Fi/resources/apps/aws/iot/

 

This directory should contain certificate file of the Certificate Authority, named «rootca.cer».

 

            /43xxx_Wi-Fi/resources/apps/aws/iot/publisher/

 

This directory should contain client certificate and private key files named «client.cer» and «privkey.cer» respectively.

 

You should rename your AWS IoT certificates and key to replace dummy files already located in that directories.

 

Now replace «publisher.c» with the modified one (an additional publisher.c file).

 

For monitoring and debugging you can connect to the COMXX with any serial port monitor.

Install Putty (https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.74-installer.msi) run it and select Serial port with 115200 speed and COMXX as the port name:

 

image

 


Press the open button to connect to the COMXX port, you should see a black console window with diagnostic lines.

 

Now rebuild and reflash the board by double-click on the created «Make Target» item on «Make Target» panel.

 

Typical lines displayed in the COM port monitor (Putty) should be:

 

Starting WICED Wiced_006.004.000.0061

Platform CY8CKIT_062 initialised Rev: 0x23

Started ThreadX v5.8

WICED_core Initialized

Initialising NetX_Duo v5.10_sp3

Creating Packet pools

WLAN MAC Address : XX:XX:XX:XX:XX:XX

WLAN Firmware    : wl0: May 2 2019 02:39:20 version 7.45.98.83 (r714225 CY) FWID 01-476cc09d

WLAN CLM         : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2019-05-02 02:29:53

Joining : SSIDNAME

Successfully joined : SSIDNAME

Obtaining IPv4 address via DHCP

L1420 : dhcp_client_init() : DHCP CLIENT hostname = [WICED IP]

IPv4 network ready IP: XX.XX.XX.XX

Setting IPv6 link-local address

IPv6 network ready IP: XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX

[Application/AWS] Opening connection...

[Application/AWS] Try Connecting...

[AWS] AWS endpoint: a38td4ke8seeky-ats.iot.us-east-1.amazonaws.com is at 35.170.136.36

[AWS/MQTT] Event received 1

[Application/AWS] Connection Acknowledgment Received

[Application/AWS] Connection Successful...

[AWS/MQTT] Event received 3

[Application/AWS] Publish Acknowledgment Received

[Application/AWS] Publishing... sens1: 0.690

 

You can open AWS IoT console monitor to view received messages.

 

Go to the AWS IoT console, select «Test» item:

 

image

 

Then enter # in the «Subscription topic» field and click «Subscribe to topic»:

 

image

 

 

Now you can monitor your messages received by the AWS IoT console client:

 

image

 

This tutorial and others here at element14 should get your started in the world of AWS and Cypress.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube