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. Arduino Mega + W5500 + BME280 = Connection refused all the time

Arduino Mega + W5500 + BME280 = Connection refused all the time

Scheduled Pinned Locked Moved Troubleshooting
22 Posts 4 Posters 108 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.
  • TRS-80T TRS-80

    OK, so it appears the Ethernet part works? I am still not sure what this is about though?:

    @NeoX said in Arduino Mega + W5500 + BME280 = Connection refused all the time:

    When i close connection (by ctrl+] and close), then i cannot connect to it again

    Other than this (potential?) problem, if Ethernet works, brings me back to what I speculated above about the main loop running too much...

    N Offline
    N Offline
    NeoX
    wrote on last edited by
    #11

    @TRS-80 But it's not possible, or some bug in Mysensors.
    Because in plain example the loop in sketch is empty.
    Do you use lib version 2.3.3 of MySensors lib?

    YveauxY 1 Reply Last reply
    0
    • TRS-80T Offline
      TRS-80T Offline
      TRS-80
      wrote on last edited by
      #12

      I just checked my local files for my gateway, and looks like MySensors is v2.3.2.

      I am inclined to think the problem is somewhere else, before assuming a bug in MySensors, however it is possible (although unlikely IMO) that potentially could be the problem. One easy way to find out, anyway... ;)

      N 1 Reply Last reply
      0
      • N NeoX

        @TRS-80 But it's not possible, or some bug in Mysensors.
        Because in plain example the loop in sketch is empty.
        Do you use lib version 2.3.3 of MySensors lib?

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

        @NeoX mysensors has an empty main loop() by default. The stack runs in the 'background', after each loop iteration, so your loop() should not block!

        http://yveaux.blogspot.nl

        1 Reply Last reply
        0
        • TRS-80T TRS-80

          I just checked my local files for my gateway, and looks like MySensors is v2.3.2.

          I am inclined to think the problem is somewhere else, before assuming a bug in MySensors, however it is possible (although unlikely IMO) that potentially could be the problem. One easy way to find out, anyway... ;)

          N Offline
          N Offline
          NeoX
          wrote on last edited by
          #14

          @TRS-80 Do you have any idea whats more i can check? :)
          Because i have no idea what could be wrong when i use plain sketch

          1 Reply Last reply
          0
          • TRS-80T Offline
            TRS-80T Offline
            TRS-80
            wrote on last edited by TRS-80
            #15

            Didn't you say plain sketch was working? Other than only being able to connect only once via telnet?

            To be honest I am not familiar with using telnet for testing this sort of thing, so I installed it here on my Debian development machine to try and replicate what you are doing, but so far no luck. Probably because first time with tool and simply haven't figured it out yet. But this is what I get so far (probably doing something wrong):

            ┌─[ 2020-06-26 09:33 trs80@host:~ ]
            └─▶ $ telnet 192.168.x.y 1883
            
            Trying 192.168.x.y...
            telnet: Unable to connect to remote host: Connection refused
            
            ┌─[ 2020-06-26 09:33 trs80@host:~ ]
            └─▶ $ telnet 192.168.x.y:1883
            
            telnet: could not resolve 192.168.x.y:1883/telnet: Name or service not known
            

            Note I am running an MQTT gateway, therefore I set port 1883 in my sketch, furthermore I am running in MY_GATEWAY_MQTT_CLIENT mode (I think I read server mode is default in plain (non-MQTT) Ethernet sketch? not sure). So that could be part of my problem here, too.

            N 1 Reply Last reply
            0
            • TRS-80T TRS-80

              Didn't you say plain sketch was working? Other than only being able to connect only once via telnet?

              To be honest I am not familiar with using telnet for testing this sort of thing, so I installed it here on my Debian development machine to try and replicate what you are doing, but so far no luck. Probably because first time with tool and simply haven't figured it out yet. But this is what I get so far (probably doing something wrong):

              ┌─[ 2020-06-26 09:33 trs80@host:~ ]
              └─▶ $ telnet 192.168.x.y 1883
              
              Trying 192.168.x.y...
              telnet: Unable to connect to remote host: Connection refused
              
              ┌─[ 2020-06-26 09:33 trs80@host:~ ]
              └─▶ $ telnet 192.168.x.y:1883
              
              telnet: could not resolve 192.168.x.y:1883/telnet: Name or service not known
              

              Note I am running an MQTT gateway, therefore I set port 1883 in my sketch, furthermore I am running in MY_GATEWAY_MQTT_CLIENT mode (I think I read server mode is default in plain (non-MQTT) Ethernet sketch? not sure). So that could be part of my problem here, too.

              N Offline
              N Offline
              NeoX
              wrote on last edited by
              #16

              @TRS-80 The plain sketch is working in Server mode, so it is possible to connect to port 5003.
              Since i don't know any tools to test MySensors ethernet, i've used telnet :)

              My plain Ethernet example sketch is working, but only for one time after reset, which is weird. Just like some resources hasn't been released or W5500 didnt realised that connection was closed after ctrl+] ?
              No idea...
              I will take a look at MQTT, since it is working in Client mode...

              YveauxY 1 Reply Last reply
              0
              • N NeoX

                @TRS-80 The plain sketch is working in Server mode, so it is possible to connect to port 5003.
                Since i don't know any tools to test MySensors ethernet, i've used telnet :)

                My plain Ethernet example sketch is working, but only for one time after reset, which is weird. Just like some resources hasn't been released or W5500 didnt realised that connection was closed after ctrl+] ?
                No idea...
                I will take a look at MQTT, since it is working in Client mode...

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

                @NeoX what bme library are you using?

                http://yveaux.blogspot.nl

                N 1 Reply Last reply
                0
                • YveauxY Yveaux

                  @NeoX what bme library are you using?

                  N Offline
                  N Offline
                  NeoX
                  wrote on last edited by
                  #18

                  @Yveaux Adafruit BME280 in version 2.0.0, as it said in Arduino IDE

                  YveauxY 1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    NeoX
                    wrote on last edited by
                    #19

                    Well, i tested MQTT and it worked just fine for a few minutes. Any problems.
                    I belive that there is some kind of bug in TCP server mode or maybe W5500 driver?
                    I can also say that when i close telnet connection via ctrl+] i can see that my PC is still waiting for close ack ( connection state in netstat is WAIT_FIN_2).

                    Don't know, but i switched to MQTT and it works fine, and i think MQTT client is more important for me.

                    1 Reply Last reply
                    0
                    • N NeoX

                      @Yveaux Adafruit BME280 in version 2.0.0, as it said in Arduino IDE

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

                      @NeoX Maybe not relevant, but that doesn't appear to be the Adafruit BME280, as you're including <bme280_mod-1022.h>. This headerfile appears to be part of this library: https://github.com/embeddedadventures/BME280 which is very different from the Adafruit implementation.
                      If that library blocks too long in one of its calls it might cause troubles.

                      http://yveaux.blogspot.nl

                      N 1 Reply Last reply
                      0
                      • YveauxY Yveaux

                        @NeoX Maybe not relevant, but that doesn't appear to be the Adafruit BME280, as you're including <bme280_mod-1022.h>. This headerfile appears to be part of this library: https://github.com/embeddedadventures/BME280 which is very different from the Adafruit implementation.
                        If that library blocks too long in one of its calls it might cause troubles.

                        N Offline
                        N Offline
                        NeoX
                        wrote on last edited by
                        #21

                        @Yveaux Hmm, interesting, since only one library i do find in Arduino IDE library manager as installed was this Adafruit.
                        But's should be fine

                        TRS-80T 1 Reply Last reply
                        0
                        • N NeoX

                          @Yveaux Hmm, interesting, since only one library i do find in Arduino IDE library manager as installed was this Adafruit.
                          But's should be fine

                          TRS-80T Offline
                          TRS-80T Offline
                          TRS-80
                          wrote on last edited by TRS-80
                          #22

                          @NeoX said in Arduino Mega + W5500 + BME280 = Connection refused all the time:

                          only one library i do find in Arduino IDE library manager

                          I started using PlatformIO recently, and I much prefer their way of searching libraries. When you do pio run it will even take the library.h file name that you are missing and give you a link to look it up in their library search. You can also search there for library name, or file names. Very handy!

                          Anyway, a bit offtopic for this thread, so recently I started another one where we can discuss PlatformIO (if you are interested).

                          @NeoX said in Arduino Mega + W5500 + BME280 = Connection refused all the time:

                          i switched to MQTT and it works fine, and i think MQTT client is more important for me

                          I rebuilt my gateway recently (few weeks ago) and this time I decided to go MQTT way. I actually have MQTT broker running on separate machine from my HA controller. Sort of distributed architecture, if you will. So far I am really liking this approach. Soon I will add some additional monitoring and metrics based directly off the MQTT, these will also be totally independent of the controller.

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


                          23

                          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