Skip to content

Commit 21e0c76

Browse files
author
Yosuke Matsuda
committed
Updated README.md.
1 parent 60a44dd commit 21e0c76

File tree

1 file changed

+123
-3
lines changed

1 file changed

+123
-3
lines changed

README.md

Lines changed: 123 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,130 @@
22

33
An experimental SDK for contacting AWS Services on Arduino-compatible devices. Currently with DynamoDB support and potential Kinesis support.
44

5-
See samples for Spark Core and Intel Galileo to get started.
6-
75
All DynamoDB operations are supported. The code for creating, serializing, and deserializing Kinesis input and output objects is included, but the devices that the experimental SDK has been tested on do not have readily available HTTPS support. This code has been included so it can be used by those who want to do further experimenting with Kinesis and HTTPS.
86

9-
The SDK is extensible to non-Arduino-compatible devices by implementing the interfaces in `DeviceIndependentInterfaces.cpp`/`.h`. See `SparkAWSImplementations.cpp`/`.h` and `GalileoAWSImplementations.cpp`/`.h for examples of this.
7+
The SDK is extensible to non-Arduino-compatible devices by implementing the interfaces in `DeviceIndependentInterfaces.cpp`/`.h`. See `SparkAWSImplementations.cpp`/`.h` and `GalileoAWSImplementations.cpp`/`.h` for examples of this.
108

119
Happy experimenting!
10+
11+
## Getting Started with the Samples
12+
13+
Trying the samples is a good way to get started with using the SDK.
14+
15+
Getting the samples working has the following steps: setting up the DynamoDB table, importing the SDK and copying over the sample, creating the `keys.h` and `keys.cpp` files, and setting up the hardware. These steps are outlined for the samples for both the Spark core and Intel Galileo, so be sure you are following only the directions corresponding to the device and sample you are using.
16+
17+
If you are using a device other than Spark or Galileo, you may want to read through these steps anyway before implementing the interfaces in `DeviceIndependentInterfaces.cpp`/`.h` for your device.
18+
19+
### Step 1: Setting up the DynamoDB Table
20+
21+
For either device you will need to set up a DynamoDB table with the same name, hash key, and range key as in the sample you are using. These values are defined as constants in the sample, i.e. `HASH_KEY_NAME` and `TABLE_NAME`.
22+
23+
You can follow the steps below to get the tables set up with the right values, chosing the right set of instructions based on which sample you are using.
24+
25+
#### Table used by SparkGetItemSample and GalileoSample:
26+
27+
* Log into the [AWS Console](http://console.aws.amazon.com/) and navigate to DynamoDB.
28+
* Click on the "Create Table" button.
29+
* Enter "AWSArduinoSDKDemo" as the *Table Name*, "DemoName" as the *Hash Attribute Name*, and "id" as the *Range Attribute Name*. Be sure to mark *DemoName* as *String* and *id* as *Number*.
30+
* For this example, we won't add indexes, so just press continue on the *Add Indexes (optional)* page.
31+
* Just one *Read Capacity Unit* and one *Write Capacity Unit* will be enough for this demo. Press continue with these values.
32+
* Uncheck *Use Basic Alarms* and continue again.
33+
* Check that the information is correct on the *Review* page, then create the table!
34+
* After the table has finished creating, double click on it to explore it. Here you should press the *New Item* button and create an item with the following values:
35+
* "DemoName": *String*, "Colors"
36+
* "id": *Number*, "1"
37+
* "R", *Number* "255"
38+
* "G", *Number* "255"
39+
* "B", *Number* "255"
40+
41+
#### Table used by SparkPutItemSample:
42+
43+
* Log into the [AWS Console](http://console.aws.amazon.com/) and navigate to DynamoDB.
44+
* Click on the "Create Table" button.
45+
* Enter "AWSArduinoSDKTests" as the *Table Name*, "device" as the *Hash Attribute Name*, and "Time" as the *Range Attribute Name*. Be sure to mark both as *String*.
46+
* For this example, we won't add indexes, so just press continue on the *Add Indexes (optional)* page.
47+
* Just one *Read Capacity Unit* and one *Write Capacity Unit* will be enough for this demo. Press continue with these values.
48+
* Uncheck *Use Basic Alarms* and continue again.
49+
* Check that the information is correct on the *Review* page, then create the table!
50+
51+
### Step 2: Importing SDK and Copying Sample
52+
53+
This step is different for the Spark Core and Intel Galileo.
54+
55+
#### Intel Galileo
56+
57+
With Galileo you should be using the Arduino IDE for Galileo available [here](https://communities.intel.com/docs/DOC-22226).
58+
59+
Make an `AWSArduinoSDK` directory in the Arduino IDE's `libraries` directory (e.g. `~/Arduino/libraries/AWSArduinoSDK`).
60+
61+
Move all of the files from the SDK's `src/` directory into the `AWSArduinoSDK` directory, except the `SparkAWSImplementations` and `AmazonKinesisClient` files.
62+
63+
Create a new sketch with the Arduino IDE and copy and paste the sample code into it.
64+
65+
66+
#### Spark Core
67+
68+
This assumes you already have your Spark set up and are able to program it with Spark Build. If you do not, head over to [Spark's website](http://docs.spark.io/).
69+
70+
Open up the Spark Build web page and create a new app. Name it whatever you would like.
71+
72+
Copy the contents of the sample you are using into the `.ino` file of your new app.
73+
74+
Next you need to import the SDK. Because the Spark Build IDE isn't local to your machine, you can't just `cp` the files over. Instead use the "+" tab in the top right corner of the Spark Build page to create a new file for each `.cpp`/`.h` file in the `src/` directory, except `GalileoAWSImplementations` and `AmazonKinesisClient`. Then copy and paste the contents of each file.
75+
76+
### Step 3: Creating `keys.h` and `keys.cpp`
77+
78+
You will need to create and add `keys.h` and `keys.cpp` into the `AWSArduinoSDK` directory you made. These files define the `awsKeyID` and `awsSecKey` values used by the sketch, the files may be structured as following:
79+
80+
```
81+
// keys.h
82+
#ifndef KEYS_H_
83+
#define KEYS_H_
84+
85+
extern const char* awsKeyID; // Declare these variables to
86+
extern const char* awsSecKey; // be accessible by the sketch
87+
88+
#endif
89+
```
90+
91+
```
92+
// keys.cpp
93+
#include "keys.h"
94+
95+
const char* awsKeyID = "YOUR AWS KEY ID HERE";
96+
const char* awsSecKey = "YOUR AWS SECRET KEY HERE";
97+
```
98+
99+
Add these files as you added the source files. That is: with Spark, use the "+" button, and with Galileo, move them to the `AWSArduinoSDK` directory under Arduino's `libraries` directory.
100+
101+
### Step 4: Setting up Hardware
102+
103+
To use the samples you must have the correct breadboard wiring. The samples use different wiring, but use the following rules to create them:
104+
105+
Buttons: Connect buttons by wiring one leg of the button to the 3v or 5v pin. Connect one leg to ground with a resistor, and also wire it to the pin that is reading the value.
106+
107+
RGB LED: For the multicolored LED, wire the cathode (the longest leg) to ground, then connect the remaining 3 legs to the corresponding input pins with a resistor.
108+
109+
#### Spark Core
110+
111+
Both spark samples use just one button connected to the D2 pin.
112+
113+
#### Intel Galileo
114+
115+
This sample uses five buttons and a RGB LED.
116+
117+
The RGB LED has the red leg connected to pin 6, the green leg connected to pin 9, and the blue leg connected to pin 10.
118+
119+
Buttons:
120+
121+
* Button for performing PutItem should be connected to pin 2
122+
* Button for performing GetItem should be connected to pin 4
123+
* Button for changing red color value should be connected to pin 7
124+
* Button for changing green color value should be connected to pin 8
125+
* Button for changing blue color value should be connected to pin 12
126+
127+
For Galileo, after the wiring is finished, you should be able to connect it to power, connect it to your computer via usb, and compile and upload the code with the Arduino IDE. Be sure to refer to the comments in the samples for help.
128+
129+
For Spark, after the wiring is finished, you should be able to connect it to your computer via USB, and *Flash* the code. Be sure to refer to the comments in the samples for help.
130+
131+

0 commit comments

Comments
 (0)