Introduction: Connecting Intel Edison Sensors to the Cloud
I recently received my Intel Internet of Things kit from Instructables, and while the potential for this board is astounding, it takes some time and effort to figure out. I just recently have connected my Edison to Intel's Dashboard site, but after looking around online for some time I couldn't find anything that explained how to send data from sensors through an Arduino code to the Dashboard; so, I hope this guide will be helpful to anyone else having this issue.
To be fair I'm still figuring things out as well, so there are a couple parts I could use some clarification on. If you see something that could use a bit more detail and/or you see how this guide could be improved please let me know in the comments - I'd greatly appreciate all the help I can get!
I'll also try to update this Instructable or make a new one once I figure out how to receive data from the Dashboard and use it in the Arduino code; at the moment this guide only explains how to send data to the cloud.
Step 1: Set Up Your IoT Dashboard
There are a couple of guides out there that explain this very well (and probably better than I could), so for this first part I would check out this guide by 10DotMatrix, which I found incredibly helpful in setting this part up. Once you have the basic account info configured, you're pretty much ready to start adding sensors to your Edison with Arduino.
Note: Steps 8 and on of 10DotMatrix's guide are covered in this Instructable in steps 2 and 3.
Step 2: Configure Components in the Dashboard
Once you have your device added to your account, you'll need to define in the Dashboard what sensors you're going to be using with your Edison. This is done under the Account > Catalog tab on Dashboard. There are a few there by default, but of course you'll be adding more. I'll add be adding another Pushbutton component named "button2". Click "Add Component" on the catalog page and fill in the info page that comes up (shown in my second picture). It's fairly straightforward, but here's a few things I've found so far:
--- Booleans aren't displayed on a graph as well as numbers (if at all), but you can easily use them for buttons and some other sensors - it depends on their purpose which one you choose.
--- You'll need the name of the component in the command line later, so try not to use_spaces.
--- Once or twice, upon completion of the component I got a regex error that I could not figure out; if that happens restarting the component creation process usually gets rid of it. (if someone knows why this happens please comment!)
Step 3: Registering Components on the Edison
Now to get into the Edison itself. Assuming you've registered your device, from the command line you can run
to get a list of all the components you have registered under your account. You should see the one you've just added somewhere in the list. You can also use
to see which components of the catalog are actually being used in your device. At this point the component you've just added probably isn't in the components list, so type
where is the name you used in the last step to add the component to the catalog, and is the name that comes up on the Dashboard's catalog screen. If this last part worked the new component should now show up in the device's components list.
Step 4: Arduino Code
This for me was the hardest part to figure out, but it actually isn't very difficult once you know how the Dashboard is expecting to receive your sensor data. In the Arduino code you'll be using on the Edison, you'll need the and libraries - both available from Intel here in arduino/IoTkit - as well as the Ethernet library that is included in the Arduino IDE (apparently this one is required for Edison).
Once you have the libraries set up properly, you can go ahead and write Arduino code like normal, with a few additions. Before void setup(), include
and in void setup() include
Elsewhere in the code, whenever you want to send data to the Dashboard use the format
For "component_name", the name must be exactly what you used when first setting up the component in the Dashboard (Step 2) and is case-sensitive. The value must be something that the Dashboard understands for the component, so if the Data Type is Boolean, you can only send True or False; if Number, only whole numbers; etc.
After you're finished with the code go ahead and upload it to your Edison.
Step 5: Activating the Sensors
To start sending data to the Dashboard, all that's left is to run
from Edison's command line. This will send data based on your code as often as you've programmed it to do so.
And that's it! If you get an error or something isn't working you can use
iotkit-agent observation <component_name> <value>
to send a test datum to the Dashboard to verify that you're connected properly. One issue I've had is not being able to stop the agent after it's started, however that could be because I had it transmitting at 1 Hz, which maybe doesn't give much time for the Edison to process another Terminal command. If someone knows how to get around this please comment; also the code to stop the agent is
systemctl stop iotkit-agent
If you have any other questions let me know in the comments, and thanks very much for reading!