Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. [SOLVED] Long distance radios not working with mySensors code (nrf24l01+)
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

[SOLVED] Long distance radios not working with mySensors code (nrf24l01+)

Scheduled Pinned Locked Moved Hardware
3 Posts 2 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • edsteveE Offline
    edsteveE Offline
    edsteve
    wrote on last edited by Yveaux
    #1

    Hi,

    i am playing with mysensors and OpenHAB for a little while now and have around 6 sensors running just fine. I use the standard NRF24L01+ radios but want to have two more sensors with the NRF24L01+ long-range version so i can meassure the temperature in my compost experiment. So i bought these two:
    http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=231799511604#ht_1500wt_1161

    But the mysensors code is not working with the long-range versions. When i take a already working sensor and change the radio with the long-range version. Nothing happens. Even the serial monitor is empty. Not even an error like "radio init failed"... just empty.

    I tried this test: http://shanes.net/simple-nrf24l01-with-arduino-sketch-and-setup/
    And i can get it running successfully. Means the hardware is working but isn't compatible with the mysensors code. Or am i doing something wrong?

    This is what i tried already:

    • reinstalled Arduino IDE
    • changed the USB ports and cables and tried on different Arduino Nanos

    Here is one of my running sketches which only runs on the short-range radios :(
    Hope somebody telling me how stupid i am ;)

    #include <MySensor.h>  
    #include <SPI.h>
    
    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 1   // Id of the sensor child
    #define NODE_ID 11
    
    MySensor gw;
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
      gw.begin(NULL, NODE_ID, true);
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Motion Sensor", "1.0");
    
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID, S_MOTION);
      
    }
    
    void loop()     
    {     
      // Read digital motion value
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
            
      Serial.println(tripped);
      gw.send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
     
      // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
      gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
    }
    
    
    mfalkviddM 1 Reply Last reply
    0
    • edsteveE edsteve

      Hi,

      i am playing with mysensors and OpenHAB for a little while now and have around 6 sensors running just fine. I use the standard NRF24L01+ radios but want to have two more sensors with the NRF24L01+ long-range version so i can meassure the temperature in my compost experiment. So i bought these two:
      http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=231799511604#ht_1500wt_1161

      But the mysensors code is not working with the long-range versions. When i take a already working sensor and change the radio with the long-range version. Nothing happens. Even the serial monitor is empty. Not even an error like "radio init failed"... just empty.

      I tried this test: http://shanes.net/simple-nrf24l01-with-arduino-sketch-and-setup/
      And i can get it running successfully. Means the hardware is working but isn't compatible with the mysensors code. Or am i doing something wrong?

      This is what i tried already:

      • reinstalled Arduino IDE
      • changed the USB ports and cables and tried on different Arduino Nanos

      Here is one of my running sketches which only runs on the short-range radios :(
      Hope somebody telling me how stupid i am ;)

      #include <MySensor.h>  
      #include <SPI.h>
      
      unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
      #define CHILD_ID 1   // Id of the sensor child
      #define NODE_ID 11
      
      MySensor gw;
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_TRIPPED);
      
      void setup()  
      {  
        gw.begin(NULL, NODE_ID, true);
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Motion Sensor", "1.0");
      
        pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID, S_MOTION);
        
      }
      
      void loop()     
      {     
        // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
              
        Serial.println(tripped);
        gw.send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
       
        // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
        gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
      }
      
      
      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      @edsteve how are you powering the radios? The long range versions need 5-10x more power. This might cause your nodes to fail.

      Also see the power troubleshooting diagram at https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help

      Many people use the long range versions with MySensors so there is no direct incompatibility.

      You can also try adding Serial.println statements after each statement in setup and loop, to see where the code stops running. Add wait(100) after each println so the serial has time to send the data.

      1 Reply Last reply
      0
      • edsteveE Offline
        edsteveE Offline
        edsteve
        wrote on last edited by
        #3

        Hey Vidd,

        Thanks for your perfect answer and the diagram. Useful info for newbie like me :)
        I tried external power for the radio and it worked right away. I got mislead from the fact that the radio worked with a simple test code but not with mysensors code.

        1 Reply Last reply
        1
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        9

        Online

        11.7k

        Users

        11.2k

        Topics

        113.0k

        Posts


        Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular