SigFox to AWS

by zakaevier in Circuits > Software

2885 Views, 3 Favorites, 0 Comments

SigFox to AWS

20170420_170104 (1).jpg
SigFox Network.jpg
Amazon-DynamoDB-1438723482.png
SigFox Setup.jpg

I.INTRODUCTION

1.The Author

My Name is Hooi Yong Hua and i am from Singapore Polytechnic , Diploma of Computer Engineering .

I am part of a group that consists of 3 members ; Low Jun Qian , Takuma kabeta and myself .

This instructable is part of a project to send data from sensors over the internet to a end device and conduct

business analytics. Our Project supervisor is Mr Teo Shin Jen.


2. Objective

Send analogue data from a sensor(DS18B20 ) using a Arduino with Sigfox Shield over the internet to sigfox servers then push the data to AWS (Amazon Web Services Cloud) and store it in AWS Dynamo DataBase ( DynamoDB )

3. Purpose

To simplify the instructions for testing Sensor to Arduino to Sigfox to AWS data transfer and collate all information in one place . For more details , especially about sigfox to AWSIot Connectivity , it is highly recommended to check out the original article by AWS https://aws.amazon.com/blogs/iot/connect-your-dev...

3. Required Skills :

1. Familiar With Arduino IDE , including adding Library and uploading code to arduino board . 2. Basic knowledge of Amazon Web Service , Especially Creating Stack , DynamoDB and Creating Rules .

3. Have already activated Sigfox Subscription and able to send messages ( Data ) from Sigfox Device to SigFox Cloud

II. Set - Up

A.Hardware

1. Arduino Uno x1

2. Sigfox Arduino Shield : UnaShield_RC1692HP-SIG ( Version 1A ) x1

3. Radio Antannae x1


4. USB B to A Cable ( to connect Arduino to PC ) x1

5. Sensor Set-up ( BreadBoard , Temp Sensor DS18B20 , 3x Male to Male Connectors ; 1 voltage [red] 1 Ground [Black] 1 Data [White] )

B.Software

1. Arduino IDE ( Version 1.8.1 was used in this tutorial )

2. Arduino Library calledUnabiz Arduino Master Library with Send - Light - Level Example Installed

C.Account ( Online ) & Subscriptions

1. Sigfox Server Subscription ( Comes with Sigfox Devices )

2. Amazon AWS Account with access to cloudformation ( Stack Creation ) & DynamoDB

IV References :

https://aws.amazon.com/blogs/iot/connect-your-dev....

Arduino Set Up

Arduino Unabiz Check With LEGEND.png
Arduino_Sigfox_Change_deviceid.png

A. The first step is to upload the example sketch send light level to the arduino .

To do so open the arduino IDE , click on the following words in order : File > Example > unabiz-arduino-master ( under subsection Custom Libraries ) > send-light-level . Refer to Figure 5 If any of the aforementioned words that are to be clicked are missing , reinstall the unabiz arduino master library ( Steps in Appendix 1 ) . Repeat step 1 .

B.Change the deviceid to your sigfox device .

The line of code to be changed is ( shown in Picture )

static const String device = "xxxxx"; // Set this to your device name if you're using UnaBiz Emulator.

C. Verify and Upload code to Arduino Sigfox Device .

( Remember to select the correct board ( in this case arduino uno ) and Serial Port )

Arduino Serial Monitor

Captureyong.PNG

At the Arduino IDE , select tools followed by Serial Monitor . It should display Message.addfield and Radiocrafts.sendmessage : . The Radiocrafts.sendmessage : is followed by the sigfox deviceid

Login to Sigfox

1.Sigfox Backend Login  P4 .png

1 . Login at https://backend.sigfox.com/auth/login

Sigfox Device Page

2.SigFox Device Tab - Modded (2).png

2. Click at the Device Tab . Secondly , Check the last seen colum ( C ) to make sure sigfox is still actively transmitting data.

If after around 15-20 minutes the Discrepancy between the current time and time shown there has not decreased , there might be a problem with the sigfox .

Then click on the Sigfox Device in use under the Device Type Column (B) .

You will be brought to the Device Type Section

Sigfox Callback

3. SigFox Device Type Tab_Censored.png

Select Callback from the purple left pane ( Circled in Red )

Sigfox New Callback

4. SigFox New CallBack.png

Click the word New on the top right hand corner below the logout button ( Circled in red ) .

Sigfox Create Callback Type

5.SigFox Callback AWS Iot.png

5 . Select AWS IOT from the list of callbacks Type available . ( Its the second position ) . You will be brought to the next page

Sigfox to AWS CloudFormation

6.SigFox CallBack Configuration menu.png

Select the Launch Stack Button ( A ) .

You will be redirected to the AWS CloudFormation Create Stack Page , ( Create a Template ) subsection .

( If you have not logged in to aws prior to this you will have to do it now )

Take Note of External ID (B ) as it will be used later

The Region(C) for singapore is ap-southeast-1 Refer to https://docs.aws.amazon.com/general/latest/gr/ran... for other regions.

AWS Stack Creation 1

9A.  SigFox to AWS CloudStack Create 2nd Page.png

Make Sure the button beside " Specift an Amazon S3 template url (A) .

Select the word NEXT in the bottom right corner (B).

you will be brought to the next page ( Specify Detail Subsection )

AWS Stack Creation 2

15. SigFox AWS Specift Details_Revised_1.png

In this page (Specify Details ) you have to fill out 5 boxes , namely Stack Name , AWSAcountID , ExternalID , Region and TopicName .

Detailed instructions are found below . Click Next after you are done ( at bottom right corner ) .

Firstly for Stackname use SigFoxIotConnector .

Secondly for External ID , Use the Information taken note of in Step 6 External ID , Use the Information taken note of in Step 6

Thirdly for Region , Use Ap-Southeast-1 ( For Singapore ) or refer to this link : https://docs.aws.amazon.com/general/latest/gr/ran...

Fourthly for TopicName use sigfox .

Lastly for AWS Account ID it will be discussed in the next step

AWS Account Number Location

p15.png

open AWS Console in a seperate page by clicking this link : https://ap-southeast-1.console.aws.amazon.com/con... ( or by any other means )

Click the support button located at the top right hand corner causing the menu will drop down

Then click the support center located in the drop down menu.

AWS Account Number Location

10. AWS AccountID Part 2.png

This will bring you to the support center page , which shows the accountID at the Top right hand corner , below the support button.

Transplant the number ( AWS Account Number) to AWS AccountID in Step 9 and click Next located at the bottom right corner in that page .

AWS Stack Creation

9. This page ( Options ) is not necessary for this tutorial . click next at the bottom right corner takes you to the Review Page

AWS Stack Creation Final

11. SigFox AWS CloudStack  Review.png

At the Review Page , check that all information input is accurate , and under the subsection capabilities check the box beside

the sentence " I acknowledge that AWS CloudFormation might create IAM resources. "

Finally press the create button ( Bottom Right Corner of Screen ) to create the stack .

You will return to the Cloud Formation Management Console .

AWS Stack Details

p18.png

t the Cloudformation management console , the newly created stack should show CREATE_COMPLETE in the status column after 2-10 minutes

Click the stack name to view details about it .

AWS Stack Details 2

15aSIGFOX AWS CloudStack Details.png

Locate the Output Section and click the arrow preceding it .

Copy the ARN Role's Value Column and check to make sure the other values are correct .

Sigfox Callback Creation Final

P20.png
16. SIGFOX AWS Callback FInish Revised.png

Switch Back to the SigFox Website's Callback Setup ( Step 7 ; From Where llaunch stack button is located) and fill up all the remaining boxes except custom payload config .

Copy the Aforementioned ARN Role to this one .

For the Json Body , Copy and paste the code below.

After all that is done Select OK . The next page shows the callback connections for the selected sigfox device

Sigfox Callback Creation Check

Device Type Callback.png

Make Sure there are no errors and the [POST] link under the information section is similar to the image.

AWS-Creating DynamoDB Table

p22.png
1B.  AWS Tab Dynamo.png

Select DynamDB in the amazon menu then click create table

AWS- Creating DynamoDB Table 2

p23.png

Fill all the blank boxes .

For Table Name , put sigfox ; For Partition key , put deviceid , followed by checking the sort key box and put timestamp .

click create to finish ( do not touch any unmentioned settings ) . Wait for awhile for the table to be fully generated .

Accessing AWSIot Console

3a. Selecting AWS IOT.png
3b. Rule Creation 1.png

Open the AWS Console , choose AWS Iot , select Rule and then select create Rule

AWS DynamoDB Creating Rule

4. Rule Creation 2.png
5. Rule Creation 3.png

4. Assign the Name Sigfox , * to attributes and lastly put sigofox at the topic filter .

AWS DynamoDB Adding a Action

6. Rule Creation -Adding Action.png
7. Rule Creation - Adding Action 2.png

Next you need to create the action . Select Add Action and in turn choose " insert a message into DynamoDB " .

AWS DynamoDB Adding a Action 2

8. Table Creation ErroFix.png

Use the same name ( sigfox ) to fill in the Table Name .

The Hash and rain key should automatically generate itself .

Fill in Hash Key Value with ${device} and RangeKeyData Value with ${ timestamp()}under the write message .

Lastly , Fill in the box labeled " Write message data to this column " with payload ( Not circled )

Pic is shown below

AWS DynamoDB Role Creation

8. Table Creation ErroFix.png

Next is to create a new role . under the IAM role name , enter dynamodbsigfox , click create role then click add action

AWS DynamoDB Role Creation End

9. DynamoDB Create Rule Button.png

Finally click Create Rule to wrap things up . ( add the bottom right corner )

10. Final Step DynamoDB.png

Now go back to DynamoDB Table and see the table being filled up

Note : If nothing displays on the table , 1 potential problem might be that the AWS console is in the wrong region make sure the region the aws console is located in is the same as the region indicated in the Stack Creation