Simple Serial Gateway and sensor does not work...



  • Hi,

    I've downloaded the latest release of MySensors (2.0.0) and uploaded the GatewaySerial sketch (unmodified) to a NANO [1] with a NRF24L01+ [2] with the extra antenna like in the tutorial video [3]

    I've also uploaded a sketch to a Mini Pro 5v with a DHT22

    /*
     * TEST SKETCH
     */
    
    // Enable debug prints
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // SET NODE ID
    #define MY_NODE_ID 10
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <DHT.h>  
    
    #define CHILD_ID_TEMP 11
    #define CHILD_ID_HUM 12
    #define HUMIDITY_SENSOR_DIGITAL_PIN 3
    unsigned long SLEEP_TIME = 5*1000; // Sleep time between reads (in milliseconds)
    
    DHT dht;
    float lastTemp = -100;
    float lastHum = -100;
    boolean metric = true; 
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("TestSketch 1.0");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
      
    }
    
    void setup() {
      // put your setup code here, to run once:
      Serial.begin(115200);
      Serial.println("Setting up..");
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
      Serial.flush();
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
     delay(dht.getMinimumSamplingPeriod());
    
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT");
      } else if (temperature != lastTemp) {
        lastTemp = temperature;
        if (!metric) {
          temperature = dht.toFahrenheit(temperature);
        }
        send(msgTemp.set(temperature, 1));
        Serial.print("T: ");Serial.println(temperature);
      }
      
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum) {
          lastHum = humidity;
          send(msgHum.set(humidity, 1));
          Serial.print("H: ");Serial.println(humidity);
      }
      sleep(SLEEP_TIME);
    }
    

    This is the output of the gateway:

    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.0.0
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK
    
    

    This is the output of the sensor:

    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=10)
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=10)
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 10-10-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    

    I'm guessing they are not communicating with each-other? And I'm a little lost here and don't know where to continue troubleshooting.. I've replaced the SerialGateway with another radio and nano and both have the same issue.
    I've also tried several other mini's and radios, but no difference.

    Using Arduino 1.6.9 and capacitors on the radios...

    Any suggestions what to do next?

    [1]Nano
    [2]NRF24L01+
    [3]Video



  • I have exactly the same problem.....



  • It looks like it's similar to this: https://forum.mysensors.org/topic/4296/unable-to-get-simple-gateway-button-sensor-to-work-together

    I'm gonna try the debug for the NRF if it reveals any more...


  • Admin

    @LOST @SGi also make sure GW and node are not too close from each other.



  • @tekka my node and gateway are about 1m apart



  • Hmmm even when I try the example battery status sketch I get the same results from the debug.... Maybe something to do with the Nano or wiring?



  • Oh I am using a Uno for the gateway and a nano for the DHT node...


  • Admin

    @SGi I suggest to put them even further away, I've had similar issues with the LNA PA RF24 version.



  • @tekka thanks but that doesn't appear to change anything. Do you understand the error from the sensor debug? Is it not getting a response so it restarts or something? Basically is it more likely the sensor or gateway end with the problem?



  • Here the same, a simple sketch sending a value every 2 seconds on Arduino Pro mini its working but on @scalz simple aa node with atmega328 1MHz bootloader i am getting this error

    Starting sensor (RRNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=41)
    TSM:FPAR
    TSP:MSG:SEND 41-41-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 41-41-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 41-41-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 41-41-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    

    And this on the gateway

    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=41)
    0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;!TSP:MSG:SEND 0-0-41-41 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
    0;255;3;0;9;TSP:MSG:READ 41-41-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=41)
    0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;!TSP:MSG:SEND 0-0-41-41 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
    0;255;3;0;9;TSP:MSG:READ 41-41-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=41)
    0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;!TSP:MSG:SEND 0-0-41-41 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
    

    I am using RFM69 radio

    Here is the code link text


  • Hardware Contributor

    @kenci which aa node? I don't think this is my design 😉

    About your issue,I have not digged yet so I don't know. On my side, the stParentUpdate is working I guess as I have not this problem. I'm using RFM69 too with a serial GW. But I'm still on end june temp 2.0b rev so I have not completely migrated to the new lib as I had some sketch to finish. I will update and diffcheck tests device today. So I will see if I fall into this, and try to debug if I can replicate the problem 😉

    Just in case, what is your GW? I have serial gw + esp mqtt on my side for testing.



  • https://forum.mysensors.org/topic/4316/version-2-0-isn-t-working this could be the fix... Have to try tomorrow night....



  • Sorry @scalz , it was another user who designed the board, user @m26872 was it. My gateway is an ESP8266 with MQTT. I will try to find out what the problem is. With the same sketch it's working on an Arduino Pro 328 3v3. But on @m26872's board with 1MHz it's not.

    EDIT:
    I found out that my Simple AA node is not receiving packets(ATMega328 1MHZ). So now i have to check why!

    EDIT 2:
    OK, i found out if i connect DI0 of RFM69 to D2 it's working. But if i want to use D3(because D2 is in use for a switch) it's not working, even if i set #define MY_RF69_IRQ_PIN 3 in my sketch!


  • Hardware Contributor

    @kenci ok, I think I know where is your problem. Try to add this in your sketch (before mysensors include of course)
    #define MY_RF69_IRQ_NUM 1

    That should work. I will do the change.


Log in to reply
 

Suggested Topics

67
Online

11.4k
Users

11.1k
Topics

112.7k
Posts