Node cant see gateway less than 10m Away.



  • I live in a small End of terrace house so its not big by any stretch of the imagination but i'm struggling to see nodes i've setup that are no more than 10m away.

    i'm using a raspberry pi with Domoticz as the controller, connected to a serial gateway using an arduino nano clone and NRF24L01+. the nodes are all sensebender micro with NRF24L01+ powered by 2XAA.

    the nodes close by the gateway are fine, but the ones in the bedroom are sporadic at best.

    I read that RF_250KBPS has a good 250m range. i'm stuggling to get a fraction of that.

    i've got a 4.7capacitor on the gateway Radio, and its currently being powered by a seperate 5v 10a power supply i had.

    Can any one point in the right direction to figure out what the issue is?


  • Hero Member

    @Adam-McCartney The last shipment of nRF24L radio's I received can only bridge around 4 meters. Try another radio if you have one..



  • i bought a batch of 10 so will see if i can find a better one.

    failing that its back to the drawing board! RFM12/RFM69 probably, although annoying i soldered the NRF24 radios directly to my sensebender micro's. 😞


  • Mod

    @Adam-McCartney said:

    i've got a 4.7capacitor on the gateway Radio, and its currently being powered by a seperate 5v 10a power supply i had.

    Are you using a voltage regulator as well? The nrf wants a maximum of 3.6V



  • I'm using an arduino nano so i'm using the 3.3v pin to the NRF Radio while feeding 5v in. Is that not regulated?


  • Hardware Contributor

    In theory that should work - but i have a setup like that and experience the nrf moreunstable...
    i will change that arduino into a 5v with 3v regulator and caps in the future.

    But still it works for more than 4m


  • Mod

    Yes it is. I interpreted "it" as the nrf chip, not the whole system. Sorry.



  • ok, thanks for the advice. i was originally using it with power straight from the Raspberry PI USB, but now i'm wondering if i change from a Serial Gateway to a standalone ethernet gateway and attach the gateway to the Network in a more central postition in the house. Currently its beside my router which is the furthest you can get from the other side of the house.


  • Hero Member

    @Adam-McCartney As the nrf24 operates on the same frequency as Wifi (2.4 gHz) your problem could also be related to interference with your (wifi?) router.



  • That thought had crossed my mind. Its a Dual band Router, but unfortunately a lot of the devices don't support 5Ghz.

    I have a Main server in my office that i could i could connect the gateway to and make make it a network gateway that way.

    I think my best option is to create an ethernet gateway anyway.

    Thanks for all your help.

    I'll try moving the gateway away from the router and see how that effects everything.



  • You could scan frequencies and see what channels are free of noise and than set MySensors libraray to that channel. There is arduino code poor man's scanner that scans wifi range

    and here is my modified sketch that scans all 127 channels...

    #include <SPI.h>
    
    // Poor Man's Wireless 2.4GHz Scanner
    //
    // uses an nRF24L01p connected to an Arduino
    // 
    // Cables are:
    //     SS       -> 10
    //     MOSI     -> 11
    //     MISO     -> 12
    //     SCK      -> 13
    // 
    // and CE       ->  9
    //
    // created March 2011 by Rolf Henkel
    //
    
    #define CE  9
    
    // Array to hold Channel data
    #define CHANNELS  128
    int channel[CHANNELS];
    
    // greyscale mapping 
    int  line;
    char grey[] = " 123456789";
    
    // nRF24L01P registers we need
    #define _NRF24_CONFIG      0x00
    #define _NRF24_EN_AA       0x01
    #define _NRF24_RF_CH       0x05
    #define _NRF24_RF_SETUP    0x06
    #define _NRF24_RPD         0x09
    
    // get the value of a nRF24L01p register
    byte getRegister(byte r)
    {
      byte c;
      
      PORTB &=~_BV(2);
      c = SPI.transfer(r&0x1F);
      c = SPI.transfer(0);  
      PORTB |= _BV(2);
    
      return(c);
    }
    
    // set the value of a nRF24L01p register
    void setRegister(byte r, byte v)
    {
      PORTB &=~_BV(2);
      SPI.transfer((r&0x1F)|0x20);
      SPI.transfer(v);
      PORTB |= _BV(2);
    }
      
    // power up the nRF24L01p chip
    void powerUp(void)
    {
      setRegister(_NRF24_CONFIG,getRegister(_NRF24_CONFIG)|0x02);
      delayMicroseconds(130);
    }
    
    // switch nRF24L01p off
    void powerDown(void)
    {
      setRegister(_NRF24_CONFIG,getRegister(_NRF24_CONFIG)&~0x02);
    }
    
    // enable RX 
    void enable(void)
    {
        PORTB |= _BV(1);
    }
    
    // disable RX
    void disable(void)
    {
        PORTB &=~_BV(1);
    }
    
    // setup RX-Mode of nRF24L01p
    void setRX(void)
    {
      setRegister(_NRF24_CONFIG,getRegister(_NRF24_CONFIG)|0x01);
      enable();
      // this is slightly shorter than
      // the recommended delay of 130 usec
      // - but it works for me and speeds things up a little...
      delayMicroseconds(130);
    }
    
    // scanning all channels in the 2.4GHz band
    void scanChannels(void)
    {
      disable();
      for( int j=0 ; j<200  ; j++)
      {
        for( int i=0 ; i<CHANNELS ; i++)
        {
          // select a new channel
          setRegister(_NRF24_RF_CH,(128*i)/CHANNELS);
          
          // switch on RX
          setRX();
          
          // wait enough for RX-things to settle
          delayMicroseconds(40);
          
          // this is actually the point where the RPD-flag
          // is set, when CE goes low
          disable();
          
          // read out RPD flag; set to 1 if 
          // received power > -64dBm
          if( getRegister(_NRF24_RPD)>0 )   channel[i]++;
        }
      }
    }
    
    // outputs channel data as a simple grey map
    void outputChannels(void)
    {
      int norm = 0;
      
      // find the maximal count in channel array
      for( int i=0 ; i<CHANNELS ; i++)
        if( channel[i]>norm ) norm = channel[i];
        
      // now output the data
      //Serial.print('|');
      for( int i=0 ; i<CHANNELS ; i++)
      {
        int pos;
        
        // calculate grey value position
        if( norm!=0 ) pos = (channel[i]*10)/norm;
        else          pos = 0;
        
        // boost low values
        if( pos==0 && channel[i]>0 ) pos++;
        
        // clamp large values
        if( pos>9 ) pos = 9;
       
        // print it out
        Serial.print(grey[pos]);
        channel[i] = 0;
      }
      
      // indicate overall power
       Serial.println("");
     // Serial.println(norm);
    }
    
    // give a visual reference between WLAN-channels and displayed data
    void printChannels(void)
    {
      // output approximate positions of WLAN-channels
     Serial.println("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111");
     Serial.println("0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222"); 
     Serial.println("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567");
    }
    
    void setup()
    {
      Serial.begin(57600);
      
      Serial.println("Starting Poor Man's Wireless 2.4GHz Scanner ...");
      Serial.println();
    
      // Channel Layout
      // 0         1         2         3         4         5         6
      // 0123456789012345678901234567890123456789012345678901234567890123
      //       1 2  3 4  5  6 7 8  9 10 11 12 13  14                     | 
      //
     // Serial.println("Channel Layout");
      printChannels();
      
      // Setup SPI
      SPI.begin();
      SPI.setDataMode(SPI_MODE0);
      SPI.setClockDivider(SPI_CLOCK_DIV2);
      SPI.setBitOrder(MSBFIRST);
      
      // Activate Chip Enable
      pinMode(CE,OUTPUT);
      disable();
      
      // now start receiver
      powerUp();
      
      // switch off Shockburst
      setRegister(_NRF24_EN_AA,0x0);
      
      // make sure RF-section is set properly 
      // - just write default value... 
      setRegister(_NRF24_RF_SETUP,0x0F); 
      
      // reset line counter
      line = 0;
    }
    
    void loop() 
    { 
      // do the scan
      scanChannels();
      
      // output the result
      outputChannels();
      
      // output WLAN-channel reference every 12th line
      if( line++>12 )
      {
        printChannels();
        line = 0;
      }
    }
    


  • Thats awesome, i'd been wondering how i can check the network interference.

    Cheers mate, i'll give this a go soon as i can!


  • Mod

    The scan is a very nice idea. Would be cool to report the channels as MySensors-children so their noise levels could be graphed by a controller. I've added that to my list of project ideas 🙂



  • So, i setup one of my Sensebender nodes with this Sketch to see what the interference was like. i think i understand why i've such bad signal now.

    My default channel is 76 (comes pre-set in MySensors). you can see the noise below.

    Starting Poor Man's Wireless 2.4GHz Scanner ...
    
    0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111
    0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222
    1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
             11121  21          1   11                   1         1  994 141 1     1                                             11
                                                      55      5 5   5  9 9            5                                             
    21 1131 1311111   31  132  1221                   1   242  233 16489461  22   121 2 1                                          1
    11    11 1111 12  121 1123112311        1112111111 11 113111111122991531 121    1  1                                           1
       9                       9                             9 9    9  9         9   99                                             
    252 75          2  97 25                            22 299 55     22  25  97  2 2                                               
    1     11   33   1 31        3                         31 1    1 13963331   1     1 1                                          1 
      1                       1   1                     1 1   1    122961 1        12  1                                            
        2422222         22222244444 22222244444422222 2224248666844 844646896464464 2                                               
       21     21          11     1 11                         11     189         1  11                                              
    3    33                  33                            333369393  963 63333     3  3                                            
    36663 3 3336663 36 6693 639636  36               33  363696  3 36 6699366 6693 333 3                                          33
     63 663   663 3 33 36 66633  33 33                   33 36 696  39966  33 36333393                                            3 
    3669333 36993 36966663 33  3336333                3333336669 33 669633996699333                                               33
    0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111
    0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222
    1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
    2 22  5225 22 22        2525225                   22      2  52 9522 252255     25 22                                           
                                  9                     9                            99                                             
     9                                                 9 99  99           9  99 9   9 9                                             
      5                                                       5  5    99      55    555                                             
                                5 5                     5 5555    9  5 9559  5 5 5  5  5                                            
    11 1                                        1    11 6131 673775 97667656333231  1                                               
      2                          2                    2248266 44842244896246498822  2222                                            
      2                           5                      2  7 7 52    792 2 222       2                                             
                                 2                     5  227972 5522599 22 72 5 52 2 25                                            
                                 5                     2222  72 7  25799522 2227    55                                              
           1                    1            1      1111 21238475937618424562963 311 1 1                                            
                                                   1121414232554644747964475464542111 1                                             
    11                                               3243567345463548688667547996 211                                               
                                   1                  1   1  5211 111199 1   152      1                                             
    0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111
    0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222
    1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
                                                          3  311 1   195  13    11 11111                                            
                                 1                       1213213121 86987653 5511                                                   
      1                                                     1       96999            1                                              
                                 1                           1   2  98775             1                                             
    1                                                               1197              11                                            
                                                                   1119831           3                                              
                                                       11122582713453198452454521     11                                            
     1             11111     111                       11 111125324299975 4121321    1 1                                            
    1                                               111112475554556397984134564331 11  1                                            
                                1                    1  11312215 2 3968881532513 1 1                                                
       1                                                 11 11     192985   2 11 1  2  2                                            
    1 1                                             1 2123312 4224329599324411211    2                                              
                                                      111 1231112215668912212  2211 1  1                                            
                                1                          2233 475335991131 243     2                                              
    0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111
    0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222
    1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
     2                             4                           9468 2622 44          4                                              
     11                         1                             2576255911525   1     1111                                            
    1 1                                                1  221 2733127898621352421   11                                              
                                1                           1 469846648866646253    11                                              
       1              1                                   1 1149976962458674431                                                     
      1            1111                                       356388999535958633    1111                                            
       1                        1                       1  11144655976915847564       1                                             
    1                                                      1  546458592642545511                                                    
      55                                                     5   5                  995                                             
    11285           25223772     1                       1322395           33122751  111                                          22
    7 5792522 255272552  597555 55 2                  2  2   255772  75752277  2772 22 2                                          22
     22 25 97  55 25  52  5725552                      22 2772277595  97  2  522252222 2                                            
    

    i'm off to reload all my nodes onto a different channel!



  • Any success after moving sensors to a different range. Facing the same problem



  • No, I still need to get round to making a repeater that will sit between the Bedroom Node and the Gateway. Unfortunately i haven't found the time recently to do it.


  • Hardware Contributor

    Did you try lowering the power level of the NRF24? It seems counter-intuitive to lower the power level to get better transmissions, but for short distances the NRF24 in the nodes does not need to be set to the MAX value (the default in the MeSensors library).
    I use the HIGH setting mostly, and for 1 node very close to my gateway/controller I use LOW.



  • RF24_PA_LEVEL is currently set to RF24_PA_MAX
    and
    RF24_PA_LEVEL_GW is currently set to RF24_PA_LOW

    I've also noticed that i must have written over my config at some point cause the channel is back at 76 instead of 110 where my spectrum is clearer.

    i'll rebuild all the nodes tonight and see what i can get after switching channels and setting the RF24)PA_LEVEL to LOW.



  • Why the RF24_PA_LEVEL_GW by default is set to low?


Log in to reply
 

Suggested Topics

55
Online

11.4k
Users

11.1k
Topics

112.6k
Posts