Access your Arduino WiFi from the Web

Make your Arduino 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 works with any Arduino setup supporting the WiFi library, e.g. the WiFiShield.

Using another setup? See how to access your Arduino WiFi101, the Arduino CC3000, the Arduino Ethernet or the Arduino Yún.

Installing the 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 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 <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.