Control Your ESP8266 Projects From Anywhere With aREST Pro

Control Your ESP8266 Projects From Anywhere With aREST Pro

In this tutorial, you will learn how to use the ESP8266 WiFi chip along with aREST Pro, in order to control your projects from anywhere in the world. Compared to the standard version of aREST, aREST Pro adds several features like a much faster server, a 99.99% availability and a device manager integrated inside the aREST dashboard website. You can of course try aREST Pro for free, for up to 5 connected devices!

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 Pro Account

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

https://dashboard.arest.io/

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:

Control Your ESP8266 Projects From Anywhere With aREST Pro

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_pro. 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 Pro server, which is a pretty cool feature of aREST Pro compared to the normal version.

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:

Control Your ESP8266 Projects From Anywhere With aREST Pro

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:

Control Your ESP8266 Projects From Anywhere With aREST Pro

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:

Control Your ESP8266 Projects From Anywhere With aREST Pro

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!

Want to learn more about aREST?
If yes, join over 6,000 people who receive exclusive information about the aREST framework. You will also receive a free sample from my book, Discover the aREST Framework. Simply click on the button below!

Leave a Comment

Please enter your name.
Please enter your email.
Please enter your comment.
wtling 3 months ago
Hi Macro, thanks for your work. i try the library work nice for esp8266 with dashboard control just a small and simple pin 13 output control on off. but try the url method is fail as mention in webpage format cloud.arest.io//digital/13/1 in browser will get the message "message "Wrong API key or API key missing for protected device.", do the format was change
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz wtling 2 months ago
Thanks! It seems like you are using an API key, make sure to pass it as an URL query (?key=...) in your request
qwerty 3 months ago
I can't find https://dashboard.arest.io was the page deleted?
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz qwerty 2 months ago
It's still there for sure :)
mesut 4 months ago
App Inventor Extensions ilgili bazı kodları paylaştım neden cevap yok
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Adriel 4 months ago
My ESP devices were working until the website went through some updates now none of my devices are showing up in the dashboard. I try to re-add them and nothing. I can make rows and elements but I cannot assign a device or a GPIO to anything.
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Vaggelis Papavasiliou 4 months ago
Hello. I try the following code: but not see my device to register . What to check ? // WiFi parameters const char* ssid = "vp..."; //Change the stars with your SSID const char* password = "vtcast2!"; //Change the stars with your password char * key = "***********"; //My API key from aREST site Timer t; IPAddress ip(192,168,0,201); //The static IP you'd like your lamp to get from the router IPAddress gateway(192,168,0,1); IPAddress subnet(255,255,255,0); // The port to listen for incoming TCP connections #define LISTEN_PORT 80 // Create an instance of the server WiFiServer server(LISTEN_PORT);
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Almas 6 months ago
Marco thank you very much for your work. I created app based on arest.io and everythinh work perfectly but sometime i have problem with device ID, sometime it dissapear and arest.io cloud doesnt recognize device ID enymore and than i must to upload new code with new device ID .Why this hapened. You can see my worh here https://www.youtube.com/watch?v=oiw_aen6NtU&feature=youtu.be.
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Almas 5 months ago

Hi, you're welcome! This was a bug that was both due to a piece of code we needed to fix, and also to the server that couldn't handle all the users. Now this should be fixed :)

Jihad Basuni 6 months ago
Hi Marco, I created a variable, which was connected to LDR, in my dashboard. But its value did not get refreshed. So, how can I refresh it automatically? Thanks
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Jihad Basuni 5 months ago
Hi, the dashboard should now automatically refresh the values, it was a feature we needed to add :) Also make sure to try the real-time graphs!
awais 6 months ago
can someone help me! how to connect esp8266 esp-01 with arest.io server. i need code .
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz awais 5 months ago
Hi, you can find the code right in the aREST repository: https://github.com/marcoschwartz/aREST
Naveenkumar 7 months ago
Hai, I have used starter plan,In esp8266 I have uploaded the sketch with key, i have verified from the serial print that it is connedted to wifi and arest.io but in dashboard no devices are seen "https://dashboard.arest.io/devices" kindly help....
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Naveenkumar 6 months ago

Hi, did you make sure that you entered the correct API key in the sketch?

Georg 7 months ago
Marco I would like to send a simple /digital/2/1 to another node without doing it from a webrowser Can this be done
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
krishnendu kundu 7 months ago
I was running my relay cloud control successfully using arest. Suddenly, website stopped working on 22nd April, 2018 and device is showing online all the time. No high/low status is shown. My device is running perfectly as I have check it in local network. I have created a new account, whereas problem remains same. Is there any server maintenance going on?
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
krishnendu kundu 7 months ago
I was running my relay cloud control successfully using arest. Suddenly, website stopped working on 22nd April, 2018 and device is showing online all the time. No high/low status is shown. My device is running perfectly as I have check it in local network. I have created a new account, whereas problem remains same. Is there any server maintenance going on?
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz krishnendu kundu 6 months ago
Sorry about that, there were indeed some server upgrades we had to do to guarantee a good service. Now it should be all fixed :)
Ralph Klein 10 months ago
Hi Marco! Can I integrate the API on an Android app? If so, how do I start it? Thanks!
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Ralph Klein 6 months ago
Hi, of course! You just need to make cURL calls from within your app.
Abu Yasfin a year ago
Hello marco.. I got a problem on using arest.io cloud and local access. When I reseted or rebooting device the state of led pin turned to LOW. How can I write the sketch in order the device keeps on its last state position ( LOW OR HIGH ), and not changing afer resetting or rebooting?
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Abu Yasfin 6 months ago
You can simply set it in the code right in the setup part, independently from aREST :)
inzmam Abu Yasfin 5 months ago
How can i do? that status of device remain same after rebooting nodemcu. Give me code please
inzmam Abu Yasfin 5 months ago
Give me code of this please where to change in code?
Erich Hohenstein a year ago
Hello, this works like a charm! really easy to use and straight forward to build. The only concern I have is that I can see everyones devices and they can see mine, therefore using the ID they can activate my devices. Is there a way to make my device ID private?Thanks again!
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Erich Hohenstein 6 months ago

Hi, sure there is! Inside the dashboard you can find your API key that you can then use to protect your devices so no one else can access them.

Kevin Quito a year ago
Hi, I'm using aRest_cloud_Pro example. Everything compiles well, I have a problem in the dashboard. the devices don't get a name and type. I hope you can help me. https://uploads.disquscdn.c...
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Sveglio a year ago
Hi, i'm using aRest pro with a esp8266-12. All things are workin nice but when i connect the board with relays the program automatically sets high and when i use the buttons to drive the input nothing work. It stays high even if the program says me that's low. I hope you can help me. Thanks.
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Kaleb Sveglio 10 months ago
Perhaps the reason why this happens is that your relays have a reverse logic? So when your esp sets the gpio HIGH, the relay is LOW, and when the esp gpio is LOW, the relay is HIGH. I've definitely had this with several of my relays :)
Huncika Laszlo a year ago
can i integrate in google assistent?
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Huncika Laszlo a year ago
Sure, you can call the API from anywhere :)
Budhaditya Biswas a year ago
Hi, I am using aRest_cloud_Pro example. First time it was run fine, I can control 7 GPIO pins (required fro my project) of ESP development board from dashboard.arest.io. but from the next day it shows OFFLINE though the board is power ON. Serial monitor it shows "WiFi connectedAttempting MQTT connection...Connected to aREST.io"but it shows offline and I am not able to control the GPIO any morePlease HELP https://uploads.disquscdn.c...
Reply
Please enter your name.
Please enter your email.
Please enter your comment.
Marco Schwartz Budhaditya Biswas a year ago
Hello, please reach to use at [email protected] to get help on this issue :)
Shares
Control Your ESP8266 Projects From Anywhere With aREST Pro Control Your ESP8266 Projects From Anywhere With aREST Pro Control Your ESP8266 Projects From Anywhere With aREST Pro Control Your ESP8266 Projects From Anywhere With aREST Pro Control Your ESP8266 Projects From Anywhere With aREST Pro Control Your ESP8266 Projects From Anywhere With aREST Pro
Someone from India
Recently signed up
9 days ago
Someone from Indonesia
Recently signed up
12 days ago
Someone from China
Recently signed up
a month ago
Someone from Russian Federation
Recently signed up
a month ago
Someone from Viet Nam
Recently signed up
a month ago
Someone from Russian Federation
Recently signed up
a month ago
Someone from the United States
Recently signed up
a month ago
Someone from Turkey
Recently signed up
2 months ago
Someone from Canada
Recently signed up
2 months ago
Someone from Ukraine
Recently signed up
3 months ago
Someone from Brazil
Recently visited this page
11 minutes ago