Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Sparkfun8266 Wifi Shield + Arduino Due = WiFi Gateway

Sparkfun8266 Wifi Shield + Arduino Due = WiFi Gateway

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 3 Posters 1.7k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    ZachFlem
    wrote on last edited by
    #1

    Hi Folks,
    I'm trying to convert an existing Ethernet Gateway (shield based w5100) into a WiFi gateway.

    I have the wifi shield working, can ping the Due etc.

    I've copied my relay code below the 8266 setup stuff, but I get an error when compiling:

    C:\Users\zach\Documents\Arduino\libraries\MySensors/MySensors.h:389:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
    

    I guess it's because I have no:

    // Enable gateway ethernet module type
    #define MY_GATEWAY_W5100
    

    defined in my new sketch, but I'm not sure what to define. Will the w5100 work once the WiFi is up and running?

    I appreciate any help you folks can shed on this!

    Full sketch here:

    // Set the gateway type
    #define MY_GATEWAY_w5100
    
    // The port to keep open on node server mode
    #define MY_PORT 5003
    
    // How many clients should be able to connect to this gateway (default 1)
    #define MY_GATEWAY_MAX_CLIENTS 2
    
    
    #include <SoftwareSerial.h>
    #include <SparkFunESP8266WiFi.h>
    #include <MySensors.h>
    
    // Define relays
    #define RELAY_1  2            // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 4    // Total number of attached relays
    #define RELAY_ON 0            // GPIO value to write to turn on attached relay
    #define RELAY_OFF 1           // GPIO value to write to turn off attached relay
    
    // Replace these two character strings with the name and
    // password of your WiFi network.
    const char mySSID[] = "yourSSIDhere";
    const char myPSK[] = "yourPWDhere";
    
    void before()
    {
      for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
        // Then set relay pins in output mode
        pinMode(pin, OUTPUT);
        // Set relay to last known state (using eeprom storage)
        digitalWrite(pin, loadState(sensor) ? RELAY_ON : RELAY_OFF);
      }
    }
    
    void setup()
    {
    
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Audry - GW w/Relays", "1.0");
      
      for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        present(sensor, S_BINARY);
      }
    }
    
    
    void loop()
    {
    
    }
    
    void receive(const MyMessage &message)
    {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type == V_STATUS) {
        // Change relay state
        digitalWrite(message.sensor - 1 + RELAY_1, message.getBool() ? RELAY_ON : RELAY_OFF);
        // Store state in eeprom
        saveState(message.sensor, message.getBool());
        // Write some debug info
        Serial.print("Incoming change for sensor:");
        Serial.print(message.sensor);
        Serial.print(", New status: ");
        Serial.println(message.getBool());
      }
    }
    
    M Y 2 Replies Last reply
    0
    • Z ZachFlem

      Hi Folks,
      I'm trying to convert an existing Ethernet Gateway (shield based w5100) into a WiFi gateway.

      I have the wifi shield working, can ping the Due etc.

      I've copied my relay code below the 8266 setup stuff, but I get an error when compiling:

      C:\Users\zach\Documents\Arduino\libraries\MySensors/MySensors.h:389:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      

      I guess it's because I have no:

      // Enable gateway ethernet module type
      #define MY_GATEWAY_W5100
      

      defined in my new sketch, but I'm not sure what to define. Will the w5100 work once the WiFi is up and running?

      I appreciate any help you folks can shed on this!

      Full sketch here:

      // Set the gateway type
      #define MY_GATEWAY_w5100
      
      // The port to keep open on node server mode
      #define MY_PORT 5003
      
      // How many clients should be able to connect to this gateway (default 1)
      #define MY_GATEWAY_MAX_CLIENTS 2
      
      
      #include <SoftwareSerial.h>
      #include <SparkFunESP8266WiFi.h>
      #include <MySensors.h>
      
      // Define relays
      #define RELAY_1  2            // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 4    // Total number of attached relays
      #define RELAY_ON 0            // GPIO value to write to turn on attached relay
      #define RELAY_OFF 1           // GPIO value to write to turn off attached relay
      
      // Replace these two character strings with the name and
      // password of your WiFi network.
      const char mySSID[] = "yourSSIDhere";
      const char myPSK[] = "yourPWDhere";
      
      void before()
      {
        for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
          // Then set relay pins in output mode
          pinMode(pin, OUTPUT);
          // Set relay to last known state (using eeprom storage)
          digitalWrite(pin, loadState(sensor) ? RELAY_ON : RELAY_OFF);
        }
      }
      
      void setup()
      {
      
      }
      
      void presentation()
      {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Audry - GW w/Relays", "1.0");
        
        for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_BINARY);
        }
      }
      
      
      void loop()
      {
      
      }
      
      void receive(const MyMessage &message)
      {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type == V_STATUS) {
          // Change relay state
          digitalWrite(message.sensor - 1 + RELAY_1, message.getBool() ? RELAY_ON : RELAY_OFF);
          // Store state in eeprom
          saveState(message.sensor, message.getBool());
          // Write some debug info
          Serial.print("Incoming change for sensor:");
          Serial.print(message.sensor);
          Serial.print(", New status: ");
          Serial.println(message.getBool());
        }
      }
      
      M Offline
      M Offline
      manutremo
      wrote on last edited by
      #2

      @zachflem Be sure that the #define is in capitals:

      #define MY_GATEWAY_W5100
      

      Otherwise it won't be correctly used by the compiler.

      1 Reply Last reply
      0
      • Z ZachFlem

        Hi Folks,
        I'm trying to convert an existing Ethernet Gateway (shield based w5100) into a WiFi gateway.

        I have the wifi shield working, can ping the Due etc.

        I've copied my relay code below the 8266 setup stuff, but I get an error when compiling:

        C:\Users\zach\Documents\Arduino\libraries\MySensors/MySensors.h:389:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
        

        I guess it's because I have no:

        // Enable gateway ethernet module type
        #define MY_GATEWAY_W5100
        

        defined in my new sketch, but I'm not sure what to define. Will the w5100 work once the WiFi is up and running?

        I appreciate any help you folks can shed on this!

        Full sketch here:

        // Set the gateway type
        #define MY_GATEWAY_w5100
        
        // The port to keep open on node server mode
        #define MY_PORT 5003
        
        // How many clients should be able to connect to this gateway (default 1)
        #define MY_GATEWAY_MAX_CLIENTS 2
        
        
        #include <SoftwareSerial.h>
        #include <SparkFunESP8266WiFi.h>
        #include <MySensors.h>
        
        // Define relays
        #define RELAY_1  2            // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
        #define NUMBER_OF_RELAYS 4    // Total number of attached relays
        #define RELAY_ON 0            // GPIO value to write to turn on attached relay
        #define RELAY_OFF 1           // GPIO value to write to turn off attached relay
        
        // Replace these two character strings with the name and
        // password of your WiFi network.
        const char mySSID[] = "yourSSIDhere";
        const char myPSK[] = "yourPWDhere";
        
        void before()
        {
          for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
            // Then set relay pins in output mode
            pinMode(pin, OUTPUT);
            // Set relay to last known state (using eeprom storage)
            digitalWrite(pin, loadState(sensor) ? RELAY_ON : RELAY_OFF);
          }
        }
        
        void setup()
        {
        
        }
        
        void presentation()
        {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("Audry - GW w/Relays", "1.0");
          
          for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
            // Register all sensors to gw (they will be created as child devices)
            present(sensor, S_BINARY);
          }
        }
        
        
        void loop()
        {
        
        }
        
        void receive(const MyMessage &message)
        {
          // We only expect one type of message from controller. But we better check anyway.
          if (message.type == V_STATUS) {
            // Change relay state
            digitalWrite(message.sensor - 1 + RELAY_1, message.getBool() ? RELAY_ON : RELAY_OFF);
            // Store state in eeprom
            saveState(message.sensor, message.getBool());
            // Write some debug info
            Serial.print("Incoming change for sensor:");
            Serial.print(message.sensor);
            Serial.print(", New status: ");
            Serial.println(message.getBool());
          }
        }
        
        Y Offline
        Y Offline
        Yveaux
        Mod
        wrote on last edited by
        #3

        @zachflem your setup is not compatible with the standard setups supported by mySensors.
        The sparkfun shield requires the esp8266 AT command set to communicate over wifi.

        I would advise you to use a different esp8266 board (E. G. NodeMCU) and program this directly as an Arduino.

        This should get you started: https://www.mysensors.org/build/esp8266_gateway

        http://yveaux.blogspot.nl

        M Z 2 Replies Last reply
        1
        • Y Yveaux

          @zachflem your setup is not compatible with the standard setups supported by mySensors.
          The sparkfun shield requires the esp8266 AT command set to communicate over wifi.

          I would advise you to use a different esp8266 board (E. G. NodeMCU) and program this directly as an Arduino.

          This should get you started: https://www.mysensors.org/build/esp8266_gateway

          M Offline
          M Offline
          manutremo
          wrote on last edited by
          #4

          Ups yes I didn't realize that board won't work.

          I'm using a Wemos D1 R2 with support for OTA firmwar updates. I can share the code if you 're interested.

          1 Reply Last reply
          1
          • Y Yveaux

            @zachflem your setup is not compatible with the standard setups supported by mySensors.
            The sparkfun shield requires the esp8266 AT command set to communicate over wifi.

            I would advise you to use a different esp8266 board (E. G. NodeMCU) and program this directly as an Arduino.

            This should get you started: https://www.mysensors.org/build/esp8266_gateway

            Z Offline
            Z Offline
            ZachFlem
            wrote on last edited by
            #5

            @yveaux Well that's just handy isnt it! So that shield was a waste of $12 bux!

            I've just ordered a prototyping shield and I'm going to have a go at building my own hack job esp-01 based shield.

            I've got an existing MEGA that I want to retrofit with wifi, rather than rebuilding the whole thing from scratch, and I'm using a LOT of I/O, which I havn't seen much of on the ESP stuff.

            Unless you can suggest an ESP based MEGA replacement with plenty (20+) I/O pins available??

            Cheers

            M Y 2 Replies Last reply
            0
            • Z ZachFlem

              @yveaux Well that's just handy isnt it! So that shield was a waste of $12 bux!

              I've just ordered a prototyping shield and I'm going to have a go at building my own hack job esp-01 based shield.

              I've got an existing MEGA that I want to retrofit with wifi, rather than rebuilding the whole thing from scratch, and I'm using a LOT of I/O, which I havn't seen much of on the ESP stuff.

              Unless you can suggest an ESP based MEGA replacement with plenty (20+) I/O pins available??

              Cheers

              M Offline
              M Offline
              manutremo
              wrote on last edited by
              #6

              @zachflem There are no ESP based boards wich such a high number of GPIOs that I know of. But there are some MEGA + ESP boards out there. I'm not sure they would work with Mysensors but may want to have a look.

              https://robotdyn.com/mega-wifi-r3-atmega2560-esp8266-flash-32mb-usb-ttl-ch340g-micro-usb.html

              https://www.instructables.com/id/Arduino-MEGA-2560-With-WiFi-Built-in-ESP8266/

              1 Reply Last reply
              0
              • Z ZachFlem

                @yveaux Well that's just handy isnt it! So that shield was a waste of $12 bux!

                I've just ordered a prototyping shield and I'm going to have a go at building my own hack job esp-01 based shield.

                I've got an existing MEGA that I want to retrofit with wifi, rather than rebuilding the whole thing from scratch, and I'm using a LOT of I/O, which I havn't seen much of on the ESP stuff.

                Unless you can suggest an ESP based MEGA replacement with plenty (20+) I/O pins available??

                Cheers

                Y Offline
                Y Offline
                Yveaux
                Mod
                wrote on last edited by
                #7

                @zachflem I advise to keep your setup and your nodes simple. A gateway has a clear function and although gateway support for sensors has been added recently I would not try to fit everything into a single node.
                Reconsider your setup, using a simple esp8266+radio as your wifi gateway and one or more nodes providing the functionality you're looking for.

                http://yveaux.blogspot.nl

                Z 1 Reply Last reply
                1
                • Y Yveaux

                  @zachflem I advise to keep your setup and your nodes simple. A gateway has a clear function and although gateway support for sensors has been added recently I would not try to fit everything into a single node.
                  Reconsider your setup, using a simple esp8266+radio as your wifi gateway and one or more nodes providing the functionality you're looking for.

                  Z Offline
                  Z Offline
                  ZachFlem
                  wrote on last edited by
                  #8

                  @yveaux well that's just not going to work for me, I'm trying to cut down on the amount of power supplies and random junk I have spread all over the place.

                  1 Reply Last reply
                  0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  8

                  Online

                  12.0k

                  Users

                  11.2k

                  Topics

                  113.4k

                  Posts


                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • MySensors
                  • OpenHardware.io
                  • Categories
                  • Recent
                  • Tags
                  • Popular