Connection Problems



  • I have an installation up and running (1.4 serial gw, fhem as controller) and am trying to install a soil/humidity sensor in my garden. But it always loses connection to the gateway or repeater once i put it on the ground (it can send if i put it on a chair or so in roughly the same spot). Other nodes in the house are working fine. I am using the extended range + antenna tranceiver on the gateway already, but also tried to work with an additional repeater (and forced sensors to use it). Tried different dBm Levels on both gw and sensors, tried different sensors (all on battery), added caps, changed the power-source of repeater (gw is powered through serial cable on the Raspberry). The strange thing is - none of these options had an influence on the behavior of that node on the ground. Any idea what is going wrong here? The other observation is: once a sensor loses connection it will never reconnect, even if put very close to the gw/repeater. Always have to reset - is that a normal behavior? Thanks in advance.


  • Hardware Contributor

    Do you have a repeater - what does that serial log write?

    Repeater keeps looping...



  • Well - in cases when my sensor are disappearing there is also nothing to see in the log of the Repeater...


  • Hero Member

    @Stephan-Noller said:

    The other observation is: once a sensor loses connection it will never reconnect, even if put very close to the gw/repeater. Always have to reset - is that a normal behavior?

    From what I've seen it's not normal behavior as the communication is really stateless. Can you post your sketch to see if something jumps out? I've shut down my controller and gateway and the sensors always keep communicating, even if they have moved out of range and back in range. Might be worth trying with MYSController rather than FHEM to see if you see the same behavior with it.

    For your other issue, I would move the radio as far back from the ground as possible and use wires to extend the actual sensor from the node. Some ground is really good at absorbing RF.

    Cheers
    Al



  • I am experiences the same issues where the devices fail to reconnect. But I am using the RF24 Library not the MySensors Library right now.



  • Alright so I have been tinkering and finally read something that fixed the problem for me. I saw a note about power issues and needed more current then the trace could source quickly. So I grabbed my scope and checked. I was seeing a .6v drop when the TX started. I have now added a 22uf cap between ground and VCC and everything including reboot is functioning correctly. I hope this helps.

    -Tech



  • @Sparkman sure, the code is attached below, but it's pretty much the standard example (derived from light sensor). Your suggestion regarding distance to the ground is a good point, will try my best (as i am measuring humidity of the soil it's not trivial...).
    Regarding stateless communication: is that really the case? I thought there is some routing including routing tables somewhere which would indicate a kind of state or am i wrong?

    #include <SPI.h>
    #include <MySensor.h>  
    
    #define CHILD_ID_LIGHT 0
    #define CHILD_ID_BAT 1
    #define LIGHT_SENSOR_ANALOG_PIN 0
    #define trigger 6
    #define led A2
    
    int BATTERY_SENSE_PIN = A1;
    
    unsigned long SLEEP_TIME = 1*60000; // Sleep time between reads (in milliseconds)
    
    MySensor gw;
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    MyMessage msgBatt(CHILD_ID_BAT, V_VOLTAGE);
    
    int lastLightLevel;
    
    void setup()  
    { 
      gw.begin(NULL,3,false,0);
      //gw.begin();
      pinMode(trigger, INPUT);
      pinMode(led, OUTPUT);
      pinMode(11, OUTPUT);
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Moisture Sensor", "1.0");
    
      // Register all sensors to gateway (they will be created as child devices)
      gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
      gw.present(CHILD_ID_BAT, S_POWER);
      Serial.println("Setup ok");
    }
    
    void loop()      
    { 
       pinMode(trigger, INPUT);
       digitalWrite(led, HIGH);
       delay(1000);  
       
       int lightLevel = analogRead(LIGHT_SENSOR_ANALOG_PIN);
       int batLevel = analogRead(BATTERY_SENSE_PIN);
       float batteryV  = batLevel * 0.003363075;
       int batteryPcnt = batLevel / 10;
       Serial.println(lightLevel);
       delay(100);
       gw.send(msg.set(lightLevel));
       gw.sendBatteryLevel(batteryPcnt);
       
       lastLightLevel = lightLevel;
    
       delay(1000);
       pinMode(trigger, OUTPUT);
       digitalWrite(led, LOW);
       gw.sleep(SLEEP_TIME);
    }
    
    
    


  • @TechIsCool thanks for your suggestion, unfortunately i already have caps on all my sensors (because it is also suggested on the mysensors page)


  • Hero Member

    @Stephan-Noller What I meant by stateless was that there's no connection established/maintained between a sensor and the gateway. I believe a node maintains the parent ID which is either a repeater or the gateway. If the node has a repeater as it's parent ID and it can no longer talk to the repeater, then it may need to be reset to get the new parent ID. Not sure if a node can get a new parent ID without a reset. @hek, can you clarify?

    Cheers
    Al


  • Admin

    It should search for a new parent by itself after a few failed transmissions.


  • Hero Member

    @hek Thanks for clarifying. @Stephan-Noller, have you tried replicating this with serial monitors hooked up to see what happens with the transmissions? It should provide a clue as to what is going on.

    Cheer
    Al



  • As i said @Sparkman i see nothing in the serial logs of repeater/gw in these cases. The only thing i did not yet check is the serial output of the sensors that fail to connect (it's currently raining all the time here...). But the good news is: i kinda solved the problem by simply exchanging hardware from gw and repeater. Now the repeater is using the amplified RF and the gw the standard module. Now all sensors are measuring from their intended location on the ground with just a few exceptions (btw also interesting: in many cases only one of the two sensor-values is being transmitted).


  • Hero Member

    @Stephan-Noller If there's nothing in the repeater or gateway, then that indicates that the sensor is not transmitting or transmitting to the wrong parent, so hooking up a serial monitor to it should provide some clues. Of course the serial monitor has to be connected ahead of time otherwise as it will reset the Arduino once you connect. You could also try the NRF24 Sniffer.

    Try putting a small delay between the sends as that may resolve the issue where only one value is being transmitted.

    Cheers
    Al


Log in to reply
 

Suggested Topics

16
Online

11.4k
Users

11.1k
Topics

112.7k
Posts