💎 Building an Ethernet Gateway



  • @Mitja-Blazinsek Is your problem solved now Mitja?
    connecting stand alone W5100 to ethernet should be solved by the delay i advised. I guess it should work with rfm69 if you set up the software SPI as described, but if you want to use hardware SPI a slight modification is necessary, which i described earlier



  • This post is deleted!


  • I am not sure where I went wrong the below code hangs half way through. I am using ENC28J60
    https://www.aliexpress.com/item/Mini-ENC28J60-Webserver-module-Ethernet-Shield-board-for-Arduino-Nano-v3-0/2037927977.html?spm=2114.40010208.4.8.mUp9p8

    #ifndef config_h
    #define config_h
    #include <stdint.h>
    
    /**********************************
       MySensors configuration
    **********************************/
    //#define MY_BAUD_RATE 9600
    #define MY_DEBUG
    //#define MY_BAUD_RATE 38400
    //#define MY_BAUD_RATE 115200
    //#define MY_NODE_ID 100
    
    #define MY_RADIO_NRF24
    
    // Enable gateway ethernet module type
    #define MY_GATEWAY_ENC28J60
    //#define MY_GATEWAY_W5100
    // Enabled repeater feature for this node
    //#define MY_REPEATER_FEATURE
    
    
    // Enable Soft SPI for NRF radio (note different radio wiring is required)
    // The ENC28J60 ethernet module seems to have a hard time co-operate with
    // radio on the same spi bus.
    #define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN 14
    #define MY_SOFT_SPI_MISO_PIN 16
    #define MY_SOFT_SPI_MOSI_PIN 15
    
    
    // When ENC28J60 is connected we have to move CE/CSN pins for NRF radio
    #ifndef MY_RF24_CE_PIN
    #define MY_RF24_CE_PIN 5
    #endif
    #ifndef MY_RF24_CS_PIN
    #define MY_RF24_CS_PIN 6
    #endif
    
    
    // Gateway IP address
    #define MY_IP_ADDRESS 192,168,0,66
    
    // The port to keep open on node server mode / or port to contact in client mode
    #define MY_PORT 5003
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 55
    
    // The MAC address can be anything you want but should be unique on your network.
    // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
    // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xFE
    
    // Flash leds on rx/tx/err
    //#define MY_LEDS_BLINKING_FEATURE
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    #define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  9  // the PCB, on board LED
    
    
    
    //#define MY_DISABLED_SERIAL
    
    
    // Turn off debug if serial pins is used for other stuff
    #ifdef MY_DISABLED_SERIAL
    #undef MY_DEBUG
    #endif
    
    
    /**********************************
    *  Gateway config
    ***********************************/
    
    /**
     * @def MY_GATEWAY_MAX_RECEIVE_LENGTH
     * @brief Max buffersize needed for messages coming from controller.
     */
    #ifndef MY_GATEWAY_MAX_RECEIVE_LENGTH
    #define MY_GATEWAY_MAX_RECEIVE_LENGTH (100u)
    #endif
    
    
    /**
     * @def MY_GATEWAY_MAX_SEND_LENGTH
     * @brief Max buffer size when sending messages.
     */
    #ifndef MY_GATEWAY_MAX_SEND_LENGTH
    #define MY_GATEWAY_MAX_SEND_LENGTH (120u)
    #endif
    
    /**
     * @def MY_GATEWAY_MAX_CLIENTS
     * @brief Max number of parallel clients (sever mode).
     */
    #ifndef MY_GATEWAY_MAX_CLIENTS
    #define MY_GATEWAY_MAX_CLIENTS (1u)
    #endif
    
    
    /**
    * @def MY_RX_MESSAGE_BUFFER_FEATURE
    * @brief This enabled the receiving buffer feature.
    *
    * This feature is currently not supported for RFM69 and RS485, for RF24 MY_RF24_IRQ_PIN has to be defined.
    */
    //#define MY_RX_MESSAGE_BUFFER_FEATURE
    
    /**
     * @def MY_RX_MESSAGE_BUFFER_SIZE
     * @brief Declare the amount of incoming messages that can be buffered.
     */
    #ifdef MY_RX_MESSAGE_BUFFER_FEATURE
    #ifndef MY_RX_MESSAGE_BUFFER_SIZE
    #define MY_RX_MESSAGE_BUFFER_SIZE  (20)
    #endif
    #endif
    
    /**
     * @def MY_RF24_PA_LEVEL
     * @brief Default RF24 PA level. Override in sketch if needed.
     */
    #ifndef MY_RF24_PA_LEVEL
    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    #endif
    
    /**
     * @def MY_RF24_CHANNEL
     * @brief RF channel for the sensor net, 0-125.
     * Frequence: 2400 Mhz - 2525 Mhz Channels: 126
     * http://www.mysensors.org/radio/nRF24L01Plus.pdf
     * 0 => 2400 Mhz (RF24 channel 1)
     * 1 => 2401 Mhz (RF24 channel 2)
     * 76 => 2476 Mhz (RF24 channel 77)
     * 83 => 2483 Mhz (RF24 channel 84)
     * 124 => 2524 Mhz (RF24 channel 125)
     * 125 => 2525 Mhz (RF24 channel 126)
     * In some countries there might be limitations, in Germany for example only the range 2400,0 - 2483,5 Mhz is allowed
     * http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
     */
    #ifndef MY_RF24_CHANNEL
    #define MY_RF24_CHANNEL  76
    #endif
    
    /**
     * @def MY_RF24_DATARATE
     * @brief RF24 datarate (RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps or RF24_2MBPS for 2Mbps).
     */
    #ifndef MY_RF24_DATARATE
    #define MY_RF24_DATARATE RF24_250KBPS
    #endif
    
    
    #endif
    
    
    
    #include "config.h"
    
    
    #include <SPI.h>
    #include <UIPEthernet.h>
    #include <MySensors.h>
    
    void setup() {
    }
    void loop() {
    }
    

    Output:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    IP: 192.168.0.66
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;Eth: connect
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 0;0;3;0;2;Get Version
    0;255;3;0;9;Eth: 0;0;3;0;18;PING
    0;255;3;0;9;TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=1
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    
    

    ketch uses 26,232 bytes (85%) of program storage space. Maximum is 30,720 bytes.
    Global variables use 1,286 bytes (62%) of dynamic memory, leaving 762 bytes for local variables. Maximum is 2,048 bytes.


  • Mod

    sorry, but that is not the complete code.



  • @hiddenuser That is too bad.
    I must say I find your sketch somewhat confusing. What is the purpose of the ifndef confif_h followed by a config_h?

    your config.h seems to just define the configuration. Why not just do an #include "config.h"
    The large amount of ifdefs make the sketch a little bit hard to read.
    If you are a beginner (we all have been) and make a sketch primarily for yourself, many of those ifdes are not really necessary and at least you are not losing track.
    Anyway, not trying to criticize you, but error tracking also for yrself would be easier.
    Also... you are using a soft SPI. For the ENC28J60 that is not really necessary. (not necessary for w5100 either with a little adaptation).
    So... I am afraid that at this point I cant say anything sensible about yr sketch, but I can say the ENC28J60 works, even with a shared SPI bus.
    Have you tried a working W5100 sketch with simply changing Ethernet.h into UIPEthernet.h?



  • @Ed1500 Thanks for you feedback. I have switched over to using W5100. However I have noticed that for some reason I am missing a data which is sent over nrf24. The gaps in the data are random and I can't seem to figure out why this is happening. BTW I am using domoticz on a pi to get the data. Initially I was using mysensor over usb to get the data and used to work fine. In order to get the update OTA I am trying to switch to ethernet Gateway and does not seem to work 😞

    //#define MY_DEBUG
    
    #define MY_RADIO_NRF24
    #define MY_GATEWAY_W5100
    
    #define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN 14
    #define MY_SOFT_SPI_MISO_PIN 16
    #define MY_SOFT_SPI_MOSI_PIN 15
    
    #define MY_RF24_CE_PIN 5
    #define MY_RF24_CS_PIN 6
    
    
    #define MY_IP_ADDRESS 192,168,0,66   // If this is disabled, DHCP is used to retrieve address
    #define MY_PORT 5003
    
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
    
    
    #define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  7  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  7  // Transmit led pin
    
    
    #include <Ethernet.h>
    #include <MySensors.h>
    
    
    void setup(){
      delay(10000);
    }
    
    void loop(){
    }
    ``

  • Mod

    Are you running domoticz on a raspberry? If so, you could skip the arduino and connect the radio on the rpi directly.



  • @hiddenuser Your code seems OK apart from the fact it doesnt seem to do anything. Randomly missing data when using an nrf24 could be due to data just not arriving over the link although with shot distance that is rare. Nevertheless you could disconnect the w5100 and check a serial.print for a while to see if data is still missing.
    I dont have much experience using the soft spi, only using hardware SPI. You may want to consider Gohan' s suggestion



  • @Ed1500 @gohan Thanks. I am trying to create an ehternet gateway so I can do OTAs.



  • @hiddenuser I understand. Not sure if that is possible through a W5100/arduino, I guess it is but might not be easy 🙂


  • Mod

    Ethernet gateway works either way, it is only a matter of personal taste. Personally I did go for the raspberry gw because I have less stuff around and I save an arduino board.



  • Hi everyone,
    Is it possible to build an ethernet gateway with a RFM69 radio module?
    Because I tried this a while ago and that didn't work because of a software problem in the library's. Is that already solved or not?
    Thanks!


  • Mod

    With development branch it should be solved, but I still have to try



  • @Jonathan-Caes I did, with an RFM69HW an arduino pro mini and a funduino Ethernetmodule. Used the setup from computourist in github https://github.com/computourist/RFM69-MQTT-client



  • hello @Ed1500, i have the same problem as @Mitja-Blazinsek. i have a w5100 module (funduino), arduino pro mini and nrf24 radio. i try to use your tip, including a delay in setup() but it doen't work yet, the gateway isn't reached using ping. is necesary another change? did you move the setup() function in the program? thanks!!



  • @Toni-Ramos Sorry to hear that. Are you using Soft SPI or hardware SPI for both?
    Can you get any connection if you just use it as webserver without the NRF24?



  • @Ed1500 i'm using softSPI as the example. I can see ping works correctly if i comment "#define MY_RADIO_NRF24". If not, the gateway shows the following messages continuosly:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=1
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT



  • @Ed1500 after tests with different versions of the library i discovered a bad welded pin in the nrf24. It seens to work fine now,i'll conect a node to the gateway and check all



  • @Toni-Ramos Glad you got it solved. apologies I had not seen yr earlier reply yet, but thats no longer relevant.
    Always good to check the joints 🙂


  • Mod

    What is the best way to make the gateway wait for ip address (it's set to use dhcp) when power goes down? I noticed that the gateway starts faster than the router and doesn't get the ip address so I had to push the reset button to get it to work.


  • Mod

    @gohan maybe add a wait call in before()? Not sure if before() is run early enough, but it might be worth a try.

    Maybe the library can be modified to try for a longer time before giving up.


  • Mod

    Maybe I could make a check if there is no client connected I could reset the board, but I was wondering if there is any was to know if the system has a valid ip



  • hi after long time i finaly get new w5100 module now the test sketch from arduino ide for ethernet like web server are working fine bur still don't work as a gateway in domoticz or mycontroler. i just open example gatewayw5100 from my sensor libary and upload to mega bard bit status in my controler is always down af course i set the gateway in my controler :Enabled
    Enabled
    Type
    Ethernet
    Network type
    MySensors
    Connection details
    Host:192.168.178.66, Port:5003
    Status
    Down
    Status since
    7 minutes ago
    Status message
    ERROR: connect timed out


  • Mod

    Can you ping that ip? There are some faulty w5100 modules around and I did repair one by adding a couple of 100 ohms resistors on the ethernet pins.


  • Mod

    @Mitja-Blazinsek is your local network using the same subnet (192.168.178)? What is the ip and netmask of your controller?



  • my network is using 192.168.0 but i try to change the MY_IP_ADDRESS to 192.168.0.66 but still no responese. i dont know what is the ip of mycontroler it works only when ia write localhost:8443 i of domoticz was 127.0.0.1



  • ok ip of mycontroler is 192.168.0.100



  • is it maybe problem because i'm using mega board an i wired 50 51 52 pins but if i wired 11 12 13 like on the diagram here it not working the shield if i try dhcp address printer for test


  • Mod

    You probably have faulty network shield



  • Sorry, but can't find any information about my problem about the gateaway.
    For connecting a lot of binary switches etc. i took a mega and loaded a gateaway sketch from Mihai . Normally it runs very good, when i change the status flags from ON/Off to 1/0 (Don't know why?)
    But now i had the idea, to disable the radio, because I don't need it for this mega.
    Now the relais-switches do no longer work as before. They only work from time to time and rather randomly.
    I want to switch and contol the switches with iOBroker, but without the radion connected and activated, it doesn't run.
    Any idea?


  • Mod

    @jopebe did you remove the define for the radio from your sketch?
    What does the debug output say?



  • Thank You for Your quick respons!
    Yes, i made two slashes before the define-line of the radio .
    I have no debug-output because I didnt engage myself in debugging until now. I will try it this evening. During the day Im engaged in other things.



  • Here thr output of the seriel monitor:
    0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
    IP: 192.168.178.134
    0;255;3;0;9;Eth: connect
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
    0;255;3;0;9;Eth: 0;101;1;0;2;1
    0;255;3;0;9;Eth: 0;101;1;0;2;0
    0;255;3;0;9;Eth: 0;101;1;0;2;1
    0;255;3;0;9;Eth: 0;101;1;0;2;0
    0;255;3;0;9;Eth: 0;101;1;0;2;1
    0;255;3;0;9;Eth: 0;101;1;0;2;0
    0;255;3;0;9;Eth: 0;101;1;0;2;1
    0;255;3;0;9;Eth: 0;101;1;0;2;0
    0;255;3;0;9;Eth: 0;101;1;0;2;0
    0;255;3;0;9;Eth: 0;101;1;0;2;1
    When I push the button in IoBroker-Vis, it takes often a lot of time until the LED is on; sometimes I have to push the button twice or more times; sometimes nothing happens at all.
    When I define and connect the radio with the same sketch, it runs as expected.


  • Hero Member

    @jopebe are the relays and switches locally attached to the GW? Please post your sketch



  • @scalz A very late reply, but someone else might be helped with it.
    Hardware SPI is working.
    The onnly thing is that on W5100 shield it will work without any problem but with most 5100 modules you need a small modification fixing w5100 problems



  • @fifo Most W5100 modules have a 5-3.3V regulator so if you connect the Vcc to 3V3 the chip just doesnt get enough juice



  • I dont know, how to send my sketch as a file. Copy and past doesnt run.
    I use an ethernet-shield and as I mentioned, when I connect and switch on the radio, everything is alrigth.



  • Thank You to all, who tried to help.
    I think, I found the solution:
    There was this line in the sketch: "const unsigned long tUpdate=60000; //update interval"
    When I changed the time to 6000, it runs as when as the radio was connected.
    So it was probably missing some kind of "interrupt", which usually comes from the radio , when it listens to the nodes or so?



  • hi everyone,

    has the pin setup changed? it looks like it has from the sketch. I used a0, a1 and a2 for the radio.


  • Mod

    @Newzwaver Which sketch do you mean? The build page is still using a0, a1, a2 for W5100.



  • Ok, I screwed up and downloaded the latest arduino software 1.8.3 and can't get my libraries to work correctly. I am trying to upgrade my sensors to 2.1.1 and rebuild my gateway using a new nano I put together. I am using the5100 connection with the radio wired to a0..... It the 1.8.3 not to be used for the overseas board?



  • I have just built a W5100 based Ethernet gateway using a pro mini, NRF24LR and I enabled Soft Signinig - using the latest mysensors github development version 2.2.0-beta I am getting Low on memory messages when I compile and load this - if I disable Signing it does not complain. I have noticed several random crashes with signing enabled however i have secure nodes so need singing support. Is there something I am doing wrong or is the latest dev image causing this to occur. I have Debugging all disabled and burning to a stock 5V 16Mhz device.

    Sketch uses 25476 bytes (82%) of program storage space. Maximum is 30720 bytes.
    Global variables use 1648 bytes (80%) of dynamic memory, leaving 400 bytes for local variables. Maximum is 2048 bytes.
    Low memory available, stability problems may occur.


  • Mod

    @itbeyond you'll need to find a way to save flash and ram, or use a microcontroller that has more flash and ram.


  • Mod

    @itbeyond you could use a Mega 2560 or use a raspberry pi as gateway (if you already have one)



  • @mfalkvidd I this just how it is going to be on W5100 if we enable signing support - we must use a different chip? The Ethernet Gateway has nothing but the basic sketch with LED's enabled and soft signing.


  • Mod

    @itbeyond probably. I guess the w5100 library uses a lot of ram and flash. The crypto for software signing uses a lot as well.


  • Contest Winner

    Atmga328p is not suitable as a gateway if you want ethernet and security. It simply does not have enough storage.



  • @Anticimex I do agree. It CAN be used, but it is just a bad choice as the ethernet libraries do not leave much space for much else.
    ENC28J60 in that aspect is worse than the W5100.
    I tried it more like a proof of concept and it does work pretty well just passing data, but I put everything on an ESP8266. OK, WiFi rather than Ethernet but thats OK for me


  • Contest Winner

    @Ed1500 I run a gateway on a nano with all security features. But it runs as a serial gateway.



  • @mfalkvidd, @Anticimex & @Ed1500,

    Thanks I have ordered a Mega 2560 to use as the gateway. I think it would be super helpful to have the specs better identified in the main topic of the Building and Ethernet Gateway (and other Gateway pages) page - maybe a table with suitable controllers for the most common configurations. It would have saved me the hassle and I am sue I will not be the first to run into this. I too was using a 328p with security via serial and did not even think I would have a problem with memory when converting the Ethernet.


  • Mod

    In principle it is the same everywhere: the more libraries you add, the more memory you use as it is like you are writing a longer code. It's the basic of programming and arduino ide is reporting how much memory a sketch uses, so you can see yourself how much more memory is used when you add extra libraries.



  • @gohan yes I understand perfectly I am a developer and have over 30 years coding experience in about 20 languages. What I find difficult is that there is no detail or documentation on library resource usage so one cannot predetermine the resource requirements when a library or piece of hardware is used. In this great site we have a statement at the top (first sentance) of the Ethernet Gateway page that states "You can build an Ethernet gateway using almost any Arduino model." Well this is not exactly true because if you want to enable some of the library features (ie: signing, and lets face it you should have this enabled if you have any locks or garage doors etc) you will run out of memory in the general models. I am not complaining I just think something so simple should be documented to help other uses look at the right equipment from the outset. In fact all that needs to be written in the first sentence is something as simple as "You can build and Ethernet gateway using almost any Ardunio model however as the Ethernet library uses more resources it would be best to look at a micro controller with greater than 2kb or ram so we recommend a Mega 2560 or similar if you intend to enabled signing or whitelist support."


  • Mod

    @itbeyond or if you add external libraries, or if you use debug, or if you change radio, or if, in the future, any of the used libraries increase in size, but not if, in the future, one or more of the included libraries result in smaller flash or ram usage because then it might work. Or if the Arduino IDE changes the compiler flags, thereby affecting the size - either up or down, or if gcc is in a future release changed so code size is affected.

    As a programmer, I'm sure you understand that the number of variations increase exponentially, and most of the variables are not under control of the MySensors library.

    I agree that a message or table would be nice. I just don't see how it would be feasible to construct and maintain it.


  • Mod

    @itbeyond said in 💎 Building an Ethernet Gateway:

    "You can build an Ethernet gateway using almost any Arduino model."

    I believe that "almost" is the right word, since in fact the basic Ethernet gateway can run on many devices but as the requirements increase you need to step up the HW, I don't see it as a big problem: just as you need more IO pins then a standard UNO you go to a Mega2560.



  • I give up - at least if someone is thinking of building this gateway and wanting to use security they can hopefully read this thread before they start and will look at a higher level controller before they purchase the hardware. I am only trying to help others with what to me is still a simple and easy fix alas I must have upset the apple cart.

    There is no big problem at all, just that it is really simple to know right now, with technology available today, if you need an Ethernet gateway and signing then use a Mega 2560 or better for the Ethernet Gateway controller to ensure you have the ram. @mfalkvidd - You state variations increase exponentially and most not under library control however using the MySensors Library and building the hardware shown and documented on this page using the sketch provided (completely under control of MySensors) you will need a Mega 2560 or better if you intend to enable signing (also under control of the Library). Do not get me wrong I really love the whole MySensors thing and have over 30 devices up and running and have enjoyed the whole learning thing however simple requirements (IMHO) like this should be detailed.

    Hopefully this post will help the next person, it certainly would have help me and I am sure I am not the only one.


  • Contest Winner

    @itbeyond signing is a completely optional feature of the library. One part of a great many optional features. It is a delicate tradeoff of providing detailed instruction and keeping documentation at a level where users actually care about reading it.



  • Hallo,
    I`m running this ethernet-gateway with w5100 shield on uno.
    In the log of iobroker I always see this message again and again:
    mysensors.0 2018-01-26 11:10:58.942 error Error for "192.168.178.133": Error: read ECONNRESET
    mysensors.0 2018-01-26 11:10:55.105 info Received INTERNAL message: I_GATEWAY_READY: Gateway startup complete.
    mysensors.0 2018-01-26 11:10:55.103 warn ID not found. Inclusion mode OFF: {"id":"0","childId":"255","type":"presentation","ack":false,"payload":"2.1.1","subType":"S_ARDUINO_RELAY"}
    mysensors.0 2018-01-26 11:10:55.094 info Connected 192.168.178.133:49153
    mysensors.0 2018-01-26 11:10:54.897 error Error for "192.168.178.133": Error: read ECONNRESET
    I cannot find a solution in the forum of iobroker and also nothing about it in this forum.
    By the way: In the list of objects in iobroker there is always a child id 255 without any state or value.
    Is it an issue ?
    Perhaps of iobroker?
    Any solution?


  • Mod

    Look at the gateway log and see if you get any error



  • Here the log from debug:
    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    IP: 192.168.178.133
    0;255;3;0;9;Eth: connect
    0;255;3;0;9;MCO:BGN:STP
    Can`t find any error.
    From here only reading nodes.


  • Mod

    Can you try with latest mysensors 2.2?



  • I did.
    Error comes once, than for minutes no error. And now the error disappeared out of the log.
    I don`t understand .
    Thank you for the hint.


  • Mod

    So did you solved the problem?



  • Hello, all. Nuuubeee here, though been doing MUCH reading/studying. I had previously (before stumbling upon this site) decided to go with MRF69HWs. I see that the code can be un-commented for this radio, but having difficulty with pinouts and mismatching pin anmes: the RFMs (appear) to have no corresponding pins to the NRFs CE and CSN pins. The MRF uses NSS and D100 pins, not labeled as such on the NRF. Same use with different labels? I've poked around looking for hints and tips about wiring the MRFs to work with the W5100, though so far, haven't found what (I think ) I need.

    Thanx!


  • Mod

    @flyyboyy hi and welcome to the forum!

    Is this what you need?



  • Have seen and studied that, though at the top of this page it mentions some necessary changes for use with the W5100:
    "The W5100 ethernet module has problems sharing SPI with radio. To solve this, we put the radio on a couple of other pins and use so called soft-spi. That's why you have to wire the radio a little differently here than on the usual sensors. "
    I assume that for this reason the link you replied with would not work. Some times I get into trouble assuming things; if those connections work for the gateway, I guess I'm good to go (and just didn't realize it).
    Thanx



  • I did look a little closer to the page you referenced and noticed your pin "color coding" was identical between the two radios, even though those two pin names were different. Would it be safe to interpolate those same "color codes" between the radio and the Arduino (using Pro Mini) even though the pin names are different?


  • Mod

    Thanks for clarifying @flyyboyy
    The following are used for SPI:
    NSS (also called SĖ…SĖ…, SSEL, CS, CĖ…SĖ…, CE, nSS, /SS, SS# according to wikipedia)
    SCK
    MOSI
    MISO

    and yes, I think they use the same colors on the nrf and rfm instructions. But I am not sure about CE vs CSN on the nrf24.

    I have updated the table for w5100 to include the NSS naming.



  • I created a case for this gateway.
    https://www.thingiverse.com/thing:2923130



  • OK, who's up for a WHOLE LOTTA handholding? Dang, guess I'm getting denser the older I get.
    Is this page the place to solicit help, or should I start a new topic in the forum? I searched there for answers to my yet-unstated questions but found nothing. Guess I am the only one that doesn't get it. . .
    TIA for any takers

    flyy



  • By the way, the questions at this point relate directly to the Ethernet Gateway -- that's why I was asking if this page was the proper place to ask


  • Mod

    @flyyboyy here or in a new thread doesn't matter that much - as long as you don't post the same thing in multiple places.

    https://forum.mysensors.org/category/5/troubleshooting is a good category for troubleshooting

    The post at the top of that page lists the most common problems, how to troubleshoot them, and what information is usually required to help so you can get help as quick as possible.



  • I kinda expected that it should go into the forum; I posted it in the General Discussion category, then even missed indicating I was looking for help -- it's simply titled "Ethernet Gateway." Oh, well. . .

    Thanks



  • WizNET W5500 Ethernet module

    For your information.
    A W5500 module can also be used. The wiring is the same as for the W5100 module (with A0, A1, A2). The Arduino code must be changed in two places:

    1. use as Ethernet module type
      #define MY_GATEWAY_ENC28J60

    2. #include <Ethernet2.h> instead of #include <Ethernet.h>



  • Thanks @bazzoka, you are right, it works the way you said 🙂



  • @bazzoka and @Chris83:

    The newest version of the standard Arduino Ethernet (2.0.0) now has built-in support for the W5500 (in addition to W5200 and W5100) modules.
    This eliminates the need to pull in the Ethernet2 library and change the sketch code to build an Ethernet Gateway with the newer/cheaper/better W5500 modules.
    Supposedly it also has some substantial performance improvements as well (see here: https://www.pjrc.com/arduino-ethernet-library-2-0-0/).
    The only downside I have run across so far is the increased progmem flash size that makes the sketch about 2.8 KB larger.



  • Hi
    I try building gateway on my Arduino Mega and i defined this:
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 13, 252

    This is ip my Controller on RPI4 with installed Hassos(Home Assistant). But when it is defined i can not controll my relay on gateway. When delete this define all works ok and i can controll relay from home assistant. Please help me... I want define it to block controll only from one device in my network(controller automation Home Assistant).



  • i built the ethernet gateway with the ENC28J60 module, arduino nano v3.0 and RF24 radio, using this guide and there are three problems which i'm not being able to solve (i used the https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/UIPEthernet, as suggested).

    • fixed ip, connected to power supply, ethernet cable and usb - ping works, but HA does not "sees"
    • fixed ip, connected to power supply, ethernet cable but no usb - ping does not works ????
    • commented ip definition, to enable dchp - does not work.
      seams the instructions are outdated -
      i really need help to make it work.
      thx

Log in to reply
 

Suggested Topics

  • 3
  • 109
  • 10
  • 584
  • 2
  • 5

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts