Quick Start: Arduino

In this guide, you will learn how to quickly get started with the aREST cloud platform & Arduino boards. This guide assumes that you already created an aREST account, so if this is not done yet, you can create a free account here. The guide was made with an Arduino MKR1010 board, but it should work with most of the Arduino boards on the market that can connect to WiFi.

#1: Getting your aREST API Key 

The first step is to get your aREST API key. This is really simple to do as you just need to login in your aREST dashboard:

https://dashboard.arest.io/login 

Then, simply click on the API Key tab or follow this link:

https://dashboard.arest.io/api_keys

Your API key should be displayed on this page. You'll need it for later, so either save it somewhere or leave the tab open.

#2: Installing & setting up the Arduino IDE

The next step is to setup your Arduino IDE that we will use to configure our Arduino board. If it is not done yet, install the Arduino IDE from: 

https://www.arduino.cc/en/software 

Once it is installed, you will need to install the MKR board from within the Arduino IDE. Here are the instructions to follow in order to do that:

  • Open the Boards Manager from Tools > Boards menu and install the Arduino SAMD boards
  • Select the correct Arduino board from Tools > Boards

Once this is done, you can install the required libraries for aREST. There are two of them to install: aREST, and PubSubClient. You can install them both using the Arduino Library Manager by going to Sketch > Include Library > Manage Libraries.

Note that you might also need additional libraries & boards definitions depending on the Arduino board you are using. For example, to use aREST with the MKR10xx Arduino boards, you need to install the WiFi101 library as well as the SAMD boards definitions. To learn more, refer to the documentation of your Arduino board.

#3: Configuring your Arduino board  

It's now time to configure your Arduino board! The easiest way is to load the pre-made sketch from the aREST library called MKR1000_cloud_api_key. You can load it from File > Example > aREST.

Once you have it open, there are two things you need to change: your API key, and your WiFi credentials. Here is how it looks like inside the code:

// aREST API key (that you can get at dashboard.arest.io)
char * key = 'your_arest_key';
// WiFi parameters
const char* ssid = 'your_wifi_network_name';
const char* password = 'your_wifi_network_password';

Make sure to change both of those, and save the example file into a new file. 

You can now upload the code to your board! For that, make sure to select the correct board inside the Arduino IDE, the correct serial port, and hit the upload button.

#4: Checking Your Cloud Dashboard

We now have to check that the device is actually connecting to your aREST account. For that, go to:

https://dashboard.arest.io/devices

You should see a new device with the online status:


If this is not the case, make sure to check that you correctly set your API key & your WiFi credentials.

Congratulations, you now have a device connected to your aREST dashboard! You can now use it to control your projects from anywhere in the world.