New Gateway - Can't get it to work



  • I have been using my Arduino's in a sensor network but not with MySensors so I thought I would standardize my setup to something well supported and with a community rather then the one off stuff I have.

    Arduino Uno with the Wiznet ethernet shield attached. I use RFM69 at 915Mhz for my local radio for sensor to sensor communications.

    I have tried both the codebenders method and my local IDE to build the ethernet gateway but neither seem to be working well. I made the appropriate changes in MyConfig.h, like DEBUG on, speed of the serial port, the details relating to the RFM69.

    Followed the directions at the beginning of the sketch to configure things. Upload the sketch and monitor the serial but I get no output from it whatsoever. What could I be doing wrong? I can ping the device via another to the IP assigned to it, but telnet to port 5003 fails.

    I even added an output statement during ethernet setup to see if that was working and nothing gets outputted either.

    It could be related to my RFM69 - one that isn't clear is what digital pins should be configured for it. Is that posted some place? Right now I use d6 and d2.

    Any suggestions would be appreciated!

    Norm


  • Hardware Contributor

    Hello.

    For rfm69 connection : https://www.mysensors.org/build/connect_radio (don't forget that rfm69 is not 5v tolerant)
    and for ethernet part : https://www.mysensors.org/build/ethernet_gateway
    if you want to tune a bit things, look at myconfig.h
    You should have things in your serial monitor, even if the radio is not well connected that shoud tell it.
    I hope this helps a bit :)
    If you don't find where your problem is, please post your GW sketch and changes made at other place, so people would be able to help you.



  • Ok that web address for the wiring certainly helped (pin 10 was what I needed there). I'm getting output now saying gateway started but it doesn't seem to be listening on port 5003. I can ping the IP but not telnet to port 5003.


  • Mod

    Just a check: If you power off the gateway, do the ping responses stop? Just to make sure you're pinging the correct address and that there is no other device using the same IP (this has happened to several users).



  • Good suggestion but yes, I have. Pings stop after pulling out the cable.
    I have grabbed one of my sensor nodes (temp/humidity) and put it on the mySensors sketch from the example. Question on that though, how does it know what radio to use? No where is it defined in those sample sketches.

    I will post my sketch and the changes I've made to other files so you guys can get a complete picture.



  • My gateway sketch:
    0_1466189155349_MyEthernetGateway.ino

    I also make changes to the following files:

    MyConfig.h:
    #define DEBUG

    /**********************************

    • RFM69 Driver Defaults
      ***********************************/
      // Default network id. Use the same for all nodes that will talk to each other
      #define RFM69_NETWORKID 100

    // Default frequency to use. This must match the hardware version of the RFM69 radio (uncomment one):
    // #define RFM69_FREQUENCY RF69_433MHZ
    //#define RFM69_FREQUENCY RF69_868MHZ
    #define RFM69_FREQUENCY RF69_915MHZ

    // Enable this for encryption of packets
    //#define RFM69_ENABLE_ENCRYPTION
    #define RFM69_ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!

    The line for the 915Mhz only called it FREQUENCY so changed it to match the entries above it, assuming it is correct.

    MyTransportRFM69.h:
    class MyTransportRFM69 : public MyTransport
    {
    public:
    MyTransportRFM69(uint8_t freqBand=RFM69_FREQUENCY, uint8_t networkId=RFM69_NETWORKID, uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=true, uint8_t interruptNum=RF69_IRQ_NUM);

    This change was to identify my radio as an RFM69HW.



  • I have partial success getting my RFM69 radios working. I had to make the following changes:
    MySensor.h

    Change: #include "MyTransportNRF24.h" to #include "MyTransportRFM69.h"
    Change line 158 from
    MySensor(MyTransport &radio =*new MyTransportNRF24(), MyHw &hw=*new MyHwDriver()
    to
    MySensor(MyTransport &radio =*new MyTransportRFM69(), MyHw &hw=*new MyHwDriver()

    Sensor side I get:
    sensor started, id=255, parent=0, distance=1
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    T: 28.00
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    H: 33.00
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    T: 29.00
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    T: 28.00
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    H: 32.00

    While Gateway side I get:
    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;9;read and forward: 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:

    0;0;3;0;9;send: 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,st=bc:0
    0;0;3;0;5;1
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;

    I'm not sure what the st=fail means in the sensor debug?

    Also I still do not have the gateway listening on port 5003. Still trying to decipher that. I wanted to try and isolate the fault and make sure the radio part was working.


  • Mod

    st=fail means the radio message was not received by the receiver.

    See https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help for details on how to read the debug log



  • Ok, figured it out and got the gateway working. The issue is with the RFM69 and the Wiznet Ethernet shield you cannot use pin 10 for the cs on the RFM69. I used pin 7 since I don't use the LED's.
    Add the following to your MyConfig.h
    #define RF69_SPI_CS 7

    and everything should work. Onwards to building the sensors now!



  • Well... almost. Things are talking but not quite. The gateway never seems to send a ID to the sensor node?

    On the sensor node:
    ensor started, id=255, parent=0, distance=1
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id

    On the Gateway Node:
    0;0;3;0;5;1
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;

    So it looks to be sending a request, but the gateway isn't returning an id. The sensor node is a humidity node, exactly as provided in the example, other then adding: MyTransportRFM69 transport;


  • Plugin Developer

    @Norm-Dressler

    You need a controller that can provide ids connected to the gateway.



  • Ok, my newbie is showing. I have home assistant configured just didn't know I had to have it connected before it would work. Will try that.



  • The Ethernet gateway was just too unstable for me and I couldn't get any inclusions. I switched it for a serial gateway and its all working great now. I have a single sensor that is sending data to my House Assistant install.



  • @martinhjelmare

    Thank you!!!! I was getting crazy working only with the Serial monitor on both sides. I didn't know that the Controller is playing a key role on assigning the nodeID.

    It is working now after connecting the gateway to HomeAssistant.

    Thanks.
    Regards.
    Alfredo.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.