Skip to content
  • 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
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

ESP8266 WiFi gateway port for MySensors

Scheduled Pinned Locked Moved Development
328 Posts 56 Posters 309.6k 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.
  • YveauxY Yveaux

    @krajcl Does it only crash when sending this particular message?

    S Offline
    S Offline
    sdndba
    wrote on last edited by
    #241

    @Yveaux said:

    @krajcl Does it only crash when sending this particular message?

    It's late (early morning) I did not want to read over all the last three months posts so my question... is there a solution for this problem? I just downloaded the latest library and found the NodeMCU will reboot when a node initializes. Data below. Just point me to the solution if you would please. Thanks very much.

    0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.54
    3;1;1;0;0;21.54
    0;0;3;0;9;read: 3-3-0 s=2,c=1,t=38,pt=7,l=5,sg=0:3.44
    3;2;1;0;38;3.44
    0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.76
    3;1;1;0;0;21.76
    0;0;3;0;9;read: 3-3-0 s=2,c=1,t=38,pt=7,l=5,sg=0:3.44
    3;2;1;0;38;3.44
    0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.11
    1;1;1;0;0;21.11
    0;0;3;0;9;read: 1-1-0 s=2,c=1,t=38,pt=7,l=5,sg=0:3.44
    1;2;1;0;38;3.44
    0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.76
    3;1;1;0;0;21.76
    0;0;3;0;9;read: 3-3-0 s=2,c=1,t=38,pt=7,l=5,sg=0:3.44
    3;2;1;0;38;3.44
    0;0;3;0;9;read: 0-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.1
    0;255;0;0;17;1.5.1
    0;0;3;0;9;read: 0-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0

    Exception (28):
    epc1=0x40203911 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

    ctx: cont
    sp: 3ffefe50 end: 3fff00e0 offset: 01a0

    stack>>>
    3ffefff0: 3ffeef14 3ffeee8b 3ffeee84 402037d5
    3fff0000: 000000ff 00000003 00000006 00000001
    3fff0010: 00000001 00000000 3ffeeed8 00000030
    3fff0020: 00000000 3fffdc20 3ffef0ac 00000030
    3fff0030: 00000003 00000001 00000001 00000000
    3fff0040: 00000000 00000000 000000ff 00000023
    3fff0050: 00000006 40209ee1 3ffeee64 3ffeee64
    3fff0060: 00000000 00000000 3ffeee84 3ffeee84
    3fff0070: 3fffdc20 00000000 3ffef0a4 40202582
    3fff0080: 402020cc 3ffeee64 3fff1720 402051e6
    3fff0090: 00000000 00ffffff 0100000a 3ffef0ac
    3fff00a0: 00000000 00000000 00000016 40101941
    3fff00b0: 40205499 1100000a 00000000 3ffef0ac
    3fff00c0: 3fffdc20 00000000 3ffef0a4 402054c1
    3fff00d0: 00000000 00000000 3ffef0c0 40100114
    <<<stack<<<

    ets Jan 8 2013,rst cause:4, boot mode:(3,6)

    wdt reset
    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld

    ESP8266 MySensors Gateway
    Connecting to TESTNETWORK
    ....Connected!
    IP: 10.0.0.17
    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;9;read: 0-0-0 s=6,c=0,t=13,pt=0,l=0,sg=0:
    0;6;0;0;13;
    0;0;3;0;9;read: 0-0-0 s=1,c=1,t=16,pt=2,l=2,sg=0:0
    0;1;1;0;16;0
    0;0;3;0;9;read: 0-0-0 s=4,c=1,t=2,pt=2,l=2,sg=0:0
    0;4;1;0;2;0
    0;0;3;0;9;read: 0-0-0 s=5,c=1,t=2,pt=2,l=2,sg=0:0
    0;5;1;0;2;0
    0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.76
    3;1;1;0;0;21.76
    0;0;3;0;9;read: 3-3-0 s=2,c=1,t=38,pt=7,l=5,sg=0:3.44
    3;2;1;0;38;3.44
    0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.97
    3;1;1;0;0;21.97
    0;0;3;0;9;read: 3-3-0 s=2,c=1,t=38,pt=7,l=5,sg=0:3.44
    3;2;1;0;38;3.44

    1 Reply Last reply
    0
    • E Offline
      E Offline
      emc2
      Hardware Contributor
      wrote on last edited by
      #242

      @Yveaux
      Is there any specific reason on why CE is plugged on D2?
      I'm asking as I want to add a BME280 sensor directly on my gateway and by default the I2C bus is on D2/D1. It can be changed to any pin with Wire.begin(SDA,SCL) so it is not a major problem, but for user friendliness it would be nicer id CE was plugged on D9 or eventually D4 or D3.

      If there is no specific reason can I change MyConfig.h line 329 to #define MY_RF24_CE_PIN 3 safely?

      Thanks again for this gateway!

      YveauxY 1 Reply Last reply
      0
      • E emc2

        @Yveaux
        Is there any specific reason on why CE is plugged on D2?
        I'm asking as I want to add a BME280 sensor directly on my gateway and by default the I2C bus is on D2/D1. It can be changed to any pin with Wire.begin(SDA,SCL) so it is not a major problem, but for user friendliness it would be nicer id CE was plugged on D9 or eventually D4 or D3.

        If there is no specific reason can I change MyConfig.h line 329 to #define MY_RF24_CE_PIN 3 safely?

        Thanks again for this gateway!

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

        @emc2 said:

        Is there any specific reason on why CE is plugged on D2?

        Not that I know of.

        http://yveaux.blogspot.nl

        1 Reply Last reply
        0
        • E Offline
          E Offline
          emc2
          Hardware Contributor
          wrote on last edited by
          #244

          Switching it to D9 and adding #define MY_RF24_CE_PIN 3 directly to the program worked indeed.

          Now everything seems to work either by moving the I2C bus or the CE. It may be nice to officially free up the I2C port on the next versions of the library by default? It could be easier than to modify each I2C sensor or even display libraries individually.

          I will let it run a little while and if I don't see any major problem I will try to put the code in a new topic. Thanks for your fast answer @Yveaux !

          1 Reply Last reply
          0
          • rapzakR Offline
            rapzakR Offline
            rapzak
            wrote on last edited by rapzak
            #245

            Hi,

            I have added som support, where the gateway can upload data to emoncms, transparant to other functions (not fully testet):

            in gatewayutil add this in top of file, after the ARDUINO check:

            #define EMONCMS
            
            #ifdef EMONCMS
            static WiFiClient emon_client;
            const char* emon_host = "emoncms.org";  
            const int emon_httpPort = 80; 
            const int emon_addr_offset = 10;
            #endif
            

            Change this function to:

            void incomingMessage(const MyMessage &message) {
            //  if (mGetCommand(message) == C_PRESENTATION && inclusionMode) {
            //	gw.rxBlink(3);
            //   } else {
            //	gw.rxBlink(1);
            //   }
               // Pass along the message from sensors to serial line
               serial(PSTR("%d;%d;%d;%d;%d;%s\n"),message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type, message.getString(convBuf));
            #ifdef EMONCMS
                 if (!emon_client.connect(emon_host, emon_httpPort)) {
                  Serial.println("emoncms connection failed");
                  }
            
                  emon_client.print(String("GET /emoncms/input/post.json?&node="+ String(message.sender+emon_addr_offset)+"&json={"+String(message.sensor)+":"+message.getString(convBuf)+"}&apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"));
                  Serial.println(String("GET /emoncms/input/post.json?&node="+ String(message.sender+emon_addr_offset)+"&json={"+String(message.sensor)+":"+message.getString(convBuf)+"}&apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"));
            #endif
            } 
            

            It will upload data with NODE ID and Sensor ID from the network, with an offset of emon_addr_offset...

            /Rapzak

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

              hi.

              Has someone already thought about using websockets with wifiGW ??? before I start to reinvent the wheel!
              I have already made some tests with websockets but it was not with mysensors. it was not big tests too but I was able to have an html5 client with js. it was a simple test like blink led+serial monitor, receive/sending serial things. very simple!
              I did this because I would like to have sort of display on my phone even if there are no controller. and I don't want to use spiffs and webserver. I prefer to have the stuff on client side and esp8266 acting as a simple websocket server. More lightweight I think, to handle something more complex if needed...For the client, then it could be html+boostrap or something more hybrid. I am not expert at this but I should be able to make some poc..but I don't want to waste my time if it already exists! I have lot of other projects so I don't know how long it could take, and maybe someone is faster on this, so it depends..but it's a feature I would like to have in future and I will make it when needed :)

              So what do you think ??? dumb idea?

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

                Yeah, thought about it the other day and found this.

                https://github.com/Links2004/arduinoWebSockets

                Would have been fun to create something cloud.mysensors.org where people could share sensor data (and of course make it embeddable on the forum). Creating a websocket gateway-variant would probably be my first choice if I decide going down that path.

                It also seems to support wss which is kind of nice.

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

                  @hek : cool so you think it could be useful too.
                  yes I use this lib, nice features and simple to use.
                  so, even if someone has already done something, maybe I will dig a little for fun, time to time...

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

                    I haven't done anything yet. The old head is just constantly spinning ideas you know ;)

                    So please go ahead and see if you can create a MyGatewayTransportWebsocket.cpp

                    1 Reply Last reply
                    0
                    • ErrKE Offline
                      ErrKE Offline
                      ErrK
                      Plugin Developer
                      wrote on last edited by
                      #250

                      @scalz @hek you can look at socket.io if you are thinking of using websockets.

                      hekH scalzS 2 Replies Last reply
                      0
                      • ErrKE ErrK

                        @scalz @hek you can look at socket.io if you are thinking of using websockets.

                        hekH Offline
                        hekH Offline
                        hek
                        Admin
                        wrote on last edited by
                        #251

                        @ErrK said:

                        socket.io

                        Yep, use it on my dayjob. Allows downgrade to polling which (I guess) the Arduino library doesn't support. Might be better to use raw websocket on the server side in this case.

                        ErrKE 1 Reply Last reply
                        0
                        • ErrKE ErrK

                          @scalz @hek you can look at socket.io if you are thinking of using websockets.

                          scalzS Offline
                          scalzS Offline
                          scalz
                          Hardware Contributor
                          wrote on last edited by scalz
                          #252

                          @ErrK : yes I saw it too. but here a discussion about socket.io with esp websockets https://github.com/Links2004/arduinoWebSockets/issues/42
                          very interesting ;)

                          YveauxY 1 Reply Last reply
                          0
                          • scalzS scalz

                            @ErrK : yes I saw it too. but here a discussion about socket.io with esp websockets https://github.com/Links2004/arduinoWebSockets/issues/42
                            very interesting ;)

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

                            @scalz @hek a local server on the ESP serving gateway status overview (connected clients, routing table, sensors presented by clients, data etc) would be a very nice addition to any gateway IMHO.
                            The ESP has enough power/flash to implement this.

                            http://yveaux.blogspot.nl

                            1 Reply Last reply
                            0
                            • hekH hek

                              @ErrK said:

                              socket.io

                              Yep, use it on my dayjob. Allows downgrade to polling which (I guess) the Arduino library doesn't support. Might be better to use raw websocket on the server side in this case.

                              ErrKE Offline
                              ErrKE Offline
                              ErrK
                              Plugin Developer
                              wrote on last edited by
                              #254

                              @hek: Yes, it has fallbacks to use other protocols. I think there is a setting if you don't want to use all the default protocols.
                              @scalz: interesting discussion. It looks like the best way shuld be to only use the websockets :)

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

                                @Yveaux: exactly what I was thinking ;) for monitoring :) and it could be fun to be able to show something on the phone without a controller (for instance when I visit my not geek friends, it looks more simple if something on the phone instead of setting up a controller).
                                I started to look at dev branch last night but was too tired.... I visualize where are the changes to do, but maybe not all, I will ask you if I have some problems ;) A cool thing in websocket lib is broadcasting client is already implemented in it.

                                1 Reply Last reply
                                0
                                • A RA Offline
                                  A RA Offline
                                  A R
                                  wrote on last edited by
                                  #256

                                  Hi,
                                  I am working on a sensor system. Sensors feed to ESP8266 which feed to NodeMCU ESP8266. I saw in the intro to GatewayESP8266.ino on GitHub your code which says:

                                  • The EthernetGateway sends data received from sensors to the WiFi link.
                                  • The gateway also accepts input on ethernet interface, which is then sent out to the radio network.

                                  Does that mean Ethernet Gateway receiving data from WiFi?
                                  Thanking you in anticipation.
                                  Riaz Ahmed

                                  YveauxY 1 Reply Last reply
                                  0
                                  • A RA A R

                                    Hi,
                                    I am working on a sensor system. Sensors feed to ESP8266 which feed to NodeMCU ESP8266. I saw in the intro to GatewayESP8266.ino on GitHub your code which says:

                                    • The EthernetGateway sends data received from sensors to the WiFi link.
                                    • The gateway also accepts input on ethernet interface, which is then sent out to the radio network.

                                    Does that mean Ethernet Gateway receiving data from WiFi?
                                    Thanking you in anticipation.
                                    Riaz Ahmed

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

                                    @A-R said:

                                    Does that mean Ethernet Gateway receiving data from WiFi?

                                    As the topic indicates this is a WiFi gateway for mysensors. That means that it converts sensor data from the MySensors network to WiFi and vice versa.
                                    When sending data to a sensor, a controller will send data over WiFi to the gateway, which then sends the data on to a MySensors sensor (using nRF24L01+ or RFM69HW radio).
                                    Seen from the controller, it will communicate to the WiFi gateway exactly the same way as it would when connecting to a wired ethernet gateway.

                                    http://yveaux.blogspot.nl

                                    A RA 1 Reply Last reply
                                    0
                                    • YveauxY Yveaux

                                      @A-R said:

                                      Does that mean Ethernet Gateway receiving data from WiFi?

                                      As the topic indicates this is a WiFi gateway for mysensors. That means that it converts sensor data from the MySensors network to WiFi and vice versa.
                                      When sending data to a sensor, a controller will send data over WiFi to the gateway, which then sends the data on to a MySensors sensor (using nRF24L01+ or RFM69HW radio).
                                      Seen from the controller, it will communicate to the WiFi gateway exactly the same way as it would when connecting to a wired ethernet gateway.

                                      A RA Offline
                                      A RA Offline
                                      A R
                                      wrote on last edited by
                                      #258

                                      @Yveaux Thanks for the reply. Let me elaborate please. My sensor sends data to ESP8266 which sends it to NodeMCU ESP8266. From there I want the NodeMCU ESP8266 to send data through a wired Ethernet. (from there i want it be sent to a router).

                                      So my question is can the GatewayESP8266.ino be used to send data from NodeMCU to Ethernet?

                                      YveauxY 1 Reply Last reply
                                      0
                                      • A RA A R

                                        @Yveaux Thanks for the reply. Let me elaborate please. My sensor sends data to ESP8266 which sends it to NodeMCU ESP8266. From there I want the NodeMCU ESP8266 to send data through a wired Ethernet. (from there i want it be sent to a router).

                                        So my question is can the GatewayESP8266.ino be used to send data from NodeMCU to Ethernet?

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

                                        @A-R said:

                                        can the GatewayESP8266.ino be used to send data from NodeMCU to Ethernet?

                                        How do you plan to connect the wired ethernet to the NodeMCU board?
                                        You could probably connect a W5100 module through SPI, but why bother?

                                        http://yveaux.blogspot.nl

                                        A RA 1 Reply Last reply
                                        0
                                        • YveauxY Yveaux

                                          @A-R said:

                                          can the GatewayESP8266.ino be used to send data from NodeMCU to Ethernet?

                                          How do you plan to connect the wired ethernet to the NodeMCU board?
                                          You could probably connect a W5100 module through SPI, but why bother?

                                          A RA Offline
                                          A RA Offline
                                          A R
                                          wrote on last edited by
                                          #260

                                          @Yveaux I am using W5100. Its a system requirement. I want wifi connectivity with sensors through ESPs but the final data is to be routed through ethernet for security.

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


                                          9

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular