GroveStreams Arduino - Quick Start

This tutorial walks through the creation of a user account, an
organization, and an Arduino sketch that uploads temperature
readings into GroveStreams every 20 seconds.

Two data
streams will be created: 1. A Celsius stream 2. A
Fahrenheit stream

The entire tutorial only
takes a few minutes.

The sketch provided with this
tutorial should work with most Arduino Uno boards with an Ethernet
shield and temperature probe. We used an Arduino Ethernet
w/o PoE which is an Arduino board plus the Ethernet Shield in one:

This board does
not have a USB-serial driver so we used an FTDI cable to
power the board and upload the sketch:

Step 1: Create a Free User Account and Organization

What's an Organization? An organization is a
Workspace, typically representing a home, business, or
organization. Each organization has its own set of components,
streams, dashboards, maps, and other items. An organization allows
you to control user and device access to the organization. You are
automatically the "owner" and given full access rights when you
create an organization. Other users may invite you to their
organizations with rights they give you. All of the organizations,
you "own" or are a member of, will appear in your GroveStreams
start page (the first page that appears when you sign in).

1. Enter a name for the new organization. It can be any
name. 2. Expand the Advanced section. 3. Ensure
Create with a system blueprint is selected. 4. Select
the Arduino Temperature system blueprint. This will create
your organization with commonly used items such as units. 5.
Click Create Organization.

1. Enter your new organization by clicking on its name.

Step 2: Create the Arduino Sketch

Open the Arduino
IDE (Integrated Development Environment) and create a new sketch.
Copy the below into the new sketch:

How to Copy Select all of the code below and
copy it to the clipboard (Ctrl-c). Paste the code into the Arduino
IDE sketch (Ctrl-v). Remove the first line "Data provided by
Pastebin.com - Download Raw - See Original" from the Arduino IDE
sketch.

Or

Click the Download
Raw link below, select all of the code and copy it to the
clipboard (Ctrl-c). Paste the code into the Arduino IDE sketch
(Ctrl-v).

Next you will need to edit the mac and
gsApiKey sketch variables within the Local Network Settings
and GroveStreams Settings section of the sketch:

1. Change the mac variable in your sketch. Newer
Arduino Ethernet shields have a sticker with the MAC address on the
back. Use that address. If there is no sticker, then a MAC address
that is unique to your GroveStreams organization can be generated by
clicking on the Tools button and selecting Generate
MAC Address within your GroveStreams organization's Observation
Studio.

2. Click the Arduino IDE Verify button to ensure there are no
programming errors and then click the IDE Upload button.
3. Click the Arduino IDE Serial Monitor button (The
magnifying glass in the top right corner) to view debug tracing from
the sketch.

Within your GroveStreams organization: 1. The notification
button will indicate if you have any notifications. Some
notifications report errors. Check for any notifications that may
contain any upload errors. 2. Select the Components folder.
3. Click the Refresh button. 4. Your new component
will appear under the Components folder. 5. Select a Stream
6. Your latest measurements will appear within the Quick View panel.
The Quick View panel will display No Data if no measurements
have been uploaded.

Congratulations! You have
successfully created an Arduino Ethernet sketch that uploads
measurements into GroveStreams.

Double click a
stream to explore or edit historical values. Click on the Dashboards
tab to create dashboards and maps. Right click on the Temperature
component and choose Edit Component to explore the component
model. Keep exploring and learning!

Troubleshooting

Watch for errors within the Arduino IDE Serial Monitor window.
Successful API calls to GroveStreams should return a status of:
HTTP/1.1 200 OK. An error message should appear within the Serial
Monitor window if the call fails.

If the call made
it to a GroveStreams server, but an error still occurred, a
GroveStreams system notification will be created that contains the
error. While in the GroveStreams organization's Observation Studio,
click on the Notifications button (located in the top toolbar. It
looks like an envelope) and select the System tab. Click Refresh
to list new notifications.

Ensure your development
environment can reach the GroveStreams servers. Do a command line
ping to grovestreams.com. If that is unsuccessful, then try pinging
the GroveStreams IP address directly (173.236.12.163). If you can
ping the IP address, but cannot ping grovestreams.com, then you are
experiencing a DNS lookup issue.

Any parameter that
is part of the URL needs to be URL encoded. This should only become
an issue if you have given the gsComponentName parameter, or other
parameters, a value with reserved URL characters (such as spaces or
commas). There are many free URL encoders on-line that you can use
to encode your URL or URL parameters such as
freeformatter.com.

Are you seeing more than one
component? If so, you probably changed the sketch's MAC address
after running it once. Delete the GS component that has the
incorrect ID (its ID will be the readable MAC address). Double click
the component to view its ID.

Ensure you are not
using the same API Secret Key for different organizations. API
Secret Keys are only associated with the organization they have been
created within and can only be used for that organization.

Troubleshooting Checklist

Did you remember to change the sketch's MAC address?

Did you remember to change the sketch's gsApiKey variable?

Have you checked your GS organization for any
notifications?

Is the sketch's serial monitor reporting "HTTP/1.1 200 OK"
or errors?

Does your sketch have enough RAM? The GS sketch consumes
almost 2k. You may have exceeded RAM if you've added to the
sketch. The serial monitor will not give any direct indication
that it ran out of memory. Strange things, such as the URL being
truncated, will occur.

Have you connected your Ethernet shield to a network that
has access to the world wide web?

Does your Arduino have power? Ensure the LED lights are
on.

Is the first line in your sketch "Data provided by
Pastebin.com - Download Raw - See Original"? If so, delete it. It
was automatically added by pastebin when you did a Ctrl-c and
Ctrl-v while copying the sketch.

Still can't figure out what's wrong? Delete your
GroveStreams organization, start over, and follow the instructions
carefully. Sometimes it's easier and faster to start over than to
try and figure out what step was missed or performed incorrectly.

Still having problems or you want to modify the solution and
are not sure what to do?