- 0. Introduction
- 1. Carriots Project and Device Registration
- 2. Data Transferred from Arduino to Carriots
- 3. Code implemented on Arduino to test the library
- 4. Checking Data is Collected in Carriots
- 5. From here on: Enhancing the project
This easy tutorial familiarizes you with the Carriots send stream library
Using this library you can send lists of key-value pairs to Carriots by simply calling a predetermined method
In this tutorial you will learn how to:
- Structure the data you want to send to be compatible with the Carriots library
- Send the data to Carriots using the send stream method
- 1 x Arduino Uno
- 1 x Ethernet Shield. You can also use a WiFi or GRPS Shield
Music to listen: Lauryn Hill - Everything is Everything
If youre registered in Carriots, you have a default device already created for you.
Check your control panel and see what it looks like.
Basically you need the device id_developer that might be something like defaultDevice@myusername.
But if you want, you can create a new device and use it in this example.
Now, go to your control panel “My account menu” and check your Apikey.
Its a big alphanumeric token like:
You need this number to complete the example.
Arduino libraries allow the sketches to have extra funcionality. Arduino has many libraries that are already established and come with the IDE. However, it's also possible to write your own libraries or use libraries written by others. Each library has a header file which describes each method and a source file, which elaborates the code. To read more about Arduino libraries or writing a library see Arduino-Libraries
In this tutorial we will use a library created to send streams to Carriots.
To use the library, first download it here. Once you have downloaded the library you must decompress it and then copy it into the arduino/libraries file. Now you should be able to use the library in any sketch you create.
The method used to send streams to Carriots is the method "send". It has 4 parameters that you need to define in order to send a stream correctly.
The first parameter is a two-dimensional array. The number of rows of this array is up to you, but the number of columns must be two (one column for the key, one column for the value).
The second parameter is the number of rows or elements that the array has. You can find this number by dividing sizeof(array) / sizeof(array).
The third parameter is your Apikey which you need to identify your Carriots account.
The fourth parameter is your device id_developer which specifies which of your registered devices you are using.
This is the Arduino code to test the send method. Note that some values should be replaced by your own values.
If you get here, your device must be sending streams to Carriots
Its time to test our control panel and check if we have new streams.
Go to “Data management” → “Data streams” and you will see your data.
- menu option
- new data
Now you know how to use the Carriots library with an Arduino device to send data to Carriots. But you can enhance this project in many ways:
- Try to send dynamic data using the Carriots library