Ethernet Gateway ....i am lost



  • I am also trying to build the ethernet gateway. I already have built a sensor (humidity and temp sensor) which is working and tested it with the serial gateway. For the gateway I am using a ardruino nano and a W5100 Ethernet module. (arduino 1.8.2 and board 1.6.11)

    The trouble i am having is getting a valid IP-number. In my scetch (it is the default scetch from the mysensors page for the gateway) i defined the following IP

    #define MY_IP_ADDRESS 192,168,1,108   // If this is disabled, DHCP is used to retrieve address
    

    When i start my scetch, i am see the following information in the serial monitor:

    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: 0.168.1.108
    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: disconnect
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:19.0
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:72.0
    0;255;3;0;9;Eth: connect
    0;255;3;0;9;Eth: disconnect
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=0,c=1,t=1,pt=7,l=5,sg=0:71.0
    

    as you can see the IP address is not correct, but it is receiving information from my temp/humidity sensor. Each time i reset the arduino i am getting a different value. Sometimes a part of my IP-address and sometimes just zeroes. In the page of my router with connected devices, i see sometimes new device with strange IP and part of de MAC-address.

    does anyone have an idea?


  • Plugin Developer

    @Mister_ik As you have the router, why don't you try with DHCP and lock an IP on Router for this gateway?
    Other solution you may go with MQTT gateway.



  • Probably a stupid question, but thought I'd chime in... Since you don't show it above, are you also #define'ing a MAC address (like below)... Is the MAC address unique on your network? I've seen very odd things happen with duplicate MACs.

    // 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, 0xED
    

  • Mod

    You could also try other sketches that use w5100 module and see what they do, but try dhcp first.



  • @jkandasa I already tried to lock an IP address on the router, but that does not change anything



  • @stevebus Yes the MAC address is also defined and i tried already different MAC address, so i know for sure it cant be a duplicate MAC address


  • Mod

    Could be a faulty module... Who knows... Did you try a different ethernet library version?



  • @gohan i am also affraid of a faulty module.....i am already waiting for new one to arrrive. i ordered now a ESP8266 version..hopefully more luck with that one.



  • I had the problem you describe, an ip address which was not the one it should be, usually a different one after each reset, sometimes with parts of the address recognisable as parts of the one I was expecting.

    I too tried a different W5100 module, different arduino, different connecting wires. No better.

    Then I found the answer, which was to supply the W5100 with 3.3v rather than the 5v I had been using. This fixed the problem completely.

    It is very odd that supplying the module with 5v stops it working properly, I can't explain it. It has an onboard AMS117 to convert the supply voltage to the 3.3v the chip needs.

    Whatever the reason though, it does fix the problem. I have two W5100 modules and neither will work properly if supplied with 5v. Both work perfectly on 3.3v.

    I see the instructions for the Mysensors ethernet gateway show the module supplied with 3.3v so I guess when I thought I knew better I was wrong!

    Hope this helps.


Log in to reply
 

Suggested Topics

61
Online

11.4k
Users

11.1k
Topics

112.6k
Posts