[SOLVED] upgraded to Mysensors 2.0.0



  • Hi Guys,

    Tried the new V2.0.0 (on actual-working hardware with V1.5), however the node and sensor won't talk to eachother, things i tried sofar:

    • adding hardcoded parent-ids'
    • changed the speed of the wireless modules (nrf24l01+)
    • added caps, cleared ..
    • With(out) inclusion mode
    • cleared both eeproms with example

    I cannot get my had arround it...

    the (example) code from my sensor:

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik Ekblad
     * 
     * DESCRIPTION
     * Example sketch showing how to control physical relays. 
     * This example will remember relay state after power failure.
     * http://www.mysensors.org/build/relay
     */ 
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE
    
    #include <SPI.h>
    #include <MySensors.h>
    
    #define RELAY_1  3  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 1 // Total number of attached relays
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    
    
    void before() { 
      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
        // Then set relay pins in output mode
        pinMode(pin, OUTPUT);   
        // Set relay to last known state (using eeprom storage) 
        digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
      }
    }
    
    void setup() {
      
    }
    
    void presentation()  
    {   
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Relay", "1.0");
    
      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        present(sensor, S_LIGHT);
      }
    }
    
    
    void loop() 
    {
      
    }
    
    void receive(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_LIGHT) {
         // Change relay state
         digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
         // Store state in eeprom
         saveState(message.sensor, message.getBool());
         // Write some debug info
         Serial.print("Incoming change for sensor:");
         Serial.print(message.sensor);
         Serial.print(", New status: ");
         Serial.println(message.getBool());
       } 
    }
    
    

    and the gateway:

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    
    // Flash leds on rx/tx/err
    #define MY_LEDS_BLINKING_FEATURE
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    //#define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    #define MY_INCLUSION_BUTTON_FEATURE
    
    
    
    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  2
    
    // Uncomment to override default HW configurations
    #define MY_DEFAULT_ERR_LED_PIN 13  // Error led pin voor nanao!
    //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <SPI.h>
    #include <MySensors.h>
    
    void setup() {
      // Setup locally attached sensors
    }
    
    void presentation() {
      // Present locally attached sensors
    }
    
    void loop() {
      // Send locally attached sensor data here
    }
    

    the logs (from the sensor), (which got it's node-id from earlier versions which wrote to eeprom:

    Starting repeater (RNNRA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=100)
    TSM:FPAR
    TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 100-100-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=100)
    ....
    goes on and on..
    

    the gateway is even more quite:
    (the last line is after toggleing the inclusion)

    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;5;1
    
    

    I'm just out of ideas now... also tried the dev-branch from git (as of 19-7-2016, 22:00)

    Any ideays how to get this gthing going?


  • Hardware Contributor

    I am also in the same process of upgrading my sensors and have also seen this behavior (not finding parent node).
    First I thought the radio was broken and changed radio. That got it going but the problem came back. Then I realised that problem comes from resetting the node and not turning power off completely. I had to disconnect my USB-serial adapter and power to make it work.


  • Admin

    @Vincent-Gijsen said:

    changed the speed of the wireless modules (nrf24l01+)

    To what did you change it?

    Can you confirm that you receive

    TSP:SANCHK:OK 
    
    

    messages in in the GW debug log (in regular intervals)?



  • @tekka said:

    @Vincent-Gijsen said:

    changed the speed of the wireless modules (nrf24l01+)

    To what did you change it?

    Can you confirm that you receive

    TSP:SANCHK:OK 
    
    

    messages in in the GW debug log (in regular intervals)?

    I changed it to 1 Mbps, using a define (as supposed for a nrf24l01 minus plus). however it didn't fix anything (and it worked on v1.5 beautifully.

    I did fail to mention that I use a Arduino Uno for the sensor and a nano for the gateway (don't think that matters, but who nows?)

    I do get occationally the TSP:SANCHK:OK on the gatway, so the radio is working (i guess), if I remove it's ground wire, it does register a failed radio



  • I had similar problems. With V1.5 normal nodes send data at a lower power level, only the gateway got full power. Now it seems to be set to high power even for nodes.[see answer below]
    Lowering the PA Power made my node send reliable again.

    #define MY_RF24_PA_LEVEL RF24_PA_LOW
    

  • Plugin Developer

    @rollercontainer

    It's actually the opposite. In version 1.5 there are two separate nrf radio power settings, one for nodes set to max as default, and one for the gateway set to low as default.

    In 2.0 there's only one setting set to max as default but this is overridden to low in the gateway example sketches.



  • Ok, tried the sugestions, but unfortunately, no communications 😞

    HOWEVER , when i disconnect the gateway (so usb power physically removed ) and replug, it works! It has to e powercycled, not just reset!

    There is something weird going on when programming and resetting afterwards... very strange



  • MM

    @Vincent-Gijsen said:

    Ok, tried the sugestions, but unfortunately, no communications 😞

    HOWEVER , when i disconnect the gateway (so usb power physically removed ) and replug, it works! It has to e powercycled, not just reset!

    There is something weird going on when programming and resetting afterwards... very strange

    Ok, there is some very annoying issue. I need to poweroff all sensors. Then power-up the gateway, and connect the sensors. This works for some (limited) time. If i reset the gateway, the nodes can no longer (re)connect... so there is something weird going on.



  • Ok, i was just blind..

    I had my gateway wired differently (and compensated for it, in the transport init.. in my old 1.5.4 code.) Sorry guys!

    After wielding the iron, it now works as supposed to be... damn arduino+nrf wiring diagrams, sometims they use pin 8 for ce, sometimes pin 9... something to keep in mind. Just strang that even with the faulti wired pin, it somhow works for a very breef moment...



  • One very important note I would like to make:

    the gateway must be CONNECTED to a serial device AND the port must be opened (e.g. arduino serial monitor or openhab) , for it to accept connections!!!!. Just powering it from an usb-hub makes it non-responsive to sensors... took some quite a lot of time to figure this out.



Suggested Topics

16
Online

11.4k
Users

11.1k
Topics

112.7k
Posts