Gateway/sensor Range Advice


  • Hero Member

    Now that I have a very stable ethernet gateway, I am beginning to expand my sensors. The gateway is in the basement level of the house next to my VeraLite and communicates very well with a humidity/temp sensor on that level and a light sensor on the next level above.

    Looking for advice on the best way to get coverage on all levels of the house (2 living levels above the basement plus the attic). I don't think I can get that coverage without at least one repeater. Did have a little trouble communicating to the next level above till I tilted the gateway radio antenna from vertical to about a 45 degree angle. Maybe should have it horizontal to increase up/down range.

    Looking for any suggestions/advice/ideas on how best to get whole house coverage with minimum extra hardware and also antenna positioning advice

    Thanks in advance.


  • Contest Winner

    You cannot move the gateway to the middle floor? That's the nice part of iethernet vs. serial gateway... Just run a wire.

    Did you already add repeater capability to your existing sensors?


  • Hero Member

    @BulldogLowell Don't think I can move gateway to middle floor--the only internet connections (other than wireless) that I have are in the basement and everything including most of the basement is finished.

    Did not add repeater capability to existing sensors. I thought repeater has to be separate from sensors since they can never sleep?


  • Hero Member

    @Dan-S. What kind of walls/floors do you have?

    Here in Holland, concrete is quite standard and concrete contains metal; I see that typically it is not possible to cross two walls/floors reliable with WiFi, so that should also count for MySensors. Range is best if antennas can "see" each other directly (through a door/stairwell).

    Yes, a repeater can not sleep and can therefore not really be battery operated.

    Can you run a cable from your basement to the middle floor?


  • Admin

    You can combine sensor and relay into a single node, however, as the radio can't sleep, batteries won't last long. So they need to be powered externaly

    if you have nodes that can be used as actuators, then they also need to be on at all time, as they should be able to receive commands from the GW, so they could in theory be made as repeaters as well..


  • Hero Member

    My house is wooden frame with plasterboard walls so cross floor/wall commo is OK. My one sensor on the main floor is a light sensor and is not battery powered. But don't you still need it to sleep between light readings? How do you make a combination sensor/repeater? The sketch for the repeater indicates that the repeater has a unique node declaration. that is different from the sensor node declaration


  • Admin

    @Dan-S. said:

    My house is wooden frame with plasterboard walls so cross floor/wall commo is OK. My one sensor on the main floor is a light sensor and is not battery powered. But don't you still need it to sleep between light readings? How do you make a combination sensor/repeater? The sketch for the repeater indicates that the repeater has a unique node declaration. that is different from the sensor node declaration

    It's not necessary to sleep between node status messages. You can implement the delays between messages, with millis() instead.

    so something like this would work: (will send measurements every 60 seconds)
    void loop()
    {
    gw.process();
    if (millis() - lastMeasurement > 60000) {
    lastMeasurement = millis();
    sendMeasurements();
    }

    Also have a look at http://mysensors.org/build/sensor_api#sensor-nodes, there are descriptions on how to enable repeater mode, in normal sensor nodes.

    Ps. the code above is made purely from memory, and there might be some parts left out, or spelling errors 🙂


  • Hero Member

    @tbowmo Sounds like that would work. Will try it out.

    Is it best to use the radio with the separate antenna for the repeater?


  • Admin

    @Dan-S.

    Should work fine with the vanilla version.


  • Hero Member

    Revised my light sensor sketch to give it repeater capability. The key is in the millis() function which keeps track of processing time. Did some research and learned that because it is an unsigned long data type it will rollover to zero after 49 days! So unless you write the comparison statement in the if clause a certain way it will fail after 49 days. If you do a search on how do you reset millis() you will learn how to set up the if clause to take care of rollover (you can't easily reset millis and you shouldn't since it will cause major problems for other libraries that use it).

    I could not find any description in http://mysensors.org/build/sensor_api#sensor-nodes on how to do this. I do think a sample combined sensor/gateway sketch would be very useful.

    I have not tested my revised light sensor/repeater sketch (it does compile). Will report back on results of testing.



  • Interesting about millis(), is there anyone here running mysensors more than 50 days?


  • Contest Winner

    @Dan-S. said:

    unsigned long data type it will rollover to zero after 49 days! So unless you write the comparison statement in the if clause a certain way it will fail after 49 days. If you do a search on how do you reset millis() you will learn how to set up the if clause to take care of rollover (you can't easily reset millis and you shouldn't since it will cause major problems for other libraries that use it).

    I could not find any description in http://mysensors.org/build/sensor_api#sensor-nodes on how to do this. I do think a sample combined sensor/gateway sketch would be very useful.

    I have not tested my revised light sensor/repeater sketch (it does compile). Will report back on results of testing.

    The millis() rollover problem is sort of a red herring. You will never have a problem if you are strictly using unsigned long integer SUBTRACTION like this:

    unsigned long lastRunMoment; // the timeStamp you use to constantly check vs the current time (millis() returns an unsigned long timestamp)
    
    unsigned long myInterval = 10000; // the frequency that this timer will execute here... 10 seconds.
    
    void setup()
    {
      Serial.begin(115200);
    }
    
    void loop()
    {
      if (millis() - lastRunMoment > myInterval) // this unsigned subtraction works...
      {
        Serial.println("This works");
        lastRunMoment = millis();
      }
    }
    
    /*
    // NOT Like This:
    void loop()
    {
      if (millis() > lastRunMoment + myInterval) // this unsigned addition will not survive the millis() 49day rollover.
      {
        Serial.println("This doesn't work");
        lastRunMoment = millis();
      }
    }
    */
    

    you can learn why here


  • Hero Member

    @BulldogLowell That's exactly right. You stated it more clearly than I did. It's not a problem if you're careful in how you set up your if test but its does warrant a warning to be careful in that regard to anyone using mills() for timing their sensor reads.


Log in to reply
 

Suggested Topics

  • 87
  • 1
  • 3
  • 2
  • 7
  • 5

56
Online

11.4k
Users

11.1k
Topics

112.7k
Posts