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. Development
  3. ESP8266 WiFi gateway port for MySensors

ESP8266 WiFi gateway port for MySensors

Scheduled Pinned Locked Moved Development
328 Posts 56 Posters 309.9k Views 39 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.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by
    #293

    Mo ha haha :smiling_imp:

    1 Reply Last reply
    0
    • scalzS Offline
      scalzS Offline
      scalz
      Hardware Contributor
      wrote on last edited by scalz
      #294

      @hek @Yveaux : I don't know if this could help. but some times ago I found a lib when you were talking about this issue but I have never had enough time to test it. It is a "non blocking" ack with some buffering version for wifiserver. I think that does not solve completely the buffering issue :confused: But maybe a small step..
      I don't remember where I read this but igr was saying it would be better to have a lib for this than modifiying the wifiserver lib for compatibility with other arduino wifi libs. So maybe this guy did it.
      http://www.forward.com.au/pfod/pfodParserLibraries/index.html
      In the middle :)
      I also read that for esp, bigger tcp packet were processed faster than small :open_mouth:
      very tricky issue to debug when so much layers..

      1 Reply Last reply
      0
      • R Offline
        R Offline
        robosensor
        wrote on last edited by
        #295

        Also it is possible to partially solve this issue by fetching all available messages from NRF24 FIFO and concatenating them into one TCP packet for ESP. It is possible that this will be useful for other gateways too.

        @Yveaux said:

        IMHO it really is time to investigate the impact on the library to support message queueing (fetched & sent from interrupt).

        But no chances that MYS protocol will be changed? I'm talking about reliable delivery and message ids. That topic is very close to this.

        YveauxY 1 Reply Last reply
        0
        • R robosensor

          Also it is possible to partially solve this issue by fetching all available messages from NRF24 FIFO and concatenating them into one TCP packet for ESP. It is possible that this will be useful for other gateways too.

          @Yveaux said:

          IMHO it really is time to investigate the impact on the library to support message queueing (fetched & sent from interrupt).

          But no chances that MYS protocol will be changed? I'm talking about reliable delivery and message ids. That topic is very close to this.

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #296

          @robosensor I think message buffering could be the first step to (more) reliable delivery.

          http://yveaux.blogspot.nl

          1 Reply Last reply
          1
          • scalzS Offline
            scalzS Offline
            scalz
            Hardware Contributor
            wrote on last edited by
            #297

            this was the thread I read. pfod lib creator and esplibs team were talking about this.
            https://github.com/esp8266/Arduino/issues/1430
            And it seems there is another lib too for this:
            https://github.com/me-no-dev/ESPAsyncTCP

            YveauxY 1 Reply Last reply
            0
            • scalzS scalz

              this was the thread I read. pfod lib creator and esplibs team were talking about this.
              https://github.com/esp8266/Arduino/issues/1430
              And it seems there is another lib too for this:
              https://github.com/me-no-dev/ESPAsyncTCP

              YveauxY Offline
              YveauxY Offline
              Yveaux
              Mod
              wrote on last edited by
              #298

              @scalz Thanks for the links man!

              Now we're at it: anyone knows if a blocked socket connection can be interrupted at all by an external pin interrupt on ESP(Arduino) ? Otherwise buffering on interrupts will make no sense...

              http://yveaux.blogspot.nl

              1 Reply Last reply
              0
              • Mark SwiftM Offline
                Mark SwiftM Offline
                Mark Swift
                wrote on last edited by Mark Swift
                #299

                Thanks for looking into this guys... I've been doing some tests and basically the ESP gateway is not an option for me right now due to too many radio failures.

                Using the normal serial gateway I tested one of my nodes that sends about 15 values during each loop; it was perfect every time!
                The same test with the ESP shows failures every few messages or so, introducing a large radio delay between each send fixes it, but the issue can still occur if other nodes call in at the same time.

                Another interesting thing, when I don't specify a gateway, or static IP I get no failures, when I do, I get failures, what!?

                YveauxY 1 Reply Last reply
                0
                • Mark SwiftM Mark Swift

                  Thanks for looking into this guys... I've been doing some tests and basically the ESP gateway is not an option for me right now due to too many radio failures.

                  Using the normal serial gateway I tested one of my nodes that sends about 15 values during each loop; it was perfect every time!
                  The same test with the ESP shows failures every few messages or so, introducing a large radio delay between each send fixes it, but the issue can still occur if other nodes call in at the same time.

                  Another interesting thing, when I don't specify a gateway, or static IP I get no failures, when I do, I get failures, what!?

                  YveauxY Offline
                  YveauxY Offline
                  Yveaux
                  Mod
                  wrote on last edited by
                  #300

                  @Mark-Swift Don't know if you already ditched the ESP gateway completely, but you could give my latest experiment a try: https://github.com/Yveaux/Arduino/tree/development
                  It adds a reception queue to the gateway which will immediately retrieve a message from the radio when it comes in. This process should even continue when the ESP is blocked on some TCP transfer.
                  Only thing you have to do is connect the IRQ line from the nRF radio to the ESP (e.g. to pin 1), and define the IRQ pin at the top of your gateway sketch:

                  #define MY_RF24_IRQ_PIN  (1)
                  

                  I tested this on a UNO, and can easily sleep the gateway for 1 second or more when messages come in at 0.1sec interval -- none gets lost. The buffer is set to 20 by default, but you can increase it when the amount of RAM allows it:

                  #define MY_RF24_MESSAGE_BUFFER_SIZE  (50)
                  

                  I don't have a NodeMCU setup ready so I cannot test it on ESP myself...

                  http://yveaux.blogspot.nl

                  1 Reply Last reply
                  2
                  • Mark SwiftM Offline
                    Mark SwiftM Offline
                    Mark Swift
                    wrote on last edited by Mark Swift
                    #301

                    @Yveaux I'll sure give it a shot when time allows, most likely tomorrow... I've actually worked around the issue by using a regedit hack on my Windows server to remove the 200ms TCP delay. I also fried a Node MCU tonight due to frustration and not concentrating!

                    Thanks for the efforts, sounds a great solution :)

                    BTW, I figured out my main issue was trying to put the nRF24l01+PA+LNA and ESP in a small project box, I guess that also causes issues, especially with the crappy cheap unshielded PA modules (I'm awaiting a proper shielded version).

                    @robosensor also...

                    1 Reply Last reply
                    0
                    • Mark SwiftM Offline
                      Mark SwiftM Offline
                      Mark Swift
                      wrote on last edited by
                      #302

                      @Yveaux Is there a way I can track dropped messages?

                      YveauxY 1 Reply Last reply
                      0
                      • Mark SwiftM Mark Swift

                        @Yveaux Is there a way I can track dropped messages?

                        YveauxY Offline
                        YveauxY Offline
                        Yveaux
                        Mod
                        wrote on last edited by
                        #303

                        @Mark-Swift my queueing code counts how many messages could not be stored due to the queue being full, and therefore got lost. If the radio drops messages because it's FIFO is full we won't know...

                        http://yveaux.blogspot.nl

                        1 Reply Last reply
                        0
                        • Mark SwiftM Offline
                          Mark SwiftM Offline
                          Mark Swift
                          wrote on last edited by
                          #304

                          @Yveaux I just tried to compile it and get the following error:

                          In file included from /Users/markswift/Documents/Arduino/libraries/MySensors/core/MyTransportNRF24.cpp:23:0,
                          from /Users/markswift/Documents/Arduino/libraries/MySensors/MySensor.h:260,
                          from /Users/markswift/Documents/Personal/Hobbies/Arduino/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino:132:
                          /Users/markswift/Documents/Arduino/libraries/MySensors/drivers/CircularBuffer/CircularBuffer.h:23:25: fatal error: util/atomic.h: No such file or directory
                          #include <util/atomic.h>

                          YveauxY 1 Reply Last reply
                          0
                          • Mark SwiftM Mark Swift

                            @Yveaux I just tried to compile it and get the following error:

                            In file included from /Users/markswift/Documents/Arduino/libraries/MySensors/core/MyTransportNRF24.cpp:23:0,
                            from /Users/markswift/Documents/Arduino/libraries/MySensors/MySensor.h:260,
                            from /Users/markswift/Documents/Personal/Hobbies/Arduino/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino:132:
                            /Users/markswift/Documents/Arduino/libraries/MySensors/drivers/CircularBuffer/CircularBuffer.h:23:25: fatal error: util/atomic.h: No such file or directory
                            #include <util/atomic.h>

                            YveauxY Offline
                            YveauxY Offline
                            Yveaux
                            Mod
                            wrote on last edited by
                            #305

                            @Mark-Swift Sorry, my bad. This is AVR only code... Have to look for the ESP equivalent...

                            http://yveaux.blogspot.nl

                            1 Reply Last reply
                            0
                            • YveauxY Offline
                              YveauxY Offline
                              Yveaux
                              Mod
                              wrote on last edited by
                              #306

                              This util/atomic.h is an easy fix, but then the next error occurs: current ESP8266 Arduino port (even tried upto 2.2.0) does not support SPI access from within interrupts (SPI.usingInterrupt is not supported.
                              See https://github.com/esp8266/Arduino/issues/1943.
                              This means I cannot reliably get the message data from the nRF from within an interrupt on ESP8266, using the regular Arduino SPI library.
                              Have to think if there's another solution (or push this issue to be solved ;-) )
                              To be continued...

                              http://yveaux.blogspot.nl

                              1 Reply Last reply
                              0
                              • Mark SwiftM Offline
                                Mark SwiftM Offline
                                Mark Swift
                                wrote on last edited by
                                #307

                                nightmare!

                                Let me know how you get on...

                                1 Reply Last reply
                                0
                                • signal15S Offline
                                  signal15S Offline
                                  signal15
                                  wrote on last edited by
                                  #308

                                  Is anyone having luck running the ESP without problems at all? I'm on 1.5 and it's my first gateway, and I cannot get sensors to include. Should I try the development branch? Or, should I build a different gateway altogether? I just need something that works at this point.

                                  1 Reply Last reply
                                  0
                                  • alexsh1A Offline
                                    alexsh1A Offline
                                    alexsh1
                                    wrote on last edited by
                                    #309

                                    Let me reiterate what @signal15 asked - did anyone successfully have esp8266 running as the GW on 2.0b? I have just acquired Wemos mini and would like to try it

                                    1 Reply Last reply
                                    0
                                    • AndurilA Offline
                                      AndurilA Offline
                                      Anduril
                                      wrote on last edited by
                                      #310

                                      @alexsh1 @signal15 I can confirm that the ESP gateway is working fine and stable. I even enabled the ESP OTA update function and that's working fine too.

                                      signal15S 1 Reply Last reply
                                      0
                                      • AndurilA Anduril

                                        @alexsh1 @signal15 I can confirm that the ESP gateway is working fine and stable. I even enabled the ESP OTA update function and that's working fine too.

                                        signal15S Offline
                                        signal15S Offline
                                        signal15
                                        wrote on last edited by
                                        #311

                                        @Anduril

                                        Can you point me to documentation on how the OTA update stuff works and what the capabilities are?

                                        1 Reply Last reply
                                        0
                                        • AndurilA Offline
                                          AndurilA Offline
                                          Anduril
                                          wrote on last edited by Anduril
                                          #312

                                          @signal15 well there is a doc about OTA here. I discussed this topic with tekka, who is the author of the GatewayESP8266OTA example in the mysensors lib here.
                                          It took me some time to get this working, but now I can upload new firmware to my ESP using wifi. Only drawback is that is seems to be not compatible with the mqtt version of the gateway. At least I was not able to get this working and stopped on that.
                                          If you have further questions, don't hesitate to ask.

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          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