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.8k 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.
  • Mark SwiftM Offline
    Mark SwiftM Offline
    Mark Swift
    wrote on last edited by
    #279

    @Yveaux That's a shame, I'd really like to solve this. I've tried the radios orientated different ways but it makes little difference. Not using a PA+LNB, I was but gave up on it as I thought it was the issue (Now realise it wasn't).

    Strange that I only see these issues with the ESP, and as soon as I switch to a Nano running the serial gateway they're gone.

    YveauxY 1 Reply Last reply
    0
    • Mark SwiftM Mark Swift

      @Yveaux That's a shame, I'd really like to solve this. I've tried the radios orientated different ways but it makes little difference. Not using a PA+LNB, I was but gave up on it as I thought it was the issue (Now realise it wasn't).

      Strange that I only see these issues with the ESP, and as soon as I switch to a Nano running the serial gateway they're gone.

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

      @Mark-Swift I always use my sniffer in this case to see what's going on on air, but I don't know if your marriage will survive another sniffer build :innocent:

      http://yveaux.blogspot.nl

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

        @Yveaux I doubt it will, seems I'm destined to build a serial gateway, crap, I've invested so much time in this and tried everything!

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

          @Yveaux How about this, for a laugh I just tried rolling the ESP8266 gateway back to v1.5 (master).

          Guess what? It works every time with no fails (communicating with my 2.0.0 beta node). So the issue lies with the latest development version somewhere, any ideas?
          ~~
          Insane, I just took the gateway down the other end of the house and not one fail, wow! So okay, what was changed in version 2.0.0?

          UPDATE: After more investigation, the reason it was working is because v1.5 only has a straight forward gateway version, and until now I've been using the MQTT client. It seems the gateway versions work fine, but the MQTT client version create the fails!

          UPDATE 2: Okay, I can reproduce the fails with the gateway too, let me try and explain. When the gateway is not connected to anything (for example Domoticz) I get OK all of the time, no fails whatsoever. If I connect to Domoticz, I start to get fails against certain child sensors (it's always the same!). I presume it's sketch related, or even the amount of node updates I'm sending? As I believe the fails are the same I'm seeing with the MQTT client.

          UPDATE 3: Nearly 3 weeks in and I've just figured out what has been causing me all this pain. I've always commented out the default 9600 serial baud define on the ESP8266 sketches. It seems this combined with the 200ms TCP delay has been causing me my issues when connecting to my Windows 7 machine. S$%&*!

          YveauxY 1 Reply Last reply
          0
          • Mark SwiftM Mark Swift

            @Yveaux How about this, for a laugh I just tried rolling the ESP8266 gateway back to v1.5 (master).

            Guess what? It works every time with no fails (communicating with my 2.0.0 beta node). So the issue lies with the latest development version somewhere, any ideas?
            ~~
            Insane, I just took the gateway down the other end of the house and not one fail, wow! So okay, what was changed in version 2.0.0?

            UPDATE: After more investigation, the reason it was working is because v1.5 only has a straight forward gateway version, and until now I've been using the MQTT client. It seems the gateway versions work fine, but the MQTT client version create the fails!

            UPDATE 2: Okay, I can reproduce the fails with the gateway too, let me try and explain. When the gateway is not connected to anything (for example Domoticz) I get OK all of the time, no fails whatsoever. If I connect to Domoticz, I start to get fails against certain child sensors (it's always the same!). I presume it's sketch related, or even the amount of node updates I'm sending? As I believe the fails are the same I'm seeing with the MQTT client.

            UPDATE 3: Nearly 3 weeks in and I've just figured out what has been causing me all this pain. I've always commented out the default 9600 serial baud define on the ESP8266 sketches. It seems this combined with the 200ms TCP delay has been causing me my issues when connecting to my Windows 7 machine. S$%&*!

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

            @Mark-Swift Well, look on it from the bright side: your marriage is saved now :bowtie:
            There have been more reports from issues with connections to external servers (e.g. MQTT, Domotiocz) that take too long.
            Maybe we should pull @hek in as he wrote the MQTT client for ESP.

            http://yveaux.blogspot.nl

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #284

              What adjustments do you propose to the MQTT sketch/driver?

              YveauxY 1 Reply Last reply
              0
              • hekH hek

                What adjustments do you propose to the MQTT sketch/driver?

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

                @hek I'm not familiar with the exact implementation at the moment. Just hoped you would have a hunch where these issues might arise from or how we can prevent them...

                http://yveaux.blogspot.nl

                1 Reply Last reply
                0
                • hekH Offline
                  hekH Offline
                  hek
                  Admin
                  wrote on last edited by
                  #286

                  Nope, I don't get why baud rate would affect radio/tcp traffic. Maybe @Mark-Swift could shed some light on it.

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

                    ESP8266 gateway is quite unusable in setups where TCP ACKs can be delayed. This is because thread is blocked until TCP ACK received in ESP wifi code. So all wireless messages will be rejected if NRF24 receives more than 3 messages during this 200ms delay: http://forum.mysensors.org/topic/1870/esp8266-wifi-gateway-port-for-mysensors/235

                    1 Reply Last reply
                    0
                    • hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #288

                      Hmm.. blocking code.. crap.

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

                        The problem is slightly wider than it seems. Wireless messages should be fetched from internal NRF24 FIFO and stored into memory as soon as possible (using interrupts?). But lack of RAM makes the problem difficult to be solved.

                        The same thing happens not only with ESP8266 gateway and TCP ACKs, but also with all blocking calls during sensor reading (for example for old blocking call to read DS18B20 data with 750ms delay), with improper use of delay() instead of gw.wait() and so on.

                        YveauxY 1 Reply Last reply
                        0
                        • R robosensor

                          The problem is slightly wider than it seems. Wireless messages should be fetched from internal NRF24 FIFO and stored into memory as soon as possible (using interrupts?). But lack of RAM makes the problem difficult to be solved.

                          The same thing happens not only with ESP8266 gateway and TCP ACKs, but also with all blocking calls during sensor reading (for example for old blocking call to read DS18B20 data with 750ms delay), with improper use of delay() instead of gw.wait() and so on.

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

                          @robosensor said:

                          lack of RAM

                          Not really an issue on ESP I would say.

                          @hek IMHO it really is time to investigate the impact on the library to support message queueing (fetched & sent from interrupt).
                          Starting with @tekka rewrite of the nRF driver in 2.0 beta, as it supports SPI transactions.
                          Probably we can add support incrementally to lower the impact on the library.

                          http://yveaux.blogspot.nl

                          1 Reply Last reply
                          0
                          • hekH Offline
                            hekH Offline
                            hek
                            Admin
                            wrote on last edited by
                            #291

                            Yes, at least for the gateway and repeaters this would be preferred. How's your play-time-bandwidth?

                            YveauxY 1 Reply Last reply
                            0
                            • hekH hek

                              Yes, at least for the gateway and repeaters this would be preferred. How's your play-time-bandwidth?

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

                              @hek said:

                              How's your play-time-bandwidth?

                              I already feared you we going to ask this ;-)
                              Quite limited at the moment, but such things should grow in my mind first. Let's start with that hehe..

                              http://yveaux.blogspot.nl

                              1 Reply Last reply
                              1
                              • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          12

                                          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