Skip to content
  • MySensors
  • 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. Troubleshooting
  3. [SOLVED] I use serial GW 2.1.1 and my sensor node won't connect

[SOLVED] I use serial GW 2.1.1 and my sensor node won't connect

Scheduled Pinned Locked Moved Troubleshooting
26 Posts 6 Posters 6.0k Views 4 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.
  • bjacobseB Offline
    bjacobseB Offline
    bjacobse
    wrote on last edited by bjacobse
    #1

    I have programmed a Arduino Nano with GW 2.1.1 and my node below is not connecting.
    What I find a bit strange is that my "old" 1.5.4 nodes are connecting to the serial gatewayt and appears in Domoticcz - which I somehow then think I am using old version of gateway version?
    I am using Ubuntu 16.04LTS, Arduino 1.8.5 and Mysensors 2.1.1 according to the library manager.

    My node is an Arduino Pro mini, (as it's a reuse of an old 1.5.4 I have cleared eeprom memory).
    Anyone can help getting further?

    Below is the serial outpout from my node, it seems that it's not find a gateway?

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    0 TSM:INIT
    0 TSF:WUR:MS=0
    16 TSM:INIT:TSP OK
    16 TSM:FPAR
    32 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2064 !TSM:FPAR:NO REPLY
    2064 TSM:FPAR
    2080 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4112 !TSM:FPAR:NO REPLY
    4112 TSM:FPAR
    4128 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6160 !TSM:FPAR:NO REPLY
    6160 TSM:FPAR
    6176 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8208 !TSM:FPAR:FAIL
    8208 TSM:FAIL:CNT=1
    8208 TSM:FAIL:PDT
    18235 TSM:FAIL:RE-INIT
    
    1 Reply Last reply
    0
    • bjacobseB Offline
      bjacobseB Offline
      bjacobse
      wrote on last edited by
      #2

      I can answer myself as I found this very useful link
      https://www.mysensors.org/build/parser
      No potential parents replied to find parent request, so I assume the gateway isn't adding the node to the network

      1 Reply Last reply
      0
      • bjacobseB Offline
        bjacobseB Offline
        bjacobse
        wrote on last edited by
        #3

        serial output from Gateway

        0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
        0;255;3;0;9;TSM:INIT
        0;255;3;0;9;TSF:WUR:MS=0
        0;255;3;0;9;TSM:INIT:TSP OK
        0;255;3;0;9;TSM:INIT:GW MODE
        0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
        0;255;3;0;9;MCO:REG:NOT NEEDED
        0;255;3;0;14;Gateway startup complete.
        0;255;0;0;18;2.1.1
        0;255;3;0;9;MCO:BGN:STP
        0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        2;1;1;0;13;30
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        0;255;3;0;9;!TSF:MSG:LEN,0!=9
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        0;255;3;0;9;!TSF:MSG:LEN,0!=9
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        0;255;3;0;9;!TSF:MSG:LEN,0!=9
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        0;255;3;0;9;!TSF:MSG:LEN,0!=9
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        0;255;3;0;9;!TSF:MSG:LEN,0!=9
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        0;255;3;0;9;!TSF:MSG:LEN,0!=9
        0;255;3;0;9;TSF:MSG:READ,2-12-0,s=1,c=1,t=13,pt=2,l=2,sg=0:30
        0;255;3;0;9;!TSF:MSG:LEN,0!=9
        0;255;3;0;9;TSF:MSG:READ,12-12-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
        0;255;3;0;9;TSF:MSG:BC
        0;255;3;0;9;TSF:MSG:FPAR REQ,ID=12
        0;255;3;0;9;TSF:PNG:SEND,TO=0
        0;255;3;0;9;TSF:CKU:OK
        0;255;3;0;9;TSF:MSG:GWL OK
        0;255;3;0;9;!TSF:MSG:SEND,0-0-12-12,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
        0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
        0;255;3;0;9;TSM:INIT
        0;255;3;0;9;TSF:WUR:MS=0
        0;255;3;0;9;TSM:INIT:TSP OK
        0;255;3;0;9;TSM:INIT:GW MODE
        0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
        0;255;3;0;9;MCO:REG:NOT NEEDED
        0;255;3;0;14;Gateway startup complete.
        
        1 Reply Last reply
        0
        • bjacobseB Offline
          bjacobseB Offline
          bjacobse
          wrote on last edited by
          #4

          I just wonder why the gateway isn't accepting and providing a node number to the node?

          1 Reply Last reply
          0
          • scalzS Offline
            scalzS Offline
            scalz
            Hardware Contributor
            wrote on last edited by scalz
            #5

            Hi,
            GW doesn't provide id to nodes, so in this case you need to use static id.
            in case it still don't work, perhaps try a cleareeprom, or dev branch.

            Else it's maybe on hardware side. We ran a few intensive tests with a dozen of nodes yesterday, and it was looking good here but that wasn't the same config (not same mcus, but i had two nrf24 in the equation, plus some others different radios).

            If you can't get it working, could you also upload your sketch please?

            bjacobseB 1 Reply Last reply
            0
            • bjacobseB Offline
              bjacobseB Offline
              bjacobse
              wrote on last edited by
              #6

              I only used the template for binary sensor, and added voltage measurement.
              I thought that the node gets an id from gateway? in the "old" 1.5.4 I didn't do anything special to assign node id. I was sure that nodes automatically gets assigned an node id form gateway?
              my sketch below:

              /**
               * 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
               *
               * Interrupt driven binary switch example with dual interrupts
               * Author: Patrick 'Anticimex' Fallberg
               * Connect one button or door/window reed switch between
               * digitial I/O pin 3 (BUTTON_PIN below) and GND and the other
               * one in similar fashion on digital I/O pin 2.
               * This example is designed to fit Arduino Nano/Pro Mini
               *
               */
              
              
              // Enable debug prints to serial monitor
              #define MY_DEBUG
              
              // Enable and select radio type attached
              #define MY_RADIO_NRF24
              //#define MY_RADIO_RFM69
              
              #include <MySensors.h>
              
              #define SKETCH_NAME "Valdemar Binary Sensor"
              #define SKETCH_MAJOR_VER "1"
              #define SKETCH_MINOR_VER "0"
              
              #define PRIMARY_CHILD_ID 3
              #define SECONDARY_CHILD_ID 4
              
              #define PRIMARY_BUTTON_PIN 2   // Arduino Digital I/O pin for button/reed switch
              #define SECONDARY_BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch
              
              #if (PRIMARY_BUTTON_PIN < 2 || PRIMARY_BUTTON_PIN > 3)
              #error PRIMARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
              #endif
              #if (SECONDARY_BUTTON_PIN < 2 || SECONDARY_BUTTON_PIN > 3)
              #error SECONDARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
              #endif
              #if (PRIMARY_BUTTON_PIN == SECONDARY_BUTTON_PIN)
              #error PRIMARY_BUTTON_PIN and BUTTON_PIN2 cannot be the same
              #endif
              #if (PRIMARY_CHILD_ID == SECONDARY_CHILD_ID)
              #error PRIMARY_CHILD_ID and SECONDARY_CHILD_ID cannot be the same
              #endif
              
              
              // Change to V_LIGHT if you use S_LIGHT in presentation below
              MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
              MyMessage msg2(SECONDARY_CHILD_ID, V_TRIPPED);
              
              int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
              int oldBatteryPcnt = 0;
              
              void setup()
              {
              	// Setup the buttons
              	pinMode(PRIMARY_BUTTON_PIN, INPUT);
              	pinMode(SECONDARY_BUTTON_PIN, INPUT);
              
              	// Activate internal pull-ups
              	digitalWrite(PRIMARY_BUTTON_PIN, HIGH);
              	digitalWrite(SECONDARY_BUTTON_PIN, HIGH);
              
                // use the 1.1 V internal reference
                #if defined(__AVR_ATmega2560__)
                  analogReference(INTERNAL1V1);
                #else
                  analogReference(INTERNAL);
                #endif
              }
              
              void presentation()
              {
              	// Send the sketch version information to the gateway and Controller
              	sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER);
              
              	// Register binary input sensor to sensor_node (they will be created as child devices)
              	// You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage.
              	// If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
              	present(PRIMARY_CHILD_ID, S_DOOR);
              	present(SECONDARY_CHILD_ID, S_DOOR);
              }
              
              // Loop will iterate on changes on the BUTTON_PINs
              void loop()
              {
              	uint8_t value;
              	static uint8_t sentValue=2;
              	static uint8_t sentValue2=2;
              
              	// Short delay to allow buttons to properly settle
              	sleep(5);
              
              	value = digitalRead(PRIMARY_BUTTON_PIN);
              
              	if (value != sentValue) {
              		// Value has changed from last transmission, send the updated value
              		send(msg.set(value==HIGH));
              		sentValue = value;
              	}
              
              	value = digitalRead(SECONDARY_BUTTON_PIN);
              
              	if (value != sentValue2) {
              		// Value has changed from last transmission, send the updated value
              		send(msg2.set(value==HIGH));
              		sentValue2 = value;
              	}
              
                  // get the battery Voltage
                  int sensorValue = analogRead(BATTERY_SENSE_PIN);
                #ifdef MY_DEBUG
                  Serial.println(sensorValue);
                #endif
              
                  // 1M, 470K divider across battery and using internal ADC ref of 1.1V
                  // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
                  // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
                  // 3.44/1023 = Volts per bit = 0.003363075
              
                  int batteryPcnt = sensorValue / 10;
              
              
                #ifdef MY_DEBUG
                  float batteryV  = sensorValue * 0.003363075;
                  Serial.print("Battery Voltage: ");
                  Serial.print(batteryV);
                  Serial.println(" V");
              
                  Serial.print("Battery percent: ");
                  Serial.print(batteryPcnt);
                  Serial.println(" %");
                #endif
              
                  if (oldBatteryPcnt != batteryPcnt) {
                      sendBatteryLevel(batteryPcnt);
                      oldBatteryPcnt = batteryPcnt;
                  }
              
              	// Sleep until something happens with the sensor
              	sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SECONDARY_BUTTON_PIN-2, CHANGE, 0);
              }
              
              1 Reply Last reply
              0
              • scalzS scalz

                Hi,
                GW doesn't provide id to nodes, so in this case you need to use static id.
                in case it still don't work, perhaps try a cleareeprom, or dev branch.

                Else it's maybe on hardware side. We ran a few intensive tests with a dozen of nodes yesterday, and it was looking good here but that wasn't the same config (not same mcus, but i had two nrf24 in the equation, plus some others different radios).

                If you can't get it working, could you also upload your sketch please?

                bjacobseB Offline
                bjacobseB Offline
                bjacobse
                wrote on last edited by
                #7

                @scalz
                so it might be my Domoticz controller that won't provide a id to the sensor?
                I have tried in Domoticz to "allow new sensors for 5 min" but the sensor wont get an id...

                zboblamontZ 1 Reply Last reply
                0
                • bjacobseB bjacobse

                  @scalz
                  so it might be my Domoticz controller that won't provide a id to the sensor?
                  I have tried in Domoticz to "allow new sensors for 5 min" but the sensor wont get an id...

                  zboblamontZ Offline
                  zboblamontZ Offline
                  zboblamont
                  wrote on last edited by
                  #8

                  @bjacobse I may be completely off the beam here as have not read through it all, and still new at all this, but... Have you enabled "#define MY_INCLUSION_MODE_FEATURE" on the Gateway?
                  I read somewhere that this is needed for Domoticz after I could not get a Node to similarly connect.

                  bjacobseB 1 Reply Last reply
                  0
                  • tbowmoT Offline
                    tbowmoT Offline
                    tbowmo
                    Admin
                    wrote on last edited by
                    #9

                    @bjacobse

                    What does the log in domoticz tell you, when you power up gateway / nodes?

                    "old" nodes (pre 2.1'ish) should be able to communicate with a new gateway (2.1), while the opposite is not true (new nodes running 2.1 is not able to connect to an old 1.5 gateway)

                    Anyways, check logs on both ends (node, and gateway) to see if there is anything suspicious there..

                    bjacobseB 1 Reply Last reply
                    0
                    • zboblamontZ zboblamont

                      @bjacobse I may be completely off the beam here as have not read through it all, and still new at all this, but... Have you enabled "#define MY_INCLUSION_MODE_FEATURE" on the Gateway?
                      I read somewhere that this is needed for Domoticz after I could not get a Node to similarly connect.

                      bjacobseB Offline
                      bjacobseB Offline
                      bjacobse
                      wrote on last edited by
                      #10

                      @zboblamont
                      I used the "original sketch and only updated the #define MY_RF24_PA_LEVEL RF24_PA_MAX

                      /**
                      * 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 seral 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 recieved. In inclusion mode will blink fast only on presentation recieved
                      * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
                      * - ERR (red) - fast blink on error during transmission error or recieve crc error
                      *
                      */
                      
                      // Enable debug prints to serial monitor
                      #define MY_DEBUG
                      
                      
                      // Enable and select radio type attached
                      #define MY_RADIO_NRF24
                      //#define MY_RADIO_RFM69
                      
                      // 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.
                      // RF24_PA_MIN RF24_PA_LOW RF24_PA_HIGH RF24_PA_MAX
                      //#define MY_RF24_PA_LEVEL RF24_PA_LOW
                      //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
                      #define MY_RF24_PA_LEVEL RF24_PA_MAX
                      
                      // Enable serial gateway
                      #define MY_GATEWAY_SERIAL
                      
                      // Define a lower baud rate for Arduino's 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
                      }
                      
                      zboblamontZ 1 Reply Last reply
                      0
                      • tbowmoT tbowmo

                        @bjacobse

                        What does the log in domoticz tell you, when you power up gateway / nodes?

                        "old" nodes (pre 2.1'ish) should be able to communicate with a new gateway (2.1), while the opposite is not true (new nodes running 2.1 is not able to connect to an old 1.5 gateway)

                        Anyways, check logs on both ends (node, and gateway) to see if there is anything suspicious there..

                        bjacobseB Offline
                        bjacobseB Offline
                        bjacobse
                        wrote on last edited by
                        #11

                        @tbowmo
                        Thank you for the input
                        the Domotics log:
                        2017-11-14 20:42:04.586 MySensors: Using serial port: /dev/ttyUSB-mysensor
                        2017-11-14 20:42:06.075 MySensors: Gateway Ready...
                        2017-11-14 20:42:06.150 MySensors: Gateway Version: 2.1.1

                        I am not sure how I also get debug/serial info out from the gateway meanwhile it's connected to the RPI that is running the Domoticz server, I will check the forum posts, as I haven't thought of this

                        1 Reply Last reply
                        0
                        • bjacobseB bjacobse

                          @zboblamont
                          I used the "original sketch and only updated the #define MY_RF24_PA_LEVEL RF24_PA_MAX

                          /**
                          * 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 seral 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 recieved. In inclusion mode will blink fast only on presentation recieved
                          * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
                          * - ERR (red) - fast blink on error during transmission error or recieve crc error
                          *
                          */
                          
                          // Enable debug prints to serial monitor
                          #define MY_DEBUG
                          
                          
                          // Enable and select radio type attached
                          #define MY_RADIO_NRF24
                          //#define MY_RADIO_RFM69
                          
                          // 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.
                          // RF24_PA_MIN RF24_PA_LOW RF24_PA_HIGH RF24_PA_MAX
                          //#define MY_RF24_PA_LEVEL RF24_PA_LOW
                          //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
                          #define MY_RF24_PA_LEVEL RF24_PA_MAX
                          
                          // Enable serial gateway
                          #define MY_GATEWAY_SERIAL
                          
                          // Define a lower baud rate for Arduino's 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
                          }
                          
                          zboblamontZ Offline
                          zboblamontZ Offline
                          zboblamont
                          wrote on last edited by
                          #12

                          @bjacobse Ok, not experienced enough to offer any further suggestions as still fumbling my own way,...
                          In my own setup it is standardised on RFM69 radio modules, and the Nework ID is defined at the Gateway and Node, the Node ID is defined at the Node.

                          1 Reply Last reply
                          0
                          • tbowmoT Offline
                            tbowmoT Offline
                            tbowmo
                            Admin
                            wrote on last edited by
                            #13

                            @bjacobse

                            As a start, you could shut down the domoticz instance, and connect a terminal program directly to your serial port instead. Then power cycle a few nodes, while recording the output from the gateway.

                            at the same time, if you could capture the serial output from the power up sequence / first transmission of one of the nodes.

                            bjacobseB 1 Reply Last reply
                            0
                            • tbowmoT tbowmo

                              @bjacobse

                              As a start, you could shut down the domoticz instance, and connect a terminal program directly to your serial port instead. Then power cycle a few nodes, while recording the output from the gateway.

                              at the same time, if you could capture the serial output from the power up sequence / first transmission of one of the nodes.

                              bjacobseB Offline
                              bjacobseB Offline
                              bjacobse
                              wrote on last edited by
                              #14

                              @tbowmo
                              Thank you Thomas for good ideas :-) I will try this when I get time within a few days

                              1 Reply Last reply
                              0
                              • bjacobseB Offline
                                bjacobseB Offline
                                bjacobse
                                wrote on last edited by
                                #15

                                Gateway startup

                                0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
                                0;255;3;0;9;TSM:INIT
                                0;255;3;0;9;TSF:WUR:MS=0
                                0;255;3;0;9;TSM:INIT:TSP OK
                                0;255;3;0;9;TSM:INIT:GW MODE
                                0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
                                0;255;3;0;9;MCO:REG:NOT NEEDED
                                0;255;3;0;14;Gateway startup complete.
                                0;255;0;0;18;2.1.1
                                0;255;3;0;9;MCO:BGN:STP
                                0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
                                
                                
                                1 Reply Last reply
                                0
                                • bjacobseB Offline
                                  bjacobseB Offline
                                  bjacobse
                                  wrote on last edited by bjacobse
                                  #16

                                  Finally I got it, as I have used same hw configuration for ver1.5.4 as for ver 2.1.1 I did not expect any power issues...

                                  a hint for debugging in consol mode linux then use screen
                                  apt-get install screen

                                  then use like this, note that I use udev to always get Domoticz to use correct ttyUSBx, as I have several USB devices attached attached

                                  sudo screen /dev/ttyUSB-mysensor 115200
                                  

                                  to kill screen CTRL-a then k and y for confirm

                                  Then I realised that if I use gateway sketch un-modified it is working, and Domoticz is providing node id, (If Domotics is set to allow new sensors, in settings)

                                  So when I change on the PA_LEVEL_HIGH or PA_LEVEL_MAX and use more power consumption, apparently the gateway isn't working. I do have a amplified PA RF24L01 moduleboard.
                                  It's working when set as default PA_LEVEL_LOW

                                  // 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.
                                  // RF24_PA_MIN RF24_PA_LOW RF24_PA_HIGH RF24_PA_MAX
                                  #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                  //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
                                  //#define MY_RF24_PA_LEVEL RF24_PA_MAX
                                  

                                  I might have to look into a power USB hub ;-)

                                  Thank you guys for providing input to solve my issue

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    mckvack
                                    wrote on last edited by
                                    #17

                                    I too had problems with my GW resetting.
                                    I use custom designed PCBs with Atmega328p-au using the internal oscillator. With some nodes the GW will reset when I turn them on. Sometimes changing to another NRF-module solved it but this time none of my NRF-modules worked so I searched and found this thread. Flashed the GW with v2.2.0-rc.2 and now all my problems are gone.

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      Mario64
                                      wrote on last edited by
                                      #18

                                      Hi,

                                      I've got across similar problem. What works for you doesn't solve problem in my case.
                                      Decreasing power to PA_LEVEL_LOW or switching to MySensors v2.2.0-rc.2 gives no positive result.

                                      I have some experience with Arduino, but it is my first try with MySensors and Domoticz.

                                      If someone could advice how to cope with, thank you in advance.

                                      My Hardware:
                                      Arduino Nano, NRF21+ for GW & Node,
                                      the node is simple actuator: relay with button.

                                      GW output on Serial monitor:

                                      0;255;3;0;9;TSM:INIT
                                      0;255;3;0;9;TSF:WUR:MS=0
                                      0;255;3;0;9;TSM:INIT:TSP OK
                                      0;255;3;0;9;TSM:INIT:GW MODE
                                      0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
                                      0;255;3;0;9;MCO:REG:NOT NEEDED
                                      0;255;3;0;14;Gateway startup complete.
                                      0;255;0;0;18;2.1.1
                                      0;255;3;0;9;MCO:BGN:STP
                                      0;255;3;0;9;MCO:BGN:INIT OK,TS
                                      

                                      Node output on Serial Monitor:

                                      0 MCO:BGN:INIT REPEATER,CP=RNNRA--,VER=2.1.1
                                      3 TSM:INIT
                                      4 TSF:WUR:MS=0
                                      11 TSM:INIT:TSP OK
                                      13 TSM:FPAR
                                      15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      2023 !TSM:FPAR:NO REPLY
                                      2025 TSM:FPAR
                                      2027 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      4035 !TSM:FPAR:NO REPLY
                                      4037 TSM:FPAR
                                      4039 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      6047 !TSM:FPAR:NO REPLY
                                      6049 TSM:FPAR
                                      6051 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      8060 !TSM:FPAR:FAIL
                                      8061 TSM:FAIL:CNT=1
                                      8064 TSM:FAIL:PDT
                                      18067 TSM:FAIL:RE-INIT
                                      18069 TSM:INIT
                                      18076 TSM:INIT:TSP OK
                                      18078 TSM:FPAR
                                      18080 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      20088 !TSM:FPAR:NO REPLY
                                      20090 TSM:FPAR
                                      20092 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      22102 !TSM:FPAR:NO REPLY
                                      22104 TSM:FPAR
                                      22106 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      24114 !TSM:FPAR:NO REPLY
                                      24116 TSM:FPAR
                                      24118 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                      26126 !TSM:FPAR:FAIL
                                      26127 TSM:FAIL:CNT=2
                                      26129 TSM:FAIL:PDT
                                      etc...
                                      

                                      Scratches:

                                      //Gateway
                                      #define MY_DEBUG
                                      #define MY_RADIO_NRF24
                                      #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                      #define MY_GATEWAY_SERIAL
                                      #define MY_INCLUSION_MODE_FEATURE
                                      #define MY_INCLUSION_MODE_DURATION 120
                                      #define MY_DEFAULT_LED_BLINK_PERIOD 300
                                      
                                      
                                      #include <MySensors.h>
                                      
                                      void setup()
                                      {
                                      }
                                      
                                      void presentation()
                                      {
                                      }
                                      
                                      void loop()
                                      {
                                      }
                                      

                                      Node:

                                      #define MY_DEBUG 
                                      #define MY_RADIO_NRF24
                                      #define MY_REPEATER_FEATURE
                                      
                                      #include <SPI.h>
                                      #include <MyConfig.h>
                                      #include <MySensors.h>
                                      #include <Bounce2.h>
                                      
                                      #define RELAY_PIN  4  // Arduino Digital I/O pin number for relay 
                                      #define BUTTON_PIN  5  // Arduino Digital I/O pin number for button 
                                      #define CHILD_ID 10   // Id of the sensor (child)
                                      #define RELAY_ON 1
                                      #define RELAY_OFF 0
                                      
                                      Bounce debouncer = Bounce(); 
                                      int oldValue=0;
                                      bool state;
                                      
                                      MyMessage msg(CHILD_ID,V_LIGHT);
                                      
                                      void setup()  
                                      { 
                                        // Setup the button
                                        pinMode(BUTTON_PIN,INPUT);
                                      
                                        // Setup debouncer
                                        debouncer.attach(BUTTON_PIN);
                                        debouncer.interval(5);
                                      
                                        // set relay on when starting up
                                        pinMode(RELAY_PIN, OUTPUT);   
                                      
                                        state=true;
                                        digitalWrite(RELAY_PIN, RELAY_ON);
                                      }
                                      
                                      
                                      void presentation()  {
                                        // Send the sketch version information to the gateway and Controller
                                        sendSketchInfo("Relay & Button", "1.0");
                                      
                                        // Register all sensors to gw (they will be created as child devices)
                                        present(CHILD_ID, S_LIGHT);
                                      }
                                      
                                      
                                      void loop() 
                                      {
                                        debouncer.update();
                                        // Get the update value
                                        int value = debouncer.read();
                                        if (value != oldValue && value==0) {
                                            send(msg.set(state?false:true), true); // Send new state and request ack back
                                      
                                            Serial.println("zmiana value na 0");
                                      
                                            // Change relay state localy, anyway
                                            state = !state;
                                            digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
                                      
                                            Serial.print("state = ");
                                            Serial.println(state);
                                      
                                        
                                        }
                                        oldValue = value;
                                      } 
                                      
                                      
                                      void receive(const MyMessage &message) {
                                        if (message.isAck()) {
                                           Serial.println("This is an ack from gateway");
                                        }
                                      
                                        if (message.type == V_LIGHT) {
                                           // Change relay state
                                           state = message.getBool();
                                           digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
                                      
                                           // Write some debug info
                                           Serial.print("Incoming change for sensor:");
                                           Serial.print(message.sensor);
                                           Serial.print(", New status: ");
                                           Serial.println(message.getBool());
                                         } 
                                      }
                                      
                                      
                                      bjacobseB 1 Reply Last reply
                                      0
                                      • M Mario64

                                        Hi,

                                        I've got across similar problem. What works for you doesn't solve problem in my case.
                                        Decreasing power to PA_LEVEL_LOW or switching to MySensors v2.2.0-rc.2 gives no positive result.

                                        I have some experience with Arduino, but it is my first try with MySensors and Domoticz.

                                        If someone could advice how to cope with, thank you in advance.

                                        My Hardware:
                                        Arduino Nano, NRF21+ for GW & Node,
                                        the node is simple actuator: relay with button.

                                        GW output on Serial monitor:

                                        0;255;3;0;9;TSM:INIT
                                        0;255;3;0;9;TSF:WUR:MS=0
                                        0;255;3;0;9;TSM:INIT:TSP OK
                                        0;255;3;0;9;TSM:INIT:GW MODE
                                        0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
                                        0;255;3;0;9;MCO:REG:NOT NEEDED
                                        0;255;3;0;14;Gateway startup complete.
                                        0;255;0;0;18;2.1.1
                                        0;255;3;0;9;MCO:BGN:STP
                                        0;255;3;0;9;MCO:BGN:INIT OK,TS
                                        

                                        Node output on Serial Monitor:

                                        0 MCO:BGN:INIT REPEATER,CP=RNNRA--,VER=2.1.1
                                        3 TSM:INIT
                                        4 TSF:WUR:MS=0
                                        11 TSM:INIT:TSP OK
                                        13 TSM:FPAR
                                        15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        2023 !TSM:FPAR:NO REPLY
                                        2025 TSM:FPAR
                                        2027 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        4035 !TSM:FPAR:NO REPLY
                                        4037 TSM:FPAR
                                        4039 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        6047 !TSM:FPAR:NO REPLY
                                        6049 TSM:FPAR
                                        6051 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        8060 !TSM:FPAR:FAIL
                                        8061 TSM:FAIL:CNT=1
                                        8064 TSM:FAIL:PDT
                                        18067 TSM:FAIL:RE-INIT
                                        18069 TSM:INIT
                                        18076 TSM:INIT:TSP OK
                                        18078 TSM:FPAR
                                        18080 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        20088 !TSM:FPAR:NO REPLY
                                        20090 TSM:FPAR
                                        20092 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        22102 !TSM:FPAR:NO REPLY
                                        22104 TSM:FPAR
                                        22106 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        24114 !TSM:FPAR:NO REPLY
                                        24116 TSM:FPAR
                                        24118 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                        26126 !TSM:FPAR:FAIL
                                        26127 TSM:FAIL:CNT=2
                                        26129 TSM:FAIL:PDT
                                        etc...
                                        

                                        Scratches:

                                        //Gateway
                                        #define MY_DEBUG
                                        #define MY_RADIO_NRF24
                                        #define MY_RF24_PA_LEVEL RF24_PA_LOW
                                        #define MY_GATEWAY_SERIAL
                                        #define MY_INCLUSION_MODE_FEATURE
                                        #define MY_INCLUSION_MODE_DURATION 120
                                        #define MY_DEFAULT_LED_BLINK_PERIOD 300
                                        
                                        
                                        #include <MySensors.h>
                                        
                                        void setup()
                                        {
                                        }
                                        
                                        void presentation()
                                        {
                                        }
                                        
                                        void loop()
                                        {
                                        }
                                        

                                        Node:

                                        #define MY_DEBUG 
                                        #define MY_RADIO_NRF24
                                        #define MY_REPEATER_FEATURE
                                        
                                        #include <SPI.h>
                                        #include <MyConfig.h>
                                        #include <MySensors.h>
                                        #include <Bounce2.h>
                                        
                                        #define RELAY_PIN  4  // Arduino Digital I/O pin number for relay 
                                        #define BUTTON_PIN  5  // Arduino Digital I/O pin number for button 
                                        #define CHILD_ID 10   // Id of the sensor (child)
                                        #define RELAY_ON 1
                                        #define RELAY_OFF 0
                                        
                                        Bounce debouncer = Bounce(); 
                                        int oldValue=0;
                                        bool state;
                                        
                                        MyMessage msg(CHILD_ID,V_LIGHT);
                                        
                                        void setup()  
                                        { 
                                          // Setup the button
                                          pinMode(BUTTON_PIN,INPUT);
                                        
                                          // Setup debouncer
                                          debouncer.attach(BUTTON_PIN);
                                          debouncer.interval(5);
                                        
                                          // set relay on when starting up
                                          pinMode(RELAY_PIN, OUTPUT);   
                                        
                                          state=true;
                                          digitalWrite(RELAY_PIN, RELAY_ON);
                                        }
                                        
                                        
                                        void presentation()  {
                                          // Send the sketch version information to the gateway and Controller
                                          sendSketchInfo("Relay & Button", "1.0");
                                        
                                          // Register all sensors to gw (they will be created as child devices)
                                          present(CHILD_ID, S_LIGHT);
                                        }
                                        
                                        
                                        void loop() 
                                        {
                                          debouncer.update();
                                          // Get the update value
                                          int value = debouncer.read();
                                          if (value != oldValue && value==0) {
                                              send(msg.set(state?false:true), true); // Send new state and request ack back
                                        
                                              Serial.println("zmiana value na 0");
                                        
                                              // Change relay state localy, anyway
                                              state = !state;
                                              digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
                                        
                                              Serial.print("state = ");
                                              Serial.println(state);
                                        
                                          
                                          }
                                          oldValue = value;
                                        } 
                                        
                                        
                                        void receive(const MyMessage &message) {
                                          if (message.isAck()) {
                                             Serial.println("This is an ack from gateway");
                                          }
                                        
                                          if (message.type == V_LIGHT) {
                                             // Change relay state
                                             state = message.getBool();
                                             digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
                                        
                                             // Write some debug info
                                             Serial.print("Incoming change for sensor:");
                                             Serial.print(message.sensor);
                                             Serial.print(", New status: ");
                                             Serial.println(message.getBool());
                                           } 
                                        }
                                        
                                        
                                        bjacobseB Offline
                                        bjacobseB Offline
                                        bjacobse
                                        wrote on last edited by
                                        #19

                                        @mario64
                                        Which home automation system are you using?
                                        If using domoticz, then it's vital to accept new sensors, you find it setup->settings
                                        Hardware/Devices:
                                        Accept new Hardware Devices

                                        if this is disabled, no sensors are allowed to be created

                                        M 1 Reply Last reply
                                        0
                                        • bjacobseB bjacobse

                                          @mario64
                                          Which home automation system are you using?
                                          If using domoticz, then it's vital to accept new sensors, you find it setup->settings
                                          Hardware/Devices:
                                          Accept new Hardware Devices

                                          if this is disabled, no sensors are allowed to be created

                                          M Offline
                                          M Offline
                                          Mario64
                                          wrote on last edited by Mario64
                                          #20

                                          Hi @bjacobse,

                                          thank you for answer. I'm back to my project after e few days.
                                          Actually, the "Accept new Hardware Devices" switch is on. I also used the "Alow for 5 minutes" button. Let me share more details:

                                          • pls find log of Domoticz:
                                           2018-01-22 09:55:34.871 MySensors: retrying in 30 seconds...
                                          2018-01-22 09:56:00.874 MySensors: Serial Worker stopped...
                                          2018-01-22 09:56:11.130 New sensors allowed for 5 minutes...
                                          2018-01-22 09:56:43.077 MySensors: Using serial port: /dev/ttyUSB0
                                          2018-01-22 10:02:38.123 MySensors: Serial Worker stopped...
                                          2018-01-22 10:02:39.134 MySensors: Using serial port: /dev/ttyUSB0
                                          2018-01-22 10:03:38.156 New sensors allowed for 5 minutes...
                                          2018-01-22 10:04:00.048 Error: Gwx hardware (2) nothing received for more than 1 Minute!....
                                          2018-01-22 10:04:01.049 Error: Restarting: Gwx
                                          2018-01-22 10:04:01.146 MySensors: Serial Worker stopped...
                                          2018-01-22 10:04:02.157 MySensors: Using serial port: /dev/ttyUSB0
                                          2018-01-22 10:05:30.219 Error: Gwx hardware (2) nothing received for more than 1 Minute!....
                                          2018-01-22 10:05:31.220 Error: Restarting: Gwx
                                          2018-01-22 10:05:32.170 MySensors: Serial Worker stopped...
                                          2018-01-22 10:05:33.181 MySensors: Using serial port: /dev/ttyUSB0
                                          2018-01-22 10:07:00.204 Error: Gwx hardware (2) nothing received for more than 1 Minute!.... 
                                          etc
                                          
                                          • screen shots:
                                          • list itemSetup->Hardware:
                                            ![Gateway settings]https://drive.google.com/file/d/1NjJZMlaM98XaZ-UCY93pyeHcKbT7ZZoh/view?usp=sharing

                                          • list itemSetup->Hardware Gwx setup:
                                            ![Gwx Setup]https://drive.google.com/file/d/1vDVDcLGaGK_g3-uYQrl_DnlHlbvjq87Z/view?usp=sharing

                                          • list itemSetup->Settings:
                                            ![Domoticz Settings]https://drive.google.com/file/d/15bkfnHx6rEcqRnTvLVOydwPK63dy83xe/view?usp=sharing

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


                                          29

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 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
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular