[SOLVED] Communication between Gateway & Node with or without MY_NODE_ID



  • Hi everyone, I’m new in MySensors community, and I hope you can help me !

    I’m using an homemade Ubuntu 16.04LTS Server with JeeDom installed on and I’m tring to connect MySensors Gateway and Node. I’m using MySensors 2.3.0 library.

    For my GW, I’m using a serial GW made with Arduino Nano (chinese clone) with NRF24L01+ & 2dbi antenna (chinese clone also). On this GW I put a 47µF capacitor as recommanded
    My GW look like the GW in the official MySensors Site https://www.mysensors.org/build/serial_gateway in Demonstration part.
    I haven’t made any change in the sktech that I upload in my GW, GatewaySerial.ino

    For my Node, I’m using a Arduino Pro Mini (chinese clone) with NRF24L01+ & 2dbi antenna (chinese clone also) with the 47µF capacitor.

    I’m trying to set a communication between my gateway and my node and there is some strange thing :

    This is my GW Code :

    /**
    * 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.
    *
    *******************************
    *
    * DESCRIPTION
    * The ArduinoGateway prints data received from sensors on the serial link.
    * The gateway accepts input on serial which will be sent out on radio network.
    *
    * The GW code is designed for Arduino Nano 328p / 16MHz
    *
    * Wire connections (OPTIONAL):
    * - Inclusion button should be connected between digital pin 3 and GND
    * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
    *
    * LEDs (OPTIONAL):
    * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
    * - RX (green) - blink fast on radio message received. In inclusion mode will blink fast only on presentation received
    * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
    * - ERR (red) - fast blink on error during transmission error or receive crc error
    *
    */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduinos running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    // 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  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    //#define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <MySensors.h>
    
    void setup()
    {
    	// Setup locally attached sensors
    }
    
    void presentation()
    {
    	// Present locally attached sensors
    }
    
    void loop()
    {
    	// Send locally attached sensor data here
    }
    

    This is my Node Code :

    /**
     * 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 measure light level using a LM393 photo-resistor
     * http://www.mysensors.org/build/light
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    #define MY_NODE_ID 50
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    #include <MySensors.h>
    
    #define CHILD_ID_LIGHT 0
    #define LIGHT_SENSOR_ANALOG_PIN 0
    
    uint32_t SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    int lastLightLevel;
    
    
    void presentation()
    {
    	// Send the sketch version information to the gateway and Controller
    	sendSketchInfo("Light Sensor", "1.0");
    
    	// Register all sensors to gateway (they will be created as child devices)
    	present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    }
    
    void loop()
    {
    	int16_t lightLevel = 15;//(1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;
    	Serial.println(lightLevel);
    	if (lightLevel != lastLightLevel) {
    		send(msg.set(lightLevel));
    		lastLightLevel = lightLevel;
    	}
    	sleep(SLEEP_TIME);
    }
    
    
    

    Between each try I reset my EEPROM data by this code :

    #include <EEPROM.h>
    
    void setup() {
      Serial.begin(115200); // for serial debugging over USB.
      Serial.println("Reseting EEPROM");
    
      for (int i = 0 ; i < EEPROM.length() ; i++) {
        Serial.print(i);
        Serial.print("\t: ");
        Serial.print(EEPROM.read(i));
        EEPROM.write(i, 255);
        Serial.print("\t-> ");
        Serial.println(EEPROM.read(i));
      }
      Serial.println("Done");
    }
    
    void loop() {
      /** Empty loop. **/
    }
    

    When I don't set « MY_NODE_ID X », I have this GW and Node Output :

    GW:

    Fri Nov 02 2018 22:01:49 GMT+0100 (CET) : 0;255;3;0;9;13342787 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:01:49 GMT+0100 (CET) : 0;255;3;0;9;13342794 TSF:MSG:BC
    Fri Nov 02 2018 22:01:49 GMT+0100 (CET) : 0;255;3;0;9;13342797 TSF:MSG:FPAR REQ,ID=255
    Fri Nov 02 2018 22:01:49 GMT+0100 (CET) : 0;255;3;0;9;13342801 TSF:PNG:SEND,TO=0
    Fri Nov 02 2018 22:01:49 GMT+0100 (CET) : 0;255;3;0;9;13342804 TSF:CKU:OK
    Fri Nov 02 2018 22:01:49 GMT+0100 (CET) : 0;255;3;0;9;13342808 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:01:50 GMT+0100 (CET) : 0;255;3;0;9;13342938 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Fri Nov 02 2018 22:01:51 GMT+0100 (CET) : 0;255;3;0;9;13344806 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:01:51 GMT+0100 (CET) : 0;255;3;0;9;13344813 TSF:MSG:BC
    Fri Nov 02 2018 22:01:51 GMT+0100 (CET) : 0;255;3;0;9;13344816 TSF:MSG:FPAR REQ,ID=255
    Fri Nov 02 2018 22:01:51 GMT+0100 (CET) : 0;255;3;0;9;13344820 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:01:51 GMT+0100 (CET) : 0;255;3;0;9;13344824 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:01:51 GMT+0100 (CET) : 0;255;3;0;9;13344921 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Fri Nov 02 2018 22:01:53 GMT+0100 (CET) : 0;255;3;0;9;13346826 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:01:53 GMT+0100 (CET) : 0;255;3;0;9;13346833 TSF:MSG:BC
    Fri Nov 02 2018 22:01:53 GMT+0100 (CET) : 0;255;3;0;9;13346836 TSF:MSG:FPAR REQ,ID=255
    Fri Nov 02 2018 22:01:53 GMT+0100 (CET) : 0;255;3;0;9;13346840 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:01:53 GMT+0100 (CET) : 0;255;3;0;9;13346843 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:01:53 GMT+0100 (CET) : 0;255;3;0;9;13346913 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    

    Node :

     
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    26 TSM:INIT
    28 TSF:WUR:MS=0
    34 TSM:INIT:TSP OK
    36 TSM:FPAR
    40 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2048 !TSM:FPAR:NO REPLY
    2050 TSM:FPAR
    2052 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4061 !TSM:FPAR:NO REPLY
    4063 TSM:FPAR
    4065 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6074 !TSM:FPAR:NO REPLY
    6076 TSM:FPAR
    6078 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8087 !TSM:FPAR:FAIL
    8089 TSM:FAIL:CNT=1
    8091 TSM:FAIL:DIS
    8093 TSF:TDI:TSL
    

    When I set « MY_NODE_ID X » (no matter what ID I set), I have this GW and Node Output :
    GW:

    Fri Nov 02 2018 22:05:13 GMT+0100 (CET) : 0;255;3;0;9;13546764 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:05:13 GMT+0100 (CET) : 0;255;3;0;9;13546770 TSF:MSG:BC
    Fri Nov 02 2018 22:05:13 GMT+0100 (CET) : 0;255;3;0;9;13546773 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:05:13 GMT+0100 (CET) : 0;255;3;0;9;13546777 TSF:PNG:SEND,TO=0
    Fri Nov 02 2018 22:05:13 GMT+0100 (CET) : 0;255;3;0;9;13546780 TSF:CKU:OK
    Fri Nov 02 2018 22:05:13 GMT+0100 (CET) : 0;255;3;0;9;13546783 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:05:14 GMT+0100 (CET) : 0;255;3;0;9;13547114 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:05:15 GMT+0100 (CET) : 0;255;3;0;9;13548837 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:05:15 GMT+0100 (CET) : 0;255;3;0;9;13548844 TSF:MSG:BC
    Fri Nov 02 2018 22:05:15 GMT+0100 (CET) : 0;255;3;0;9;13548847 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:05:15 GMT+0100 (CET) : 0;255;3;0;9;13548851 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:05:15 GMT+0100 (CET) : 0;255;3;0;9;13548854 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:05:16 GMT+0100 (CET) : 0;255;3;0;9;13549207 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:05:17 GMT+0100 (CET) : 0;255;3;0;9;13550874 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:05:17 GMT+0100 (CET) : 0;255;3;0;9;13550881 TSF:MSG:BC
    Fri Nov 02 2018 22:05:17 GMT+0100 (CET) : 0;255;3;0;9;13550884 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:05:17 GMT+0100 (CET) : 0;255;3;0;9;13550888 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:05:17 GMT+0100 (CET) : 0;255;3;0;9;13550892 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:05:18 GMT+0100 (CET) : 0;255;3;0;9;13551234 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:05:19 GMT+0100 (CET) : 0;255;3;0;9;13552927 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:05:19 GMT+0100 (CET) : 0;255;3;0;9;13552933 TSF:MSG:BC
    Fri Nov 02 2018 22:05:19 GMT+0100 (CET) : 0;255;3;0;9;13552936 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:05:19 GMT+0100 (CET) : 0;255;3;0;9;13552941 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:05:19 GMT+0100 (CET) : 0;255;3;0;9;13552944 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:05:20 GMT+0100 (CET) : 0;255;3;0;9;13553291 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    

    Node:

    36476 TSM:INIT:STATID=50
    36478 TSF:SID:OK,ID=50
    36481 TSM:FPAR
    36517 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    38529 !TSM:FPAR:NO REPLY
    38531 TSM:FPAR
    38567 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    40577 !TSM:FPAR:NO REPLY
    40579 TSM:FPAR
    40615 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    42625 !TSM:FPAR:NO REPLY
    42627 TSM:FPAR
    42663 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    44673 !TSM:FPAR:FAIL
    44675 TSM:FAIL:CNT=3
    44677 TSM:FAIL:DIS
    44679 TSF:TDI:TSL
    

    When I set « MY_PARENT_NODE_ID 0 », I have this GW and Node Output :
    GW :

    Fri Nov 02 2018 22:07:31 GMT+0100 (CET) : 0;255;3;0;9;13684855 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:07:31 GMT+0100 (CET) : 0;255;3;0;9;13684861 TSF:MSG:BC
    Fri Nov 02 2018 22:07:31 GMT+0100 (CET) : 0;255;3;0;9;13684865 TSF:MSG:FPAR REQ,ID=255
    Fri Nov 02 2018 22:07:31 GMT+0100 (CET) : 0;255;3;0;9;13684869 TSF:PNG:SEND,TO=0
    Fri Nov 02 2018 22:07:31 GMT+0100 (CET) : 0;255;3;0;9;13684873 TSF:CKU:OK
    Fri Nov 02 2018 22:07:31 GMT+0100 (CET) : 0;255;3;0;9;13684876 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:07:32 GMT+0100 (CET) : 0;255;3;0;9;13685058 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Fri Nov 02 2018 22:07:33 GMT+0100 (CET) : 0;255;3;0;9;13686876 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:07:33 GMT+0100 (CET) : 0;255;3;0;9;13686882 TSF:MSG:BC
    Fri Nov 02 2018 22:07:33 GMT+0100 (CET) : 0;255;3;0;9;13686885 TSF:MSG:FPAR REQ,ID=255
    Fri Nov 02 2018 22:07:33 GMT+0100 (CET) : 0;255;3;0;9;13686889 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:07:33 GMT+0100 (CET) : 0;255;3;0;9;13686893 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:07:34 GMT+0100 (CET) : 0;255;3;0;9;13687044 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Fri Nov 02 2018 22:07:35 GMT+0100 (CET) : 0;255;3;0;9;13688895 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:07:35 GMT+0100 (CET) : 0;255;3;0;9;13688902 TSF:MSG:BC
    Fri Nov 02 2018 22:07:35 GMT+0100 (CET) : 0;255;3;0;9;13688905 TSF:MSG:FPAR REQ,ID=255
    Fri Nov 02 2018 22:07:35 GMT+0100 (CET) : 0;255;3;0;9;13688909 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:07:35 GMT+0100 (CET) : 0;255;3;0;9;13688912 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:07:36 GMT+0100 (CET) : 0;255;3;0;9;13689034 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    Fri Nov 02 2018 22:07:37 GMT+0100 (CET) : 0;255;3;0;9;13690917 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:07:37 GMT+0100 (CET) : 0;255;3;0;9;13690924 TSF:MSG:BC
    Fri Nov 02 2018 22:07:37 GMT+0100 (CET) : 0;255;3;0;9;13690927 TSF:MSG:FPAR REQ,ID=255
    Fri Nov 02 2018 22:07:37 GMT+0100 (CET) : 0;255;3;0;9;13690931 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:07:37 GMT+0100 (CET) : 0;255;3;0;9;13690935 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:07:38 GMT+0100 (CET) : 0;255;3;0;9;13691031 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    

    Node :

     
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    26 TSM:INIT
    30 TSF:WUR:MS=0
    36 TSM:INIT:TSP OK
    38 TSM:FPAR
    43 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2050 !TSM:FPAR:NO REPLY
    2052 TSM:FPAR
    2054 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4063 !TSM:FPAR:NO REPLY
    4065 TSM:FPAR
    4067 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6076 !TSM:FPAR:NO REPLY
    6078 TSM:FPAR
    6080 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8089 !TSM:FPAR:FAIL
    8091 TSM:FAIL:CNT=1
    8093 TSM:FAIL:DIS
    8095 TSF:TDI:TSL
    

    When I set « MY_NODE_ID X » & « MY_PARENT_NODE_ID 0 », I have this GW and Node Output :
    GW:

    Fri Nov 02 2018 22:09:39 GMT+0100 (CET) : 0;255;3;0;9;13812199 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:09:39 GMT+0100 (CET) : 0;255;3;0;9;13812203 TSF:PNG:SEND,TO=0
    Fri Nov 02 2018 22:09:39 GMT+0100 (CET) : 0;255;3;0;9;13812207 TSF:CKU:OK
    Fri Nov 02 2018 22:09:39 GMT+0100 (CET) : 0;255;3;0;9;13812209 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:09:39 GMT+0100 (CET) : 0;255;3;0;9;13812750 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:09:41 GMT+0100 (CET) : 0;255;3;0;9;13814248 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:09:41 GMT+0100 (CET) : 0;255;3;0;9;13814254 TSF:MSG:BC
    Fri Nov 02 2018 22:09:41 GMT+0100 (CET) : 0;255;3;0;9;13814257 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:09:41 GMT+0100 (CET) : 0;255;3;0;9;13814261 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:09:41 GMT+0100 (CET) : 0;255;3;0;9;13814264 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:09:41 GMT+0100 (CET) : 0;255;3;0;9;13814812 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:09:43 GMT+0100 (CET) : 0;255;3;0;9;13816300 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:09:43 GMT+0100 (CET) : 0;255;3;0;9;13816307 TSF:MSG:BC
    Fri Nov 02 2018 22:09:43 GMT+0100 (CET) : 0;255;3;0;9;13816310 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:09:43 GMT+0100 (CET) : 0;255;3;0;9;13816313 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:09:43 GMT+0100 (CET) : 0;255;3;0;9;13816317 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:09:43 GMT+0100 (CET) : 0;255;3;0;9;13816869 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:09:45 GMT+0100 (CET) : 0;255;3;0;9;13818355 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:09:45 GMT+0100 (CET) : 0;255;3;0;9;13818361 TSF:MSG:BC
    Fri Nov 02 2018 22:09:45 GMT+0100 (CET) : 0;255;3;0;9;13818364 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:09:45 GMT+0100 (CET) : 0;255;3;0;9;13818369 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:09:45 GMT+0100 (CET) : 0;255;3;0;9;13818372 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:09:45 GMT+0100 (CET) : 0;255;3;0;9;13818931 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:09:57 GMT+0100 (CET) : 0;255;3;0;9;13830468 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:09:57 GMT+0100 (CET) : 0;255;3;0;9;13830474 TSF:MSG:BC
    Fri Nov 02 2018 22:09:57 GMT+0100 (CET) : 0;255;3;0;9;13830477 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:09:57 GMT+0100 (CET) : 0;255;3;0;9;13830481 TSF:PNG:SEND,TO=0
    Fri Nov 02 2018 22:09:57 GMT+0100 (CET) : 0;255;3;0;9;13830484 TSF:CKU:OK
    Fri Nov 02 2018 22:09:57 GMT+0100 (CET) : 0;255;3;0;9;13830488 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:09:57 GMT+0100 (CET) : 0;255;3;0;9;13830874 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Fri Nov 02 2018 22:09:59 GMT+0100 (CET) : 0;255;3;0;9;13832523 TSF:MSG:READ,50-50-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Fri Nov 02 2018 22:09:59 GMT+0100 (CET) : 0;255;3;0;9;13832530 TSF:MSG:BC
    Fri Nov 02 2018 22:09:59 GMT+0100 (CET) : 0;255;3;0;9;13832534 TSF:MSG:FPAR REQ,ID=50
    Fri Nov 02 2018 22:09:59 GMT+0100 (CET) : 0;255;3;0;9;13832538 TSF:CKU:OK,FCTRL
    Fri Nov 02 2018 22:09:59 GMT+0100 (CET) : 0;255;3;0;9;13832541 TSF:MSG:GWL OK
    Fri Nov 02 2018 22:09:59 GMT+0100 (CET) : 0;255;3;0;9;13832932 !TSF:MSG:SEND,0-0-50-50,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    

    Node :

     
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    26 TSM:INIT
    30 TSF:WUR:MS=0
    36 TSM:INIT:TSP OK
    38 TSM:INIT:STATID=50
    45 TSF:SID:OK,ID=50
    47 TSM:FPAR
    83 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2093 !TSM:FPAR:NO REPLY
    2095 TSM:FPAR
    2131 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4141 !TSM:FPAR:NO REPLY
    4143 TSM:FPAR
    4179 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6189 !TSM:FPAR:NO REPLY
    6191 TSM:FPAR
    6227 TSF:MSG:SEND,50-50-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8237 !TSM:FPAR:FAIL
    8239 TSM:FAIL:CNT=1
    8241 TSM:FAIL:DIS
    8243 TSF:TDI:TSL
    

    I also tried to set « MY_PARENT_NODE_IS_STATIC » when I set « MY_PARENT_NODE_ID 0 » and there no change.

    So I don't understand where I mismatch ...

    Apparently my radio is working because I have on both side MSG:SEND without the « ! ».

    Thank for reading and helping.



  • After a night I switch on my test Node, set my Gateway in "inclusion mode" and it's Work !!!

    So I switch on my real node and I have the same error :

    GW error :

    Sat Nov 03 2018 08:14:47 GMT+0100 (CET) : 0;255;3;0;9;50130719 TSF:MSG:BC
    Sat Nov 03 2018 08:14:47 GMT+0100 (CET) : 0;255;3;0;9;50130722 TSF:MSG:FPAR REQ,ID=100
    Sat Nov 03 2018 08:14:47 GMT+0100 (CET) : 0;255;3;0;9;50130726 TSF:CKU:OK,FCTRL
    Sat Nov 03 2018 08:14:47 GMT+0100 (CET) : 0;255;3;0;9;50130731 TSF:MSG:GWL OK
    Sat Nov 03 2018 08:14:47 GMT+0100 (CET) : 0;255;3;0;9;50131584 !TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Sat Nov 03 2018 08:14:53 GMT+0100 (CET) : 0;255;3;0;9;50137298 TSF:MSG:READ,50-50-0,s=0,c=1,t=23,pt=2,l=2,sg=0:722
    Sat Nov 03 2018 08:14:53 GMT+0100 (CET) : 50;0;1;0;23;722
    Sat Nov 03 2018 08:14:59 GMT+0100 (CET) : 0;255;3;0;9;50142803 TSF:MSG:READ,100-100-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Sat Nov 03 2018 08:14:59 GMT+0100 (CET) : 0;255;3;0;9;50142810 TSF:MSG:BC
    Sat Nov 03 2018 08:14:59 GMT+0100 (CET) : 0;255;3;0;9;50142813 TSF:MSG:FPAR REQ,ID=100
    Sat Nov 03 2018 08:14:59 GMT+0100 (CET) : 0;255;3;0;9;50142817 TSF:PNG:SEND,TO=0
    Sat Nov 03 2018 08:14:59 GMT+0100 (CET) : 0;255;3;0;9;50142821 TSF:CKU:OK
    Sat Nov 03 2018 08:14:59 GMT+0100 (CET) : 0;255;3;0;9;50142824 TSF:MSG:GWL OK
    Sat Nov 03 2018 08:14:59 GMT+0100 (CET) : 0;255;3;0;9;50143481 !TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Sat Nov 03 2018 08:15:01 GMT+0100 (CET) : 0;255;3;0;9;50144856 TSF:MSG:READ,100-100-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Sat Nov 03 2018 08:15:01 GMT+0100 (CET) : 0;255;3;0;9;50144862 TSF:MSG:BC
    Sat Nov 03 2018 08:15:01 GMT+0100 (CET) : 0;255;3;0;9;50144865 TSF:MSG:FPAR REQ,ID=100
    Sat Nov 03 2018 08:15:01 GMT+0100 (CET) : 0;255;3;0;9;50144869 TSF:CKU:OK,FCTRL
    Sat Nov 03 2018 08:15:01 GMT+0100 (CET) : 0;255;3;0;9;50144873 TSF:MSG:GWL OK
    Sat Nov 03 2018 08:15:01 GMT+0100 (CET) : 0;255;3;0;9;50145531 !TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Sat Nov 03 2018 08:15:03 GMT+0100 (CET) : 0;255;3;0;9;50146907 TSF:MSG:READ,100-100-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Sat Nov 03 2018 08:15:03 GMT+0100 (CET) : 0;255;3;0;9;50146913 TSF:MSG:BC
    Sat Nov 03 2018 08:15:03 GMT+0100 (CET) : 0;255;3;0;9;50146916 TSF:MSG:FPAR REQ,ID=100
    Sat Nov 03 2018 08:15:03 GMT+0100 (CET) : 0;255;3;0;9;50146920 TSF:CKU:OK,FCTRL
    Sat Nov 03 2018 08:15:03 GMT+0100 (CET) : 0;255;3;0;9;50146924 TSF:MSG:GWL OK
    Sat Nov 03 2018 08:15:03 GMT+0100 (CET) : 0;255;3;0;9;50147586 !TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    Sat Nov 03 2018 08:15:05 GMT+0100 (CET) : 0;255;3;0;9;50148958 TSF:MSG:READ,100-100-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    Sat Nov 03 2018 08:15:05 GMT+0100 (CET) : 0;255;3;0;9;50148964 TSF:MSG:BC
    Sat Nov 03 2018 08:15:05 GMT+0100 (CET) : 0;255;3;0;9;50148967 TSF:MSG:FPAR REQ,ID=100
    Sat Nov 03 2018 08:15:05 GMT+0100 (CET) : 0;255;3;0;9;50148971 TSF:CKU:OK,FCTRL
    Sat Nov 03 2018 08:15:05 GMT+0100 (CET) : 0;255;3;0;9;50148974 TSF:MSG:GWL OK
    Sat Nov 03 2018 08:15:06 GMT+0100 (CET) : 0;255;3;0;9;50149640 !TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    

    This is my Node program :

    /**
     * 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
     * Version 1.1 - AnonymousZebra
     * 
     * DESCRIPTION
     * This is an example of using the Bosch BME280 module, which can measure temperature, humidity and airpressure, 
     * and do so really accurately, while using very little power. A 3.3v and a 5v version is available, make sure to check which one you have.
     * It communicates over the I2C protocol.
     * 
     * This script uses the BME280 library by Embedded Adventures. Download it, and place it in your Arduino library folder. 
     * https://github.com/embeddedadventures/BME280
     * 
     * Connect your sensor's powerlines, and connect your sensor to the SDA and SCL pins of your board. 
     * On Arduino Nano SDA is pin A4, and SCL is pin A5.
     * On the Ardunio Mega and Due the SDA in pin 20, and the SCL is pin 21.
     * On the Arduino Leonardo and Pro Micro 2 the SDA in pin 2, and the SCL is pin 3.
     * 
     * This script has been written in such a way that it can at the same time function as a repeater-node. 
     * It can also easily be used on battery power. Booth features can be turned on in the code below.
     *
     * Finally, you can decide if you want the forecast feature to be turned on. This is a cool feature, 
     * but there is a catch: it also means that you are locked into taking a measurement exactly once a 
     * minute, to build up prediction data for the algorithm.
     * 
     * The reason so many variables have BME280 at the beginning, is so that it is easier to combine multiple sensors on one Arduino.
     *
     *
     * The BME280 datasheet: https://cdn.sparkfun.com/assets/learn_tutorials/4/1/9/BST-BME280_DS001-10.pdf
     *
     */
    
    // if you uncomment this, you can get test and debug updates about everything the sensor is doing by using the serial monitor tool.
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24                            // A 2.4Ghz transmitter and receiver, often used with MySensors.
    #define MY_RF24_PA_LEVEL RF24_PA_LOW              // This sets a low-power mode for the radio. Useful if you use the version with the bigger antenna, but don't want to power that from a separate power source. It can also fix problems with fake Chinese versions of the radio.
    // #define MY_RADIO_RFM69                         // 433Mhz transmitter and reveiver.
    
    // Do you want this sensor to also be a repeater?
    // #define MY_REPEATER_FEATURE                    // Just remove the two slashes at the beginning of this line to also enable this sensor to act as a repeater for other sensors. If this node is on battery power, you probably shouldn't enable this.
    
    // Are you using this sensor on battery power?
    #define BATTERY_POWERED                        // Just remove the two slashes at the beginning of this line if your node is battery powered. It will then go into deep sleep as much as possible. While it's sleeping it can't work as a repeater!
    
    // Would you like the sensor to generate a weather forecast based on the barometric pressure? 
    #define GENERATE_FORECAST              // Just remove the two slashes at the beginning of this line to enable this feature.
    
    #define MY_NODE_ID 100
    #define MY_PARENT_NODE_ID 0
    //#define MY_PARENT_NODE_IS_STATIC
    
    // LIBRARIES
    #include <SPI.h>                                  // A communication backbone, the Serial Peripheral Interface.
    #include <MySensors.h>                            // The MySensors library. Hurray!
    #include <Wire.h>                                 // Enables the Wire communication protocol.
    // #include <Adafruit_BME280.h>                    // alternative library you could try (DIY; no code for this is in here yet).
    // #include <SparkFunBME280.h>                     // alternative library you could try (DIY; no code for this is in here yet).
    #include <BME280_MOD-1022.h>                      // Bosch BME280 Embedded Adventures MOD-1022 weather multi-sensor Arduino code, written originally by Embedded Adventures. https://github.com/embeddedadventures/BME280
    
    
    // VARIABLES YOU CAN CHANGE
    const float ALTITUDE = 775;                        // Change this value to your location's altitude (in m). Use your smartphone GPS to get an accurate value, or use an online map.
    unsigned long BME280measurementInterval = 60000;  // Sleep time between reads for the BME sensor (in ms). Keep this value at 60000 if you have enabled the forecast feature, as the forecast algorithm needs a sample every minute.
    #define COMPARE_TEMP 1                            // Send temperature only if it changed? 1 = Yes 0 = No. Can save battery.
    float tempThreshold = 0.1;                        // How big a temperature difference has to minimally  be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
    #define COMPARE_HUM 1                             // Send temperature only if changed? 1 = Yes 0 = No. Can save battery.
    float humThreshold = 0.1;                         // How big a humidity difference has to minimally be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
    #define COMPARE_BARO 1                            // Send temperature only if changed? 1 = Yes 0 = No. Can save battery.
    float presThreshold = 0.1;                        // How big a barometric difference has to minimally be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
    
    
    //VARIABLES YOU PROBABLY SHOULDN'T CHANGE
    #define TEMP_CHILD_ID 0                // for MySensors. Within this node each sensortype should have its own ID number.
    #define HUM_CHILD_ID 1                // for MySensors. Within this node each sensortype should have its own ID number.
    #define BARO_CHILD_ID 2             // for MySensors. Within this node each sensortype should have its own ID number.
    float lastTemperature = -1;            // Stores the previous measurement, so it can be compared with a new measurement.
    float lastHumidity = -1;            // Stores the previous measurement, so it can be compared with a new measurement.
    float lastPressure = -1;            // Stores the previous measurement, so it can be compared with a new measurement.
    unsigned long BME280measurementSleepTime = 0;      // variable to store the calculated Sleep time if the node is battery powered.
    bool metric = true;                // Variable that stores if the sensor will output the temperature in Fahrenheit of Celsius. The gateway sends this preference to the node, so you dont need to change it here.
    bool receivedConfig = false;            // The MySensors gateway will tell the node if it should output in metric or not.
    
    #define CONVERSION_FACTOR (1.0/10.0)         // used by forecast algorithm to convert from Pa to kPa, by dividing hPa by 10.
    
    #ifdef GENERATE_FORECAST             //  Below you will find a lot of variables used by the forecast algorithm.
    const char *weather[] = { "stable", "sunny", "cloudy", "unstable", "thunderstorm", "unknown" };
    enum FORECAST
    {
      STABLE = 0,                     // "Stable Weather Pattern"
      SUNNY = 1,                      // "Slowly rising Good Weather", "Clear/Sunny "
      CLOUDY = 2,                     // "Slowly falling L-Pressure ", "Cloudy/Rain "
      UNSTABLE = 3,                   // "Quickly rising H-Press",     "Not Stable"
      THUNDERSTORM = 4,                 // "Quickly falling L-Press",    "Thunderstorm"
      UNKNOWN = 5                     // "Unknown (More Time needed)
    };
    int lastForecast = -1;                // Stores the previous forecast, so it can be compared with a new forecast.
    const int LAST_SAMPLES_COUNT = 5;
    float lastPressureSamples[LAST_SAMPLES_COUNT];
    int minuteCount = 0;                // Helps the forecst algorithm keep time.
    bool firstRound = true;                // Helps the forecast algorithm recognise if the sensor has just been powered up.
    float pressureAvg;                // Average value is used in forecast algorithm.
    float pressureAvg2;                // Average after 2 hours is used as reference value for the next iteration.
    float dP_dt;                    // Pressure delta over time
    #endif
    
    // MYSENSORS COMMUNICATION VARIABLES
    MyMessage temperatureMsg(TEMP_CHILD_ID, V_TEMP);
    MyMessage humidityMsg(HUM_CHILD_ID, V_HUM);
    MyMessage pressureMsg(BARO_CHILD_ID, V_PRESSURE);
    #ifdef GENERATE_FORECAST
    MyMessage forecastMsg(BARO_CHILD_ID, V_FORECAST);
    #endif
    
    
    void setup() {
      Wire.begin(); // Wire.begin(sda, scl) // starts the wire communication protocol, used to chat with the BME280 sensor.
      Serial.begin(115200); // for serial debugging over USB.
      Serial.println("Hello world, I am a sensor node.");
    
    #ifdef BATTERY_POWERED // If the node is battery powered, we'll let Sleep take over the scheduling.
       BME280measurementSleepTime = BME280measurementInterval;
       BME280measurementInterval = 0; // When the Arduino is asleep, millis doesn't increment anymore (time stops as it were). To fix this, we'll set the measurement interval time to 1, so that when the arduino wakes up it will immediately try to measure again.
    #endif
    
    }
    
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("BME280 Sensor", "1.1");
    
      // Tell the MySensors gateway what kind of sensors this node has, and what their ID's on the node are, as defined in the code above.
      present(BARO_CHILD_ID, S_BARO);
      present(TEMP_CHILD_ID, S_TEMP);
      present(HUM_CHILD_ID, S_HUM);
    }
    
    
    void loop() {
    
      // You should not change these variables:
      static unsigned long previousBME280Millis = 0;  // Used to remember the time that the BME280 sensor was asked for a measurement.
      unsigned long currentMillis = millis();         // The time since the sensor started, counted in milliseconds. This script tries to avoid using the Sleep function, so that it could at the same time be a MySensors repeater.
      static boolean BME280shouldAsk = true;          // This is true when the time is right for a new measurement to be made.
      static boolean BME280justAsked = false;         // This indicates whether we have just asked the sensor module for a measurement, so the receiving part of the code (part 2) should be primed. This two-part construction helps to bridge the time where the BME280 module is busy, without blocking the entire node from doing anything else (like being a repeater, or working with other connected sensor modules).
    
    
      // PART 1. If enough time has passed, a new measurement should be taken:
      if (BME280shouldAsk == true && currentMillis - previousBME280Millis >= BME280measurementInterval) {
        previousBME280Millis = currentMillis; // store the current time as the previous measurement start time.
        BME280shouldAsk = false;
        Serial.println("");
        Serial.println("BME280 - Requesting new data from sensor module.");
        BME280.readCompensationParams();    // Need to read the NVM compensation parameters.
    
    #ifdef BATTERY_POWERED
        // After taking the measurement the chip goes back to sleep. This code is only enabled if you enabled BATTERY POWERED at the top of this script.
        // Oversampling settings (os1x, os2x, os4x, os8x or os16x).
        BME280.writeFilterCoefficient(fc_16);       // IIR Filter coefficient, higher numbers avoid sudden changes to be accounted for (such as slamming a door)
        BME280.writeOversamplingPressure(os16x);    // pressure x16
        BME280.writeOversamplingTemperature(os8x);  // temperature x8
        BME280.writeOversamplingHumidity(os8x);     // humidity x8
        BME280.writeMode(smForced);                 // Forced sample.  After taking the measurement the chip goes back to sleep.
    #else
        // Normal mode for regular automatic samples
        BME280.writeStandbyTime(tsb_0p5ms);         // tsb = 0.5ms
        BME280.writeFilterCoefficient(fc_16);       // IIR Filter coefficient 16
        BME280.writeOversamplingPressure(os16x);    // pressure x16
        BME280.writeOversamplingTemperature(os8x);  // temperature x8
        BME280.writeOversamplingHumidity(os8x);     // humidity x8
        BME280.writeMode(smNormal);
    #endif
    
        // As we exit part 1, in theory BME280.isMeasuring() should now be true.
        BME280justAsked = true;   
      }
    
    
      // Part 2. This will trigger if the sensor has just been asked for a measurement, and is also just done figuring out those measurements.
      if(BME280justAsked == true && BME280.isMeasuring() == false) { // 
        BME280justAsked = false; // makes sure we don't do this part again in the next pass through the main loop.
        Serial.println("BME280 - Sensor module has some new values ready:");
    
        // Read out the data - must do this before calling the getxxxxx routines
        BME280.readMeasurements();
    
        float temperature = BME280.getTemperatureMostAccurate();                    // Must get the temperature first.
        float humidity = BME280.getHumidityMostAccurate();                // Get the humidity.
        float pressure_local = BME280.getPressureMostAccurate();                    // Get pressure at current location
        float pressure = pressure_local/pow((1.0 - ( ALTITUDE / 44330.0 )), 5.255); // Adjust to sea level pressure using user altitude
    #ifdef GENERATE_FORECAST      
        int forecast = sample(pressure);                        // Run the forecast function with a new pressure update.
    #endif
    
        if (!metric) {
          // Convert temperature to fahrenheit
          temperature = temperature * 9.0 / 5.0 + 32.0;
        }
    
        // Useful for debugging
        Serial.print("BME280 - Temperature = ");
        Serial.print(temperature);
        Serial.println(metric ? " B0C" : " B0F");
        Serial.print("BME280 - Humidity = ");
        Serial.print(humidity);
        Serial.println(" %");
        Serial.print("BME280 - Pressure = ");
        Serial.print(pressure);
        Serial.println(" hPa");
    #ifdef GENERATE_FORECAST      
        Serial.print("BME280 - Forecast = ");
        Serial.println(weather[forecast]);
    #endif
    
        // Now, let's send the measurements to the gateway.
    
        // Send temperature
        if (COMPARE_TEMP == 1 && abs(temperature - lastTemperature) < tempThreshold) { // is the temperature difference bigger than the threshold?
          Serial.print(temperature - lastTemperature);
          Serial.print("- BME280 - Temperature difference too small, so not sending the new measurement to the gateway.\n");
        } else {
          Serial.print("BME280 - Sending the new temperature to the gateway.\n");
          send(temperatureMsg.set(temperature, 1));
          lastTemperature = temperature; // Save new temperatures to be able to compare in the next round.
        } 
    
        // Send humidity
        if (COMPARE_TEMP == 1 && abs(humidity - lastHumidity) < humThreshold) { // is the humidity difference bigger than the threshold?
          Serial.print(humidity - lastHumidity);
          Serial.println("- BME280 - Humidity difference too small, so not sending the new measurement to the gateway.");
        } else {
          Serial.println("BME280 - Sending the new humidity to the gateway.");
          send(humidityMsg.set(humidity, 1));
          lastHumidity = humidity; // Save new humidity to be able to compare in the next round.
        }
    
        // Send pressure
        if (COMPARE_TEMP == 1 && abs(pressure - lastPressure) < presThreshold) { // is the pressure difference bigger than the threshold?
          Serial.print(pressure - lastPressure);
          Serial.println("- BME280 - Pressure difference too small, so not sending the new measurement to the gateway.");
        } else {
          Serial.println("BME280 - Sending the new pressure to the gateway.");
          send(pressureMsg.set(pressure, 1));
          lastPressure = pressure; // Save new pressure to be able to compare in the next round.
        }
    
    #ifdef GENERATE_FORECAST
        // Send forecast
        if (forecast != lastForecast) {
          Serial.println("BME280 - Sending the latest forecast to the gateway.");      
          send(forecastMsg.set(weather[forecast]));
          lastForecast = forecast;
        }
    #endif 
    
      Serial.println("BME280 - Measurement complete. Going to wait until next measurement.");
      BME280shouldAsk = true; // Ready for the new round.
      }
    
    #ifdef BATTERY_POWERED
      // This code will only be included in the sketch if the BATTERY POWERED feature is enabled.
      if(BME280shouldAsk == true && BME280justAsked == false) { // Both parts are done, so we can let the sensor sleep again.
        unsigned long quicktimecheck = millis(); // To check how much time has passed since the beginning of being awake, and then calculate from that how long to sleep until the next intended measuring time, we need to know how many milliseconds have passed.
        unsigned long sleeptime = BME280measurementSleepTime - (quicktimecheck - previousBME280Millis); // How much time has passed already during the calculating? Subtract that from the intended interval time.
        Serial.println("BME280 - zzzzZZZZzzzzZZZZzzzz");
        sleep (sleeptime);
        Serial.println("BME280 - Waking up.");
      }
    #endif
    
    } // end of main loop.
    
    
    
    #ifdef GENERATE_FORECAST
    // These functions are only included if the forecast function is enables. The are used to generate a weater prediction by checking if the barometric pressure is rising or falling over time.
    
    float getLastPressureSamplesAverage()
    {
      float lastPressureSamplesAverage = 0;
      for (int i = 0; i < LAST_SAMPLES_COUNT; i++) {
        lastPressureSamplesAverage += lastPressureSamples[i];
      }
      lastPressureSamplesAverage /= LAST_SAMPLES_COUNT;
    
      return lastPressureSamplesAverage;
    }
    
    
    // Forecast algorithm found here
    // http://www.freescale.com/files/sensors/doc/app_note/AN3914.pdf
    // Pressure in hPa -->  forecast done by calculating kPa/h
    int sample(float pressure) {
      // Calculate the average of the last n minutes.
      int index = minuteCount % LAST_SAMPLES_COUNT;
      lastPressureSamples[index] = pressure;
    
      minuteCount++;
      if (minuteCount > 185) {
        minuteCount = 6;
      }
    
      if (minuteCount == 5) {
        pressureAvg = getLastPressureSamplesAverage();
      }
      else if (minuteCount == 35) {
        float lastPressureAvg = getLastPressureSamplesAverage();
        float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
        if (firstRound) { // first time initial 3 hour 
          dP_dt = change * 2; // note this is for t = 0.5hour
        }
        else {
          dP_dt = change / 1.5; // divide by 1.5 as this is the difference in time from 0 value.
        }
      }
      else if (minuteCount == 65) {
        float lastPressureAvg = getLastPressureSamplesAverage();
        float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
        if (firstRound) { //first time initial 3 hour
          dP_dt = change; //note this is for t = 1 hour
        }
        else {
          dP_dt = change / 2; //divide by 2 as this is the difference in time from 0 value
        }
      }
      else if (minuteCount == 95) {
        float lastPressureAvg = getLastPressureSamplesAverage();
        float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
        if (firstRound) { // first time initial 3 hour
          dP_dt = change / 1.5; // note this is for t = 1.5 hour
        }
        else {
          dP_dt = change / 2.5; // divide by 2.5 as this is the difference in time from 0 value
        }
      }
      else if (minuteCount == 125) {
        float lastPressureAvg = getLastPressureSamplesAverage();
        pressureAvg2 = lastPressureAvg; // store for later use.
        float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
        if (firstRound) { // first time initial 3 hour
          dP_dt = change / 2; // note this is for t = 2 hour
        }
        else {
          dP_dt = change / 3; // divide by 3 as this is the difference in time from 0 value
        }
      }
      else if (minuteCount == 155) {
        float lastPressureAvg = getLastPressureSamplesAverage();
        float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
        if (firstRound) { // first time initial 3 hour
          dP_dt = change / 2.5; // note this is for t = 2.5 hour
        } 
        else {
          dP_dt = change / 3.5; // divide by 3.5 as this is the difference in time from 0 value
        }
      }
      else if (minuteCount == 185) {
        float lastPressureAvg = getLastPressureSamplesAverage();
        float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
        if (firstRound) { // first time initial 3 hour
          dP_dt = change / 3; // note this is for t = 3 hour
        } 
        else {
          dP_dt = change / 4; // divide by 4 as this is the difference in time from 0 value
        }
        pressureAvg = pressureAvg2; // Equating the pressure at 0 to the pressure at 2 hour after 3 hours have past.
        firstRound = false; // flag to let you know that this is on the past 3 hour mark. Initialized to 0 outside main loop.
      }
    
      int forecast = UNKNOWN;
      if (minuteCount < 35 && firstRound) { //if time is less than 35 min on the first 3 hour interval.
        forecast = UNKNOWN;
      }
      else if (dP_dt < (-0.25)) {
        forecast = THUNDERSTORM;
      }
      else if (dP_dt > 0.25) {
        forecast = UNSTABLE;
      }
      else if ((dP_dt > (-0.25)) && (dP_dt < (-0.05))) {
        forecast = CLOUDY;
      }
      else if ((dP_dt > 0.05) && (dP_dt < 0.25))
      {
        forecast = SUNNY;
      }
      else if ((dP_dt >(-0.05)) && (dP_dt < 0.05)) {
        forecast = STABLE;
      }
      else {
        forecast = UNKNOWN;
      }
    
      // uncomment when debugging
      //Serial.print(F("BME280 - Forecast at minute "));
      //Serial.print(minuteCount);
      //Serial.print(F(" dP/dt = "));
      //Serial.print(dP_dt);
      //Serial.print(F("kPa/h --> "));
      //Serial.println(weather[forecast]);
    
      return forecast;
    }
    #endif
    

    Should I wait a time between each inclusion ?

    Thank for reading !


  • Plugin Developer

    I always got those FPAR errors with cheap/bad power supplies.

    Since I've been using the Arduino Nano Wireless Expansion Boards those problems are behind me. Never have to use the capacitors anymore.

    I'd recommend getting some of those.



  • Thank for the reply !

    So you think it's power isue ... But GW power or Node power isue ?

    I'll check this.



  • You're right, it was my Node power supply.
    I remove my old power supply and connect directly with 3xAA NiMh and I will see later for upgrade this.

    Thank You


Log in to reply
 

Suggested Topics

  • 3
  • 5
  • 8
  • 1
  • 2
  • 6

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts