Access your ESP8266 from the Web

Make your ESP8266 accessible from anywhere via the Yaler relay.

Prerequisites

Setting up your device requires a relay domain. Please sign up to get one.

Setting up the hardware

This tutorial assumes you are using the Arduino IDE, e.g. with the Adafruit HUZZAH ESP8266 breakout.

This tutorial is still in beta. Found a bug? Let us know.

Installing the library

Follow these steps to add the YalerESP8266WiFiServer library to your Arduino IDE.

  1. Download the library
    YalerESP8266WiFiServer.zip
  2. On Windows extract the ZIP to
    C:\Users\USER_NAME\Documents\Arduino\Libraries\YalerESP8266WiFiServer
    On Mac OS X extract the ZIP to
    ~/Documents/Arduino/libraries/YalerESP8266WiFiServer
  3. Close and re-open your Arduino IDE.

Trying a quick example

  1. Open the Arduino IDE and select the menu
    File > Examples > YalerESP8266WiFiServer > YalerWebService
  2. Replace RELAY_DOMAIN with your relay domain, e.g. for the relay domain gsiot-ffmq-ttd5 that would be
    YalerESP8266WiFiServer server("try.yaler.io", 80, "gsiot-ffmq-ttd5");
  3. Upload the example code to your Arduino
  4. Done. Now, see how to access your device from a Web browser or with Curl (and resolve errors).

Converting an existing Web service

How to adapt an existing Arduino Web service to make it accessible from the Web.

  1. Add the line
    #include <YalerESP8266WiFiServer.h>
  2. Replace the line
    WiFiServer server(80);
    
    with the line
    YalerESP8266WiFiServer server("try.yaler.io", 80, "RELAY_DOMAIN"); // Use YOUR relay domain
  3. Those changes together look something like this (all else remains the same)
    #include <ESP8266WiFi.h>
    #include <YalerESP8266WiFiServer.h>
    ...
    
    //WiFiServer server(80);
    YalerESP8266WiFiServer server("try.yaler.io", 80, "RELAY_DOMAIN"); // Use YOUR relay domain
    
    void setup() {
      ...
    }
    
    void loop() {
      ...
    }
  4. Done. Now, see how to access your device from a Web browser or with Curl or from iOS or from Android (and resolve errors).


Creative Commons License This work by Yaler GmbH is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.