Access your ESP32 from the Web

Make your ESP32 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 Espressif ESP32 Development Board.

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

Adding the ESP32

Follow these steps, or see Arduino core for ESP32 to add the ESP32 to your Arduino IDE.

  1. Download the project
    arduino-esp32-master.zip
  2. On Windows extract the ZIP to
    C:\Users\USER_NAME\Documents\Arduino\Hardware\espressif
    On Mac OS X extract the ZIP to
    ~/Documents/Arduino/hardware/espressif
  3. Open a terminal in the espressif/esp32/tools subdirectory and type
    $ python get.py

    This step requires Python 2.7 and pySerial.

  4. Close and re-open the Arduino IDE and select the menu
    Tools > Board > ESP32 Dev Module

Installing the Yaler library

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

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

Trying a quick example

  1. Open the Arduino IDE and select the menu
    File > Examples > YalerWiFiServer > YalerWebService
  2. Replace RELAY_DOMAIN with your relay domain, e.g. for the relay domain gsiot-ffmq-ttd5 that would be
    YalerWiFiServer server("try.yaler.io", 80, "gsiot-ffmq-ttd5");
  3. Upload the example code to your ESP32
  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 <YalerWiFiServer.h>
  2. Replace the line
    WiFiServer server(80);
    
    with the line
    YalerWiFiServer 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 <WiFi.h>
    #include <YalerWiFiServer.h>
    ...
    
    //WiFiServer server(80);
    YalerWiFiServer 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.