My image

Control Your ESP8266 Projects From Anywhere With aREST

Last Update: Mon, May 22 2023

In this tutorial, you will learn how to use the ESP8266 WiFi chip along with aREST, in order to control your projects from anywhere in the world.

In this article, we are going to use several of those features, including the auto-registration of devices and the device manager inside the aREST dashboard. As an example, we’ll simply learn how to control an LED from anywhere in the world from the aREST dashboard. Let’s start!

Hardware & Software Requirements

You will need an ESP8266 board, like the Adafruit ESP8266 Feather board that I used for this tutorial. You will also need one LED, one 220 Ohm resistor, a breadboard, and some jumper wires.

On the software side, you will need the latest version of the Arduino IDE (> 1.6.11):

http://arduino.cc/en/main/software

You will need to get & install the aREST Arduino library and the PubSub library. You can install those libraries using the Arduino library manager. You will also need to install the ESP8266 boards definitions for Arduino. You can find the procedure at the following link:

https://github.com/esp8266/Arduino

Hardware Configuration

Simply place the ESP8266 board on your breadboard, and then connect it to your computer with an USB cable.

For the LED, simply connect it in series with the resistor, with the longest pin of the LED connected to the resistor. Then, connect the remaining pin of the resistor to pin 5 of the ESP8266 board, and the remaining pin of the LED to the GND pin.

Creating an aREST Account

The next step is to create an aREST account, and then select a Pro plan. For that, go over to:

https://arest.io/pricing

There, go into the Account tab. You should see a link that will allow you to select an aREST Pro plan. If you just want to try it out, you can select the Starter plan which is free. After your aREST Pro account has been activated, you should now see your aREST Pro key inside the account page.

Copy this key, you will need to insert it in a moment inside the code that we will use to configure the ESP8266 WiFi chip.

Configuring the Device

In order to configure the device, you can simply use the default sketch that you will find inside the aREST repository, called ESP8266_cloud. Inside this sketch, there are only two things you need to modify. The first thing is the WiFi name and password of your WiFi router:

const char* ssid = 'your_wifi_name';const char* password = 'your_wifi_pass';

Then, simply insert your aREST Pro key inside the key variable:

char * key = 'your_key';

After that, configure the board with the code using the Arduino IDE. Note that if you have more boards to configure, you can just use the same sketch: the boards will all self-register on the aREST server, which is a pretty cool feature of aREST compared to not using an API key.

Managing & Controlling Your Devices from the Dashboard

Let’s now see how manage and control our device from the cloud. For that, we are going to use the aREST dashboard again:

https://dashboard.arest.io/

You might have noticed that compared to before (without activating aREST Pro), there is now an extra tab inside your dashboard, called Devices. Click on this link to go to the aREST device manager, only accessible for Pro users. Inside this page, you will see all your devices listed, along with some information about those devices.

Right now, you should see your device that is online inside the device manager. Then, go to the Dashboards tab, and create a  new dashboard. Inside this dashboard, create a new element with the following parameters.

Of course, make sure to select your device from the list that is available inside the element builder. This is also a feature exclusive to aREST Pro: you don’t need to enter manually the ID of the device, as you can just select the desired device from the list.

You should now see the newly created element inside this dashboard.

You can now try to use the buttons: when clicking on the On button, it should immediately light up your LED, wether you are in your own local WiFi network or at the other end of the world!

Have you already tried out aREST Pro? What was your experience with it? Please share below!