For this project, you simply need the Arduino IDE, the CC3000 library, and the Sensirion library. Make sure that the libraries are correctly placed in your /libraries folder inside your main Arduino folder.

The code for this project can be found on the GitHub repository for the project.
Now everything is set so that you can send data over to the Carriots cloud service. We have to write the sketch that will be uploaded to the Arduino Uno board. Because the Carriots service uses a REST API, the sketch will actually be quite similar to what was done in the Arduino & Xively project: establishing a connection to the Carriots server, measuring some data from the sensor, and then formatting & sending the data as a JSON object.

I won't detail everything here, you can have a look at the Arduino & Xively project for more details, and of course you can find all the code on our GitHub repository for this project. The first difference with other cloud services is that you need to set your API key in the sketch, but also the device you want to send data to:
#define WEBSITE  ""
#define API_KEY "yourAPIkey"
#define DEVICE  "yourDeviceName@yourUserName"
In the loop() part of the sketch, you need to format the data measured by the Arduino according the Carriots guidelines. For example, data sent by our sketch should have the following form:
Then, at the end of each loop, this data is sent along with an HTTP header. We then read the answer back from the server, and you can check it out on the serial monitor. If the server accepts the data, you should see an "OK" message printed out. Finally, the connection is closed and we wait for 10 seconds before the next measurement.

You can get the whole Arduino sketch from the GitHub repository, modify the required parts like your WiFi SSID & password and your Carriots account data, and finally upload the code to your Arduino board. You can now open the serial monitor and check if the Arduino is sending data to the Carriots server:

This guide was first published on Jan 10, 2014. It was last updated on Jan 10, 2014.

This page (Arduino sketch) was last updated on Jan 07, 2014.

Text editor powered by tinymce.