Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. vga
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by vga

    • RE: WaterPulseMeter: onPulse gets called on rising AND falling !?

      thanks mfalkvidd and since!

      now i´ve added the following to the onPulse function:

      delay(150);
        if(digitalRead(DIGITAL_INPUT_SENSOR) == HIGH){
          Serial.println("onPulse called");
          pulseCount++; 
        }
      

      now it is working, thanks for the support to all of you! 🙂

      btw: is there a way to reset the volume value, without running the cleareeprom sketch, so that i can keep the sensors node id!? 🙂

      posted in Troubleshooting
      vga
      vga
    • RE: WaterPulseMeter: onPulse gets called on rising AND falling !?

      I connected the sensor to D3 pin.

      posted in Troubleshooting
      vga
      vga
    • RE: WaterPulseMeter: onPulse gets called on rising AND falling !?

      thx sundberg84 for your fast response.

      meanwhile i added Serial.println("onPulse called"); before pulseCount++ in onPulse-function.
      The Serial Monitor confirms, the above problem.

      I turn on the water tap, till the position of my water counter wheel is exactly in position to trigger the RISING interrupt of the sensor, then i close the water tap. So the signal is constantly high. the serialmonitor prints, onPulse called, everything seems ok. after a while (seconds or minutes, tried both) i turn on the water tap again, till the position of the water counter wheel lets FALLING the signal from sensor, and turn of the water tap again. So signal is constantly low. In this moment the monitor prints also "onPulse called".

      Due to the described behavior I do not think it is up to the interval time, or?

      posted in Troubleshooting
      vga
      vga
    • WaterPulseMeter: onPulse gets called on rising AND falling !?

      Hi,
      I build up a WaterPulseMeterSensor as the original MySensors example:
      Controller:Arduino nano
      Sensor: TCRT5000 IR Barrier Line Track sensor
      Powered with USB-powersupply.
      Sketch: Original Sensor example sketch - only changed the Interrupt mode from "FALLING" to RISING", as you can see below.

      
      #define MY_DEBUG                              
      #define MY_RADIO_NRF24                          
      #define MY_RF24_PA_LEVEL RF24_PA_MAX          
      #define MY_PARENT_NODE_ID 0                     
      #define MY_PARENT_NODE_IS_STATIC                
      
      #include <SPI.h>
      #include <MySensors.h>  
      
      #define DIGITAL_INPUT_SENSOR 3                  // The digital input you attached your sensor.  (Only 2 and 3 generates interrupt!)
      
      #define PULSE_FACTOR 1000                       // Nummber of blinks per m3 of your meter (One rotation/liter)
      
      #define SLEEP_MODE false                        // flowvalue can only be reported when sleep mode is false.
      
      #define MAX_FLOW 40                             // Max flow (l/min) value to report. This filters outliers.
      
      #define CHILD_ID 1                              // Id of the sensor child
      
      unsigned long SEND_FREQUENCY = 30000;           // Minimum time between send (in milliseconds). We don't want to spam the gateway.
      
      MyMessage flowMsg(CHILD_ID,V_FLOW);
      MyMessage volumeMsg(CHILD_ID,V_VOLUME);
      MyMessage lastCounterMsg(CHILD_ID,V_VAR1);
      
      double ppl = ((double)PULSE_FACTOR)/1000;        // Pulses per liter
      
      volatile unsigned long pulseCount = 0;   
      volatile unsigned long lastBlink = 0;
      volatile double flow = 0;  
      boolean pcReceived = false;
      unsigned long oldPulseCount = 0;
      unsigned long newBlink = 0;   
      double oldflow = 0;
      double volume =0;                     
      double oldvolume =0;
      unsigned long lastSend =0;
      unsigned long lastPulse =0;
      
      void setup()  
      {  
        // initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion) 
        pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP);
        
        pulseCount = oldPulseCount = 0;
      
        // Fetch last known pulse count value from gw
        request(CHILD_ID, V_VAR1);
      
        lastSend = lastPulse = millis();
      
        attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING);
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Water Meter", "1.1");
      
        // Register this device as Waterflow sensor
        present(CHILD_ID, S_WATER);       
      }
      
      void loop()     
      { 
        unsigned long currentTime = millis();
        
          // Only send values at a maximum frequency or woken up from sleep
        if (SLEEP_MODE || (currentTime - lastSend > SEND_FREQUENCY))
        {
          lastSend=currentTime;
          
          if (!pcReceived) {
            //Last Pulsecount not yet received from controller, request it again
            request(CHILD_ID, V_VAR1);
            return;
          }
      
          if (!SLEEP_MODE && flow != oldflow) {
            oldflow = flow;
      
            Serial.print("l/min:");
            Serial.println(flow);
      
            // Check that we dont get unresonable large flow value. 
            // could hapen when long wraps or false interrupt triggered
            if (flow<((unsigned long)MAX_FLOW)) {
              send(flowMsg.set(flow, 2));                   // Send flow value to gw
            }  
          }
        
          // No Pulse count received in 2min 
          if(currentTime - lastPulse > 120000){
            flow = 0;
          } 
      
          // Pulse count has changed
          if ((pulseCount != oldPulseCount)||(!SLEEP_MODE)) {
            oldPulseCount = pulseCount;
      
            Serial.print("pulsecount:");
            Serial.println(pulseCount);
      
            send(lastCounterMsg.set(pulseCount));                  // Send  pulsecount value to gw in VAR1
      
            double volume = ((double)pulseCount/((double)PULSE_FACTOR));     
            if ((volume != oldvolume)||(!SLEEP_MODE)) {
              oldvolume = volume;
      
              Serial.print("volume:");
              Serial.println(volume, 3);
              
              send(volumeMsg.set(volume, 3));               // Send volume value to gw
            } 
          }
        }
        if (SLEEP_MODE) {
          sleep(SEND_FREQUENCY);
        }
      }
      
      void receive(const MyMessage &message) {
        if (message.type==V_VAR1) {
          unsigned long gwPulseCount=message.getULong();
          pulseCount += gwPulseCount;
          flow=oldflow=0;
          Serial.print("Received last pulse count from gw:");
          Serial.println(pulseCount);
          pcReceived = true;
        }
      }
      
      void onPulse()     
      {
        if (!SLEEP_MODE)
        {
          unsigned long newBlink = micros();   
          unsigned long interval = newBlink-lastBlink;
          
          if (interval!=0)
          {
            lastPulse = millis();
            if (interval<500000L) {
              // Sometimes we get interrupt on RISING,  500000 = 0.5sek debounce ( max 120 l/min)
              return;   
            }
            flow = (60000000.0 /interval) / ppl;
          }
          lastBlink = newBlink;
        }
        pulseCount++; 
      }
      

      Here is what happens:
      When DigitalSensorPIN is RISING, the onPulse function is called as expected, but when DigitalSensorPIN is FALLING, the onPulse function is called also, which should not happen, right!??
      So this gives me a wrong consumption of 2liters per rotation, instead of 1liter.

      Has someone any idea what is going wrong?

      posted in Troubleshooting
      vga
      vga
    • SaveState(): How to save and load bigger value

      Hi,
      i have build an water flow sensor and want to save the total flow value in mL in the eeprom.
      Is there a way to use the saveState and loadState from MySensors v2.0? The value will grow a long number, so it´s not only a "state" like 0/1 from switch/relay.

      Thanks and best regards,
      vga

      posted in Development
      vga
      vga
    • RE: first tries with MySensors v2.0: problem staring up.

      ok, thank you Yveaux for your help!
      to understand the mechanism, when the sensor node starts to search for parent again, why doesn´t it find the parent node, which used before?

      posted in Troubleshooting
      vga
      vga
    • RE: first tries with MySensors v2.0: problem staring up.

      Ah, Thanks!

      So, i have do i have to set the NODE_ID at Gateway to (i.e. 0), to have a fixed ID, to which i connect the sensor node, if i want it static, right?

      posted in Troubleshooting
      vga
      vga
    • RE: first tries with MySensors v2.0: problem staring up.

      yes, for testing without controller i set the NODE_ID manual, and now it works.
      Transmit works now. But when sensor was out of range, transmit fails some times, and sensor comes back into range, the transmit doesn't works again.

      SP:MSG:SEND 1-1-0-0 s=0,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=ok:0
      0
      !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=fail:1
      1
      !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=fail:0
      0
      !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=16,pt=2,l=2,sg=0,ft=2,st=fail:1
      1
      !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=16,pt=2,l=2,sg=0,ft=3,st=fail:0
      0
      !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=16,pt=2,l=2,sg=0,ft=4,st=fail:1
      1
      !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=16,pt=2,l=2,sg=0,ft=5,st=fail:0
      !TSM:UPL FAIL, SNP
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      0
      !TSP:SEND:TNR
      1
      !TSP:SEND:TNR
      
      posted in Troubleshooting
      vga
      vga
    • RE: first tries with MySensors v2.0: problem staring up.

      i haven´t set a MY_NODE_ID, the myconfig is set to auto, so i thought this will set automatically. Or is this only, when gateway is connected to controller?

      posted in Troubleshooting
      vga
      vga
    • first tries with MySensors v2.0: problem staring up.

      Hi,
      i have worked with MySensors v1.5 till now, but i started to begin working with v2.0.

      I have made a test SerialGateway (nearly example sketch) with an arduino nano, and a test sensor node with an arduino Pro Mini 3,3V.

      When starting both arduinos, on the Sensor node i get the following output:

      TSM:PDT
      TSM:INIT
      TSM:RADIO:OK
      TSM:FPAR
      TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSP:MSG:READ 0-0-255 s=255,c=3,t=8,pt=1,l=1,sg=0:0
      TSP:MSG:FPAR RES (ID=0, dist=0)
      TSP:MSG:PAR OK (ID=0, dist=1)
      TSM:FPAR:OK
      TSM:ID
      TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
      TSM:ID
      TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
      TSM:ID
      TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
      TSM:ID
      TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
      !TSM:CHKID:FAIL (ID=255)
      !TSM:FAILURE
      TSM:PDT
      

      What das that mean? (especially the "!TSM:CHKID_FAIL" and "...:FAILURE"
      My Gateway is not connected to any controller, just want to check, if my Sensor node with the sensor hardware works (serial outputs) but the only thing i get is this.

      Do i have to fully implement the mySensor Network, also the controller connection, or is there a way to test my Sensor node at first, then the communication with the gateway only, and at least put it on my controller?

      posted in Troubleshooting
      vga
      vga
    • NRF24L01+PA+LNA SMD: anyone tried it?

      Hi,
      does anyone have made experience with the NRF24L01+PA+LNA ?

      looking for a better range but not with big antennas.
      Also tried the wire-mod, but does´t get really much more range with that.
      This module looks like a good idea to me, but want to ask id someone tested it already:

      http://www.ebay.de/itm/2-4G-NRF24L01-PA-LNA-Wireless-Module-with-Ceramic-Antenna-1-27mm-for-Arduino-d/251688770656?_trksid=p2141725.c100338.m3726&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D20150313114020%26meid%3D86e3c14b5de64baebdbb4ceede9a6350%26pid%3D100338%26rk%3D7%26rkt%3D19%26sd%3D311428791815

      posted in Hardware
      vga
      vga
    • RE: Arduino Pro mini 3,3V + NRF24L01+: Can i change Pins?

      ah, thanks mfalkvidd, thats what i´m looking for!

      posted in Hardware
      vga
      vga
    • Arduino Pro mini 3,3V + NRF24L01+: Can i change Pins?

      Hi together,
      just have a simple question:

      is it possible to change the Pins to connect the NRF24L01+ to my Arduino Pro Mini 3,3V, or is there maybe a special function on the configured Pins, so only these Pins are usable?

      Thanks and best regards!

      posted in Hardware
      vga
      vga
    • RE: NRF24L01+: bad range of few meters

      i´ve got the solution!

      in MyConfig.h i have set:

      #define RF24_PA_LEVEL_GW   RF24_PA_MAX
      

      befor it it was LOW! 😏

      posted in Troubleshooting
      vga
      vga
    • RE: NRF24L01+: bad range of few meters

      sure, as i said, i don´t use the radio.set methods.

      So are there any other hardware tipps?

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      thanks alexsh1.

      One more thing:
      Gateway is a Arduino Pro Mini 3,3V and powered with a connected FTDI 3,3V Breakout to USB from Raspberry Pi 2.
      Sensor node is also a Arduino Pro Mini 3,3V but powered with a FTDI 5V Breakout (the only second one i have at moment) which is connected to my MacBooks´USB.

      Is this a acceptable way?

      So at the end i have to buy a "W" Module, and try it again?

      posted in Troubleshooting
      vga
      vga
    • RE: NRF24L01+: bad range of few meters

      @Yveaux said:

      @vga if you don't change the channel it will default to 76.
      Why are you configuring the nRF directly by calling the driver methods? Are you using the mysensors library at all?

      do you mean the radio.set lines?
      this is only a quote from another post. i don't do it this way.
      i´m using My Sensors library v2.0 beta.

      I´ve found 3 parameters in the MyConfig.h, and they all set by default, as i see.
      But ni can´t find the payload size. Can i set it anywhere, or see what value it is set to?

      posted in Troubleshooting
      vga
      vga
    • RE: NRF24L01+: bad range of few meters

      thanks, i would take channel 76, but how can i set these parameters, also the other ones?

      in MyConfig.h i see the following:

      #define MY_RF24_CHANNEL	76
      #define MY_RF24_DATARATE RF24_250KBPS
      #define MY_RF24_PA_LEVEL RF24_PA_MAX
      

      ...but what about the PayloadSize? can i set this too?

      posted in Troubleshooting
      vga
      vga
    • NRF24L01+: bad range of few meters

      Hi everyone,

      i´m using the following setup:

      Controller:
      Raspberry Pi 2 B, powered with an USB- Power-Supply Max. 2A

      Serial Gateway (v1.5):
      Arduino Nano 5V directly connected via USB,
      NRF24L01+ with SMA Antenna direct soldered to the Arduino, capacitor 0,47uF between GND and Vin

      Sensor-Node (v1.5):
      Arduino Pro Mini 3,3V, powered with new a battery: (one "SAFT" AA-Format cell, 3,6V 2000mAh)
      NRF24L01+ without external Antenna (and also tried the mod with soldered 83,3mm wire antenna), capacitor 0,47uF between GND and Vin

      Environment:
      Controller and gateway indoor directly behind a window (double shielded), sensor outside:
      5m away from window: connection OK.
      7m away from window: connection FAIL.

      What can i do, for better range:?

      • Is there a better way for powering the gateway or the battery sensor (but sensor needs to by battery powered, and power efficient)?
      • Any other hardware mods?
      • I´ve read in another post something about NRF24-library settings:
        radio.setPALevel(RF24_PA_MAX);
        radio.setDataRate(RF24_250KBPS);
        radio.setPayloadSize(4);
        radio.setChannel(2);
        radio.setRetries(15, 15);
      

      Is there a way to set these parameters via MySensors Library?

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      yes, from Gateway and Sensore-Node now has wire antennas.

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      @fets said:

      no it's 86.4mm (= (3 10^8 / (868 10^6)) / 4)

      Thank you, just added the antennas. ...but also no connection.

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      @fets said:

      yes it is

      sorry, thought it is possible for function test if there are no antennas attached to it, if gateway and sensor are side by side.

      So, for making it real, is this the correct length for my transceiver:
      868 1/4 wave = 82.2mm ? (length including the soldered part of the wire?)

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      Thanks alexsh1 for your posts!

      @alexsh1 said:

      do you have antennas and what type please?

      I don´t have any antenna connected to the transceiver. Is this a problem?

      @alexsh1 said:

      Double and triple check your wiring.

      ...i can´t remember, how often i´ve checked it.

      @alexsh1 said:

      Which version of MySensors are you using?

      currently i´m using 2.0beta

      @alexsh1 said:

      Can you pleas post your MyConfig.h?
      In your sketch you have to do the following:

      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      
      

      I´ve added the second line to my sketches in gateway and sensor-node, but also no success.

      here is my MyConfig.h

      /*
       * 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.
       */
      
      /**
       * @file MyConfig.h
       *
       * MySensors specific configurations
       */
      #ifndef MyConfig_h
      #define MyConfig_h
      #include <stdint.h>
      
      
      /**********************************
      *  Serial and debug options
      ***********************************/
      
      // Enable MY_DEBUG in sketch to show debug prints. This option will add a lot to the size of the
      // final sketch but is helpful to see what is actually is happening during development
      //#define MY_DEBUG
      
      // Enable MY_SPECIAL_DEBUG in sketch to activate I_DEBUG messages if MY_DEBUG is disabled.
      // I_DEBUG requests are:
      // R: routing info (only repeaters): received msg XXYY (as stream), where XX is the node and YY the routing node
      // V: CPU voltage
      // F: CPU frequency
      // M: free memory
      // E: clear MySensors EEPROM area and reboot (i.e. "factory" reset)
      //#define MY_SPECIAL_DEBUG
      
      // Enable MY_DEBUG_VERBOSE_SIGNING flag for verbose debug prints related to signing.
      // Requires DEBUG to be enabled.
      // This will add even more to the size of the final sketch!
      //#define MY_DEBUG_VERBOSE_SIGNING
      
      // Enable this in sketch if you want to use TX(1), RX(0) as normal I/O pin
      //#define MY_DISABLED_SERIAL
      
      // Enable MY_CORE_ONLY flag if you want to use core functions without loading the framework
      //#define MY_CORE_ONLY
      
      // Turn off debug if serial pins is used for other stuff
      #ifdef MY_DISABLED_SERIAL
      #undef MY_DEBUG
      #endif
      
      /**
       * @def MY_BAUD_RATE
       * @brief Serial output baud rate (debug prints and serial gateway speed).
       */
      #ifndef MY_BAUD_RATE
      #define MY_BAUD_RATE 115200
      #endif
      
      // Disables over-the-air reset of node
      //#define MY_DISABLE_REMOTE_RESET
      
      /**********************************
      *  Radio selection and node config
      ***********************************/
      
      // Selecting uplink transport layer is optional (for a gateway node).
      
      //#define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      //#define MY_RS485
      
      /**
       * @def MY_NODE_ID
       * @brief Node id defaults to AUTO (tries to fetch id from controller).
       */
      #ifndef MY_NODE_ID
      #define MY_NODE_ID AUTO
      #endif
      
      /**
       * @def MY_PARENT_NODE_ID
       * @brief Node parent defaults to AUTO (tries to find a parent automatically).
       */
      #ifndef MY_PARENT_NODE_ID
      #define MY_PARENT_NODE_ID AUTO
      #endif
      
      // Enables repeater functionality (relays messages from other nodes)
      // #define MY_REPEATER_FEATURE
      
      /**
       * @def MY_SMART_SLEEP_WAIT_DURATION
       * @brief The wait period before going to sleep when using smartSleep-functions.
       *
       * This period has to be long enough for controller to be able to send out
       * potential buffered messages.
       */
      #ifndef MY_SMART_SLEEP_WAIT_DURATION
      #define MY_SMART_SLEEP_WAIT_DURATION 500
      #endif
      
      /**********************************
      *  Over the air firmware updates
      ***********************************/
      
      // Enable MY_OTA_FIRMWARE_FEATURE in sketch to allow safe over-the-air firmware updates.
      // This feature requires external flash and the DualOptiBoot boot-loader.
      // Note: You can still have OTA FW updates without external flash but it
      // requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
      //#define MY_OTA_FIRMWARE_FEATURE
      
      /**
       * @def MY_OTA_FLASH_SS
       * @brief Slave select pin for external flash.
       */
      #ifndef MY_OTA_FLASH_SS
      #define MY_OTA_FLASH_SS 8
      #endif
      
      /**
       * @def MY_OTA_FLASH_JDECID
       * @brief Flash jdecid.
       */
      #ifndef MY_OTA_FLASH_JDECID
      #define MY_OTA_FLASH_JDECID 0x1F65
      #endif
      
      
      /**********************************
      *  Gateway config
      ***********************************/
      
      /**
       * @def MY_GATEWAY_MAX_RECEIVE_LENGTH
       * @brief Max buffersize needed for messages coming from controller.
       */
      #ifndef MY_GATEWAY_MAX_RECEIVE_LENGTH
      #define MY_GATEWAY_MAX_RECEIVE_LENGTH 100
      #endif
      
      /**
       * @def MY_GATEWAY_MAX_SEND_LENGTH
       * @brief Max buffer size when sending messages.
       */
      #ifndef MY_GATEWAY_MAX_SEND_LENGTH
      #define MY_GATEWAY_MAX_SEND_LENGTH 120
      #endif
      
      /**
       * @def MY_GATEWAY_MAX_CLIENTS
       * @brief Max number of parallel clients (sever mode).
       */
      #ifndef MY_GATEWAY_MAX_CLIENTS
      #define MY_GATEWAY_MAX_CLIENTS 1
      #endif
      
      
      
      /**********************************
      *  Information LEDs blinking
      ***********************************/
      // This feature enables LEDs blinking on message receive, transmit
      // or if some error occurred. This was commonly used only in gateways,
      // but now can be used in any sensor node. Also the LEDs can now be
      // disabled in the gateway.
      
      //#define MY_LEDS_BLINKING_FEATURE
      
      // The following setting allows you to inverse the blinking feature MY_LEDS_BLINKING_FEATURE
      // When MY_WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches
      // off when blinking
      
      //#define MY_WITH_LEDS_BLINKING_INVERSE
      
      // The following defines can be used to set the port pin, that the LED is connected to
      // If one of the following is defined here, or in the sketch, MY_LEDS_BLINKING_FEATURE will be
      // enabled by default. (Replace x with the pin number you have the LED on)
      //#define MY_DEFAULT_ERR_LED x
      //#define MY_DEFAULT_TX_LED x
      //#define MY_DEFAULT_RX_LED x
      
      /**********************************************
      *  Gateway inclusion button/mode configuration
      **********************************************/
      // Enabled inclusion mode feature
      //#define MY_INCLUSION_MODE_FEATURE
      
      // Enables inclusion-mode button feature on the gateway device
      //#define MY_INCLUSION_BUTTON_FEATURE
      
      // Disable inclusion mode button if inclusion mode feature is not enabled
      #ifndef MY_INCLUSION_MODE_FEATURE
      #undef MY_INCLUSION_BUTTON_FEATURE
      #endif
      
      /**
       * @def MY_INCLUSION_MODE_BUTTON_PIN
       * @brief The default input pin used for the inclusion mode button.
       */
      #ifndef MY_INCLUSION_MODE_BUTTON_PIN
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_INCLUSION_MODE_BUTTON_PIN 5
      	#else
      		#define MY_INCLUSION_MODE_BUTTON_PIN 3
      	#endif
      #endif
      
      /**
       * @def MY_INCLUSION_MODE_DURATION
       * @brief Number of seconds (default one minute) inclusion mode should be enabled.
       */
      
      #ifndef MY_INCLUSION_MODE_DURATION
      #define MY_INCLUSION_MODE_DURATION 60
      #endif
      
      /**
       * @def MY_INCLUSION_BUTTON_PRESSED
       * @brief The logical level indicating a pressed inclusion mode button.
       */
      #if defined(MY_INCLUSION_BUTTON_EXTERNAL_PULLUP)
      #define MY_INCLUSION_BUTTON_PRESSED HIGH
      #else
      #define MY_INCLUSION_BUTTON_PRESSED LOW
      #endif
      
      /**********************************
      *  Message Signing Settings
      ***********************************/
      /**
       * @def MY_SIGNING_ATSHA204
       * @brief Enables HW backed signing functionality in library.
       *
       * For any signing related functionality to be included, this define or @ref MY_SIGNING_SOFT has to be enabled.
       */
      //#define MY_SIGNING_ATSHA204
      
      /**
       * @def MY_SIGNING_SOFT
       * @brief Enables SW backed signing functionality in library.
       *
       * For any signing related functionality to be included, this define or @ref MY_SIGNING_ATSHA204 has to be enabled.
       */
      //#define MY_SIGNING_SOFT
      
      /**
       * @def MY_SIGNING_REQUEST_SIGNATURES
       * @brief Enable this to inform gateway to sign all messages sent to this node.
       *
       * If used for a gateway, gateway will only request signatures from nodes that in turn
       * request signatures from gateway.
       */
      //#define MY_SIGNING_REQUEST_SIGNATURES
      
      /**
       * @def MY_VERIFICATION_TIMEOUT_MS
       * @brief Define a suitable timeout for a signature verification session
       *
       * Consider the turnaround from a nonce being generated to a signed message being received
       * which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
       */
      #ifndef MY_VERIFICATION_TIMEOUT_MS
      #define MY_VERIFICATION_TIMEOUT_MS 5000
      #endif
      
      /**
       * @def MY_SIGNING_NODE_WHITELISTING
       * @brief Enable to turn on whitelisting
       *
       * When enabled, a signing node will salt the signature with it's unique signature and nodeId.<br>
       * The verifying node will look up the sender in a local table of trusted nodes and
       * do the corresponding salting in order to verify the signature.<br>
       * For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
       * nodes have to implement whitelisting for this to work.<br>
       * Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
       * to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
       * for the sender in it's whitelist). The whitelist to use is defined as the value of the flag.
       */
      //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
      
      /**
       * @def MY_SIGNING_ATSHA204_PIN
       * @brief Atsha204 default pin setting
       *
       * Pin where ATSHA204 is attached
       */
      #ifndef MY_SIGNING_ATSHA204_PIN
      #define MY_SIGNING_ATSHA204_PIN 17
      #endif
      
      /**
       * @def MY_SIGNING_SOFT_RANDOMSEED_PIN
       * @brief Pin used for random generation in soft signing
       *
       * Do not connect anything to this when soft signing is enabled
       */
      #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #endif
      
      /**********************************
      *  RS485 Driver Defaults
      ***********************************/
      
      /**
       * @def MY_RS485_BAUD_RATE
       * @brief The RS485 BAUD rate.
       */
      #ifndef MY_RS485_BAUD_RATE
      #define MY_RS485_BAUD_RATE 9600
      #endif
      
      /**
       * @def MY_RS485_MAX_MESSAGE_LENGTH
       * @brief The maximum message length used for RS485.
       */
      #ifndef MY_RS485_MAX_MESSAGE_LENGTH
      #define MY_RS485_MAX_MESSAGE_LENGTH 40
      #endif
      
      /**********************************
      *  NRF24L01P Driver Defaults
      ***********************************/
      
      // Enables RF24 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
      //#define MY_RF24_ENABLE_ENCRYPTION
      
      /**
       * @def MY_DEBUG_VERBOSE_RF24
       * @brief Enable MY_DEBUG_VERBOSE_RF24 flag for verbose debug prints related to the RF24 driver. Requires DEBUG to be enabled.
       */ 
      //#define MY_DEBUG_VERBOSE_RF24
      
      /**
       * @def MY_RF24_SPI_MAX_SPEED
       * @brief MY_RF24_SPI_MAX_SPEED to overrule default nRF24L01+ SPI speed.
       */ 
      //#define MY_RF24_SPI_MAX_SPEED 4000000
      
      /**
       * @def MY_RF24_CE_PIN
       * @brief Default RF24 chip enable pin setting. Override in sketch if needed.
       */
      #ifndef MY_RF24_CE_PIN
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_RF24_CE_PIN 4
      	#elif defined(ARDUINO_ARCH_SAMD)
      		#define MY_RF24_CE_PIN 27
      	#else
      		#define MY_RF24_CE_PIN 9
      	#endif
      #endif
      
      /**
       * @def MY_RF24_CS_PIN
       * @brief Default RF24 chip select pin setting. Override in sketch if needed.
       */
      #ifndef MY_RF24_CS_PIN
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_RF24_CS_PIN 15
      	#elif defined(ARDUINO_ARCH_SAMD)
      		#define MY_RF24_CS_PIN 3
      	#else
      		#define MY_RF24_CS_PIN 10
      	#endif
      #endif
      
      /**
       * @def MY_RF24_PA_LEVEL
       * @brief Default RF24 PA level. Override in sketch if needed.
       */
      #ifndef MY_RF24_PA_LEVEL
      #define MY_RF24_PA_LEVEL RF24_PA_MAX
      #endif
      
      /**
       * @def MY_RF24_CHANNEL
       * @brief RF channel for the sensor net, 0-125.
       * Frequence: 2400 Mhz - 2525 Mhz Channels: 126
       * http://www.mysensors.org/radio/nRF24L01Plus.pdf
       * 0 => 2400 Mhz (RF24 channel 1)
       * 1 => 2401 Mhz (RF24 channel 2)
       * 76 => 2476 Mhz (RF24 channel 77)
       * 83 => 2483 Mhz (RF24 channel 84)
       * 124 => 2524 Mhz (RF24 channel 125)
       * 125 => 2525 Mhz (RF24 channel 126)
       * In some countries there might be limitations, in Germany for example only the range 2400,0 - 2483,5 Mhz is allowed
       * http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
       */
      #ifndef MY_RF24_CHANNEL
      #define MY_RF24_CHANNEL	76
      #endif
      
      /**
       * @def MY_RF24_DATARATE
       * @brief RF24 datarate (RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps or RF24_2MBPS for 2Mbps).
       */
      #ifndef MY_RF24_DATARATE
      #define MY_RF24_DATARATE RF24_250KBPS
      #endif
      
      /**
       * @def MY_RF24_BASE_RADIO_ID
       * @brief RF24 radio network identifier.
       *
       * This acts as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
       */
      #ifndef MY_RF24_BASE_RADIO_ID
      #define MY_RF24_BASE_RADIO_ID 0x00,0xFC,0xE1,0xA8,0xA8
      #endif
      
      /**
       * @def MY_RF24_ADDR_WIDTH
       * @brief RF24 address width.
       *
       * This defines the width of the base address.
       */
      #ifndef MY_RF24_ADDR_WIDTH
      #define MY_RF24_ADDR_WIDTH 5
      #endif
      
      /**
       * @def MY_RF24_SANITY_CHECK
       * @brief RF24 sanity check to verify functional RF module
       *
       * This reads back and compares configuration registers. Disable if using non-P modules
       */
      #define MY_RF24_SANITY_CHECK
      
      // Enable SOFTSPI for NRF24L01, useful for the W5100 Ethernet module
      //#define MY_SOFTSPI
      
      /**
       * @def MY_SOFT_SPI_SCK_PIN
       * @brief Soft SPI SCK pin.
       */
      #ifndef MY_SOFT_SPI_SCK_PIN
      #define MY_SOFT_SPI_SCK_PIN 14
      #endif
      
      /**
       * @def MY_SOFT_SPI_MISO_PIN
       * @brief Soft SPI MISO pin.
       */
      #ifndef MY_SOFT_SPI_MISO_PIN
      #define MY_SOFT_SPI_MISO_PIN 16
      #endif
      
      /**
       * @def MY_SOFT_SPI_MOSI_PIN
       * @brief Soft SPI MOSI pin.
       */
      #ifndef MY_SOFT_SPI_MOSI_PIN
      #define MY_SOFT_SPI_MOSI_PIN 15
      #endif
      
      /**********************************
      *  RFM69 Driver Defaults
      ***********************************/
      
      /**
       * @def MY_RFM69_FREQUENCY
       * @brief RFM69 frequency to use (RF69_433MHZ for 433MHz, RF69_868MHZ for 868MHz or RF69_915MHZ for 915MHz).
       *
       * This must match the hardware version of the RFM69 radio.
       */
      #ifndef MY_RFM69_FREQUENCY
      #define MY_RFM69_FREQUENCY   RF69_868MHZ
      #endif
      
      /**
       * @def MY_IS_RFM69HW
       * @brief Enable this if you're running the RFM69HW model.
       */
      //#define MY_IS_RFM69HW
      
      /**
       * @def MY_RFM69HW
       * @brief Set to true if @ref MY_IS_RFM69HW is set.
       */
      #ifdef MY_IS_RFM69HW
      	#define MY_RFM69HW true
      #else
      	#define MY_RFM69HW false
      #endif
      
      /**
       * @def MY_RFM69_NETWORKID
       * @brief RFM69 Network ID. Use the same for all nodes that will talk to each other.
       */
      #ifndef MY_RFM69_NETWORKID
      #define MY_RFM69_NETWORKID     100
      #endif
      
      /**
       * @def MY_RF69_IRQ_PIN
       * @brief RF69 IRQ pin.
       */
      #ifndef MY_RF69_IRQ_PIN
      #define MY_RF69_IRQ_PIN RF69_IRQ_PIN
      #endif
      
      /**
       * @def MY_RF69_SPI_CS
       * @brief RF69 SPI chip select pin.
       */
      #ifndef MY_RF69_SPI_CS
      #define MY_RF69_SPI_CS RF69_SPI_CS
      #endif
      
      /**
       * @def MY_RF69_IRQ_NUM
       * @brief RF69 IRQ pin number.
       */
      #ifndef MY_RF69_IRQ_NUM
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
      	#else
      		#define MY_RF69_IRQ_NUM RF69_IRQ_NUM
      	#endif
      #endif
      
      // Enables RFM69 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
      //#define MY_RFM69_ENABLE_ENCRYPTION
      
      /**************************************
      * Ethernet Gateway Transport  Defaults
      ***************************************/
      
      // The gateway options available
      //#define MY_GATEWAY_W5100
      //#define MY_GATEWAY_ENC28J60
      //#define MY_GATEWAY_ESP8266
      
      /**
       * @def MY_PORT
       * @brief The Ethernet TCP/UDP port to open on controller or gateway.
       */
      #ifndef MY_PORT
      #define MY_PORT 5003
      #endif
      
      // Static ip address of gateway (if this is disabled, DHCP will be used)
      //#define MY_IP_ADDRESS 192,168,178,66
      
      // Enables UDP mode for Ethernet gateway (W5100)
      //#define MY_USE_UDP
      
      /**
       * @def MY_IP_RENEWAL_INTERVAL
       * @brief DHCP, default renewal setting in milliseconds.
       */
      #ifndef MY_IP_RENEWAL_INTERVAL
      #define MY_IP_RENEWAL_INTERVAL 60000
      #endif
      
      /**
       * @def MY_MAC_ADDRESS.
       * @brief Ethernet MAC address.
       *
       * This needs to be unique on the network.
       */
      #ifndef MY_MAC_ADDRESS
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
      #endif
      
      // Controller ip-address, if this is defined, gateway will act as a client trying to contact controller on MY_PORT.
      // If MY_CONTROLLER_IP_ADDRESS is left un-defined, gateway acts as server allowing incoming connections.
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
      
      /**
       * @defgroup MyLockgrp MyNodeLock
       * @ingroup internals
       * @{
       * @brief The node lock feature is a security related feature. It locks a node that suspect itself for being
       * under some form of attack.
       *
       * This is achieved by having a counter stored in EEPROM which decrements when suspicious activity is detected.
       * If the counter reaches 0, node will not work anymore and will transmit a @ref I_LOCKED message to the
       * gateway/controller with 30m intervals. Payload is a string with a reason for the locking.
       * The string is abbreviated to accomodate a signature. The following abbreviations exist at the moment:
       * - LDB (Locked During Boot)
       * - TMNR (Too Many Nonce Requests)
       * - TMFV (Too Many Failed Verifications)
       *
       * Typically, the counter only decrements when suspicious activity happens in a row.
       * It is reset if legit traffic is present.
      
       * Examples of malicious activity are:
       * - Repeatedly incorrectly checksummed OTA firmware
       * - Repeated requests for signing nonces without properly signed messages arriving
       * - Repeatedly failed signature verifications
       *
       * If counter reaches zero, node locks down and EEPROM has to be erased/reset to reactivate node.
       * Node can also be unlocked by grounding a pin (see @ref MY_NODE_UNLOCK_PIN).
       *
       * The size of the counter can be adjusted using @ref MY_NODE_LOCK_COUNTER_MAX.
       *
       * @def MY_NODE_LOCK_FEATURE
       * @brief Enable this to activate intrusion prevention mechanisms on the node.
       */
      //#define MY_NODE_LOCK_FEATURE
      
      /**
       * @def MY_NODE_UNLOCK_PIN
       * @brief By grounding this pin durig reset of a locked node, the node will unlock.
       *
       * If using a secure bootloader, grounding the pin is the only option to reactivate the node.
       * If using stock Android bootloader or a DualOptiBoot it is also possible to download a sketch
       * using serial protocol to erase EEPROM to unlock the node. 
       */
      #ifndef MY_NODE_UNLOCK_PIN
      #define MY_NODE_UNLOCK_PIN 14
      #endif
      
      /**
       * @def MY_NODE_LOCK_COUNTER_MAX
       * @brief Maximum accepted occurances of suspected malicious activity in a node.
       *
       * Counter decrements on reoccuring incidents but resets if legitimate behaviour is identified.
       */
      #ifndef MY_NODE_LOCK_COUNTER_MAX
      #define MY_NODE_LOCK_COUNTER_MAX 5
      #endif
      /** @}*/ // Node lock group
      
      #endif
      
      // Doxygen specific constructs, not included when built normally
      // This is used to enable disabled macros/definitions to be included in the documentation as well.
      #if DOXYGEN
      #define MY_SIGNING_ATSHA204
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
      #define MY_IS_RFM69HW
      #endif
      
      

      @alexsh1 said:

      Pleas make sure your transceivers are W version and not HW.

      Is this the best version of transceiver for Arduino Pro Mini 3,3V and Nano?
      So the H version can not be powered with 3,3V VCC from Arduino Pro Mini/Nano?

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      Just made a Arduino pro mini 3,3V Gateway, starts up fine, but same problem. Sensor (which already is a Arduino 3,3V Pro Mini) also doesn´t connect.😕

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      i´m using TS2950CT33.

      OK, later i´ll try it with a pro mini 3,3v, thanks for help, so far.

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      @fets said:

      As @scalz mentionned you need to adapt level (5V -> 3.3V) on rfm69 inputs : NSS, MOSI and SCK

      now i´ve added the level converters to NSS, MOSI and SCK.

      Same problem, gateway starts correctly without error, but sensor-node das not connect in inclusion-mode.

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      @scalz said:

      Are you trying to use rfm69 with a 5v nano? rfm69 is not 5v tolerant so you would need level shifting for the dataline. If you want to be sure, you could try with a mini.

      My Gateway is a Arduino Nano 5V model with 3,3V output, which is be used for the transceiver.
      My Sensor-Node is a Arduino Mini Pro 3,3V model.

      Both sketches starts up fine, looking at the Serial Monitor output, but doesn´t connect.

      posted in Troubleshooting
      vga
      vga
    • RE: How to get RFM69H 868Mhz working?

      Hi,
      at v2.0 beta i copied the example sketches GatewaySerial and BatteryPowerdSensor.
      the only thing i changed, is as you describe:

      //#define MY_RADIO_NRF24
      #define MY_RADIO_RFM69
      

      The Gateway serial Monitor said: "Startup complete"

      when turning the gateway in them controller into "inclusion-mode" and start the sensor-node, the serial monitor output from the node is this:

      Starting sensor (RRNNA-, 2.0.0-beta)
      Radio init successful.
      find parent
      send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      find parent
      send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      find parent
      send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      Init complete, id=255, parent=255, distance=255
      

      ...then nothing happened anymore in the sensor-node. Also the them-controller doesn´t have any sensor included.

      In the MyConfig.h i only see this:

      #ifdef MY_IS_RFM69HW
      

      nothing that checks the line:

      #define MY_RADIO_RFM69
      

      Is this correct? Any idea?

      posted in Troubleshooting
      vga
      vga
    • How to get RFM69H 868Mhz working?

      Hi everyone!
      i just tried the NRF24 transceiver on a them controller with a serial Gateway (arduino nano) and a sensor node (Arduino Pro mini 3,3V 8Mhz).
      All works fine. But in my opinion, it seems to have a bit small radio range.

      Now i tried to use the RFM69 868Mhz transceiver, till i heard the range would be higher.

      I used the 1.5 and the 2.0beta from MySensors, but did´t get it working either.
      For the 1.5 MySensors i did´t find a how to.
      in 2.0 i got both sketches uploaded to my arduinos, and the gateway is startet correctly, also my sensor node starts correctly, but when i put the gateway in inclusion-mode, and start the sensor node, it does not connect to the gateway, every time "find parent".

      Are there some tipps for me, how to geht this transceiver working?

      Thanks and best regards.
      ren

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      Hi!
      still have no solution for the topic-problem. 😞

      i tested both, the stable v1.5 mySensors and the beta v2.0.

      Both are working till connection is lost, then both version doesn´t reconnect. Same behavior again.

      i didn´t think it is because of some hardware issue, because it works, till connection is lost.
      also my code is reduced to the minimum, for testing this option, but same issue again.

      so there must be a problem with the "find parent" function.
      it looks like, when connection is lost and 5 send commands in line has been failed, the "find parent" is calling, but for some reason, the node sketch crashes.

      the last serial monitor output from node is this:

      find parent
      send: 48-48-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      

      ...and I got this only for one time, then nothing happens anymore, also my usual sketch operations doesn´t operate anymore and didn't make serial outputs.

      Is there nothing more i can do?? how does the reconnect is working normally?

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      @hek said:

      Yes, 5 failed sends in a row that triggers it.
      https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/core/MyTransport.h#L27

      oh, ok, I understand 🙂
      ...the link above refers to the beta, and i was wondering, why my library contains something else than this... so i just wait, thanks 😉

      ...but any other idea for the real topic issue? 😉

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      btw,
      i downloaded the new library folder from github repo, thinking maybe there are some changes with this issue.

      Now i see, the whole MySensor function is changed, and i have to edit my sketches for the new way!?

      before update, i have to do this:
      MySensor gw;

      and now, this part is complete removed, am I right??

      is there any announcement for this changes? didn´t find anything about these changes.

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      @mfalkvidd
      now i´ve clears the EEPROM, and completely removed the part from sketch, with writing anything to EEPROM.

      still the same issue.
      i´m thinking about to rase the counter of fails in row, till connecting will be reinitialized.
      Sure, this is not the best way to do, but till i have no other clue, the best workaround for keeping it working.

      Or any more other ideas? 😉

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      hm, i´ve changed my eprom_write function, so that i only write to dresses above EEPROM_LOCAL_CONFIG_ADDRESS.
      this is 0x123 -> address 291, and now i begin to write at 300.

      but still the problem persists, after losing connection, no reconnect. 😕

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      no, i think the sketch doesn´t work anymore.
      In Serial Monitor, after 5 fails, i can see the node calls "find parent" for one time, and after that there is nothing more happening in the serial monitor.

      but the sketch works fine all the time when transmutation is OK.

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      When node is in range of gateway, there are no transmission errors on node when startup, and since the node stay in range, all went fine.

      so, when node went out of range and 5 transmits in row fails, the node starts to find the gateway again, but only for one time, and then hangs up.

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      @hek, thanks for your help so far!
      The sensor sends every 10 seconds data to the gateway.
      When the sensor is out of range, the transmitting fails 6 times and then stuck in "find parent" and do nothing anymore.
      Is there any counter, which catch the failed transmits in line?
      Does the "find parent" mode repeat in any intervals?
      may it is possible to repeat the interval more often?

      posted in Troubleshooting
      vga
      vga
    • RE: Sensor doesn´t reconnect after connecting lost!?

      the controller gateway doesn´t write anything to the log, when the sensor lose connection.

      when I start the sensor, it connects to the controller correctly. But wenn it is out of range, the connection will be lost, of course.
      but if the sensor is back in reachable distance, it will not be reconnecting.
      the Serial output of the sensor still stands at the above written lines, and do nothing anymore.

      only a restart of the sensor will establish a new connection.

      Is there a function for the sensor sketch to reconnect, when connection is broken?

      posted in Troubleshooting
      vga
      vga
    • Sensor doesn´t reconnect after connecting lost!?

      Hi,
      i have sensor, and when it lose connection to the controller, it does´t reconnect.

      Serial Print after losing connection is like this:

      find parent
      send: 48-48-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      

      Even if i put the sensor direct beside the controller gateway, it doesn´t reconnect.

      is there a special way to trying to reconnect?

      if it helps, here is my sketch:

      // EEPROM Zurgiff ermöglichen
      #include <EEPROM.h>
      byte value;
      int tf_adr = 100;
      // Sleep Mode Libraries laden
      #include <avr/sleep.h>
      #include <avr/power.h> 
      
      // MySensor Library hinzufügen
      #include <SPI.h>
      #include <MySensor.h> 
      
      #define CHILD_ID 0   // Id of the sensor child
      
      
      //Batteriestatus 
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      
      //Definieren welche Sensor-ID die nachricht schickt 
      //und welcher Variablen-Typ übermittelt wird. (V_LEVEL ist in S_MOISTURE möglich)
      // Entsprechend der Sensor-Liste und Variablen-Liste
      MySensor gw;
      MyMessage flowMsg(CHILD_ID,V_FLOW);
      MyMessage volumeMsg(CHILD_ID,V_VOLUME);
      
      // reading liquid flow rate using Seeeduino and Water Flow Sensor from Seeedstudio.com
      // Code adapted by Charles Gantt from PC Fan RPM code written by Crenn @thebestcasescenario.com
      // http:/themakersworkbench.com http://thebestcasescenario.com http://seeedstudio.com
       
      volatile int NbTopsFan; //measuring the rising edges of the signal
      float Calc;                               
      int hallsensor = 3;    //The pin location of the sensor
      
      int flow_sens_vcc = 7;
      
      unsigned int flowMilliLitres;
      unsigned int lastFlowVal;
      
      long totalMilliLitres;
      long lastTotalVal;
       
      void rpm ()     //This is the function that the interupt calls 
      { 
        NbTopsFan++;  //This function measures the rising and falling edge of the hall effect sensors signal
      } 
      
      //This function will write a 4 byte (32bit) long to the eeprom at
      //the specified address to address + 3.
      void EEPROMWritelong(int address, long value)
            {
            //Decomposition from a long to 4 bytes by using bitshift.
            //One = Most significant -> Four = Least significant byte
            byte four = (value & 0xFF);
            byte three = ((value >> 8) & 0xFF);
            byte two = ((value >> 16) & 0xFF);
            byte one = ((value >> 24) & 0xFF);
      
            //Write the 4 bytes into the eeprom memory.
            EEPROM.write(address, four);
            EEPROM.write(address + 1, three);
            EEPROM.write(address + 2, two);
            EEPROM.write(address + 3, one);
            }
      long EEPROMReadlong(long address)
            {
            //Read the 4 bytes from the eeprom memory.
            long four = EEPROM.read(address);
            long three = EEPROM.read(address + 1);
            long two = EEPROM.read(address + 2);
            long one = EEPROM.read(address + 3);
      
            //Return the recomposed long by using bitshift.
            return ((four << 0) & 0xFF) + ((three << 8) & 0xFFFF) + ((two << 16) & 0xFFFFFF) + ((one << 24) & 0xFFFFFFFF);
            }
      
      
      // The setup() method runs once, when the sketch starts
      void setup() //
      { 
        
        // Start Gateway Kommunikation
        gw.begin();
        //gw.begin(NULL, 2);     // assign fixed node id 2  (use anything from 1..254) Wenn kein COntroller angeschlossen ist der die NODE ID vergeben kann!;
        
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Water Flow Sensor", "1.0");     
        // Register all sensors to gw (they will be created as child devices)  
        gw.present(CHILD_ID, S_WATER);
      
        pinMode(flow_sens_vcc, OUTPUT);
        digitalWrite(flow_sens_vcc, HIGH);
        
        pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input
        attachInterrupt(1, rpm, RISING); //and the interrupt is attached 1 = Digital Pin 3!
      
      
        // TotalFlow zurücksetzten
        EEPROMWritelong(tf_adr, 000000000);
      
        // Toralflow aus dem Speicher lesen
        totalMilliLitres = EEPROMReadlong(tf_adr);
      
        // Batteriestatus
        // use the 1.1 V internal reference
        #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
        #else
         analogReference(INTERNAL);
        #endif
      } 
      // the loop() method runs over and over again,
      // as long as the Arduino has power
      void loop ()    
      {
        
      
      
       
      // Schlafmodus: entweder sensor auschalten, dann oft aufwachen zum checken ob was läuft, -> hoche wakeup frequenz aber im sleep 10sec 20uA! 2sec 6mA, 2sec 19mA
      //   oder sensor immer anlassen, dann aber dauerhaft 2mA!
       int sleepmode = 1;   // 1=Wakeup by Time (Sensor can be off) 2=wakeup by Interrupt (Sensor must leave on!)
       if(flowMilliLitres == 0){
          EEPROMWritelong(tf_adr, totalMilliLitres);
          Serial.print ("TotalFlow im EEPROM: "); 
          Serial.print(EEPROMReadlong(tf_adr));
          Serial.print ("\r\n");
          if(sleepmode == 1){
             gw.send(flowMsg.set(flowMilliLitres));
             delay (1000);   //Wait 1 second
             Serial.println("---sleeping---"); 
             digitalWrite(flow_sens_vcc, LOW);
             gw.sleep(10000); //Schlafen gehen auf zeit (angabe milliseconds) dann spätestens kommt ein pol.
             Serial.println("---awakeing---"); 
             digitalWrite(flow_sens_vcc, HIGH);
          }
          if(sleepmode == 2){
             EEPROMWritelong(tf_adr, totalMilliLitres);
             Serial.print ("TotalFlow im EEPROM: "); 
             Serial.print(EEPROMReadlong(tf_adr));
             Serial.print ("\r\n");
             Serial.println("---sleeping---"); 
             gw.sleep(1000000); //Schlafen gehen auf zeit (angabe milliseconds) dann spätestens kommt ein pol.
             Serial.println("---awakeing---"); 
          } 
           
        }
       
      
          NbTopsFan = 0;   //Set NbTops to 0 ready for calculations
          sei();      //Enables interrupts
          delay (1000);   //Wait 1 second
          cli();      //Disable interrupts
          Calc = (NbTopsFan / 7.5); //(Pulse frequency) / 7.5Q, = flow rate in L/min 
          Serial.print (Calc); //Prints the number calculated above
          Serial.print (" L/min\r\n"); //Prints "L/min" and returns a  new line
          int val=(int)Calc;
        
          // Divide the flow rate in litres/minute by 60 to determine how many litres have
          // passed through the sensor in this 1 second interval, then multiply by 1000 to
          // convert to millilitres.
          flowMilliLitres = (Calc / 60) * 1000;
            
          // Add the millilitres passed in this second to the cumulative total
          totalMilliLitres += flowMilliLitres;
      
        if(flowMilliLitres != 0){
          
          // Print the number of litres flowed in this second
          Serial.print("  Current Liquid Flowing: ");             // Output separator
          Serial.print(flowMilliLitres);
          Serial.print("mL/Sec");
          if(lastFlowVal != flowMilliLitres){
            gw.send(flowMsg.set(flowMilliLitres));
            lastFlowVal = flowMilliLitres;
          }
           
          // Print the cumulative total of litres flowed since starting
          Serial.print("  Output Liquid Quantity: ");             // Output separator
          Serial.print(totalMilliLitres);
          Serial.println("mL"); 
          if(lastTotalVal != totalMilliLitres){
            gw.send(volumeMsg.set(totalMilliLitres));
            lastTotalVal = totalMilliLitres;
            //Starting at the first byte on the eeprom.   
            //EEPROMWritelong(address, totalMilliLitres);
          }
         
          // get the battery Voltage
           int sensorValue = analogRead(BATTERY_SENSE_PIN);
           #ifdef 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
           float batteryV  = sensorValue * 0.003363075;
           int batteryPcnt = sensorValue / 10;
        
           #ifdef DEBUG
           Serial.print("Battery Voltage: ");
           Serial.print(batteryV);
           Serial.println(" V");
        
           Serial.print("Battery percent: ");
           Serial.print(batteryPcnt);
           Serial.println(" %");
           #endif
           gw.sendBatteryLevel(batteryPcnt);
          
        }
        
      }```
      posted in Troubleshooting
      vga
      vga
    • RE: Problem with optimizing power consumption

      i am using this sensor:
      http://www.seeedstudio.com/wiki/images/b/b7/Water_flow_sensor_datasheet.pdf
      Do you know a "reed Sensor" for such a my sensor project?

      posted in Troubleshooting
      vga
      vga
    • how to get data from controller?

      Hi,
      is it possible that my sensor can call a value from the controller?
      Scenario:
      Flow Sensor sends the total liter to the controller, after rebooting the sensor total liters will be 0 again. So the idea is to get the last value from the controller at startup.
      I haven´t find anything like this. Is there a function?

      posted in Development
      vga
      vga
    • RE: Problem with optimizing power consumption

      @AWI you are right. My fault, I checked again my wiring. the flow sensor is connected to vcc, so it consumes permanently. disconnected and restarted the arduino, the consumption in sleep is 0,1mA.

      so i tried to connect the flow sensor to a digital pin, set it to output mode and put it HIGH.
      When it go to sleep i set it to LOW.

      But I fail to see that it wake up again with interruptpin, when sensor change, but if it has no power, of course it can not change! 😏

      any idea how to make the best of it?
      timer interrupt is no alternative, cause of possible missing sensor activity.

      posted in Troubleshooting
      vga
      vga
    • RE: Problem with optimizing power consumption

      yes, i used the search function, but there are no tips which are helpful for my problem.
      While sleep mode, using gw.sleep, the power consumption is still 2mA.

      posted in Troubleshooting
      vga
      vga
    • Problem with optimizing power consumption

      Hi,

      i´ve made a sensor with the following hardware:

      Arduino Mini Pro 3,3v 8Mhz: removed regulator, removed power-LED
      NRF24L01+ Tranceiver
      Water-Flow Sensor

      The Flow-Sensor works, but now i want to power it with a battery:
      In measuring mode, the consumption is 19mA, when entering gw.sleep the power consumption of the Sensor reduces to 2mA.
      (also if I disconnect the Flow Sensor, and only the Transceiver is connected to the Arduino, it is still 2mA)
      Is there a way to optimize the power consumption more?
      I´ve heard about 120uA in sleep mode?
      Maybe the gw.sleep does not turn of the ADC, SPI, BOD, like the LowPower library?
      BTW, when i try to include the LowPower library, the arduino IDE says, it is not possible to compile LowPower for Arduino Pro Mini.

      Here is my code:

      
      // Sleep Mode Libraries laden
      #include <avr/sleep.h>
      #include <avr/power.h> 
      
      // MySensor Library hinzufügen
      #include <SPI.h>
      #include <MySensor.h> 
      
      #define CHILD_ID 0   // Id of the sensor child
      
      
      //Batteriestatus 
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      
      
      MySensor gw;
      MyMessage flowMsg(CHILD_ID,V_FLOW);
      MyMessage volumeMsg(CHILD_ID,V_VOLUME);
      
       
      volatile int NbTopsFan; //measuring the rising edges of the signal
      float Calc;                               
      int hallsensor = 3;    //The pin location of the sensor
      
      unsigned int flowMilliLitres;
      unsigned int lastFlowVal;
      
      long totalMilliLitres;
      long lastTotalVal;
       
      void rpm ()     //This is the function that the interupt calls 
      { 
        NbTopsFan++;  //This function measures the rising and falling edge of the hall effect sensors signal
      } 
      
      // The setup() method runs once, when the sketch starts
      void setup() //
      { 
      
        // Start Gateway Kommunikation
        gw.begin();
        
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Water Flow Sensor", "1.0");     
        // Register all sensors to gw (they will be created as child devices)  
        gw.present(CHILD_ID, S_WATER);
      
        
        pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input
        Serial.begin(115200); //This is the setup function where the serial port is initialised,
        attachInterrupt(1, rpm, RISING); //and the interrupt is attached 1 = Digital Pin 3!
      
        // Batteriestatus
        // use the 1.1 V internal reference
        #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
        #else
         analogReference(INTERNAL);
        #endif
      } 
      // the loop() method runs over and over again,
      // as long as the Arduino has power
      void loop ()    
      {
         
        NbTopsFan = 0;   //Set NbTops to 0 ready for calculations
        sei();      //Enables interrupts
      
       if(flowMilliLitres == 0){
          delay (500);
        
          gw.sleep(300000); 
        }
        
        delay (1000);   //Wait 1 second
        cli();      //Disable interrupts
        Calc = (NbTopsFan / 7.5); //(Pulse frequency) / 7.5Q, = flow rate in L/min 
        Serial.print (Calc); //Prints the number calculated above
        Serial.print (" L/min\r\n"); //Prints "L/min" and returns a  new line
        int val=(int)Calc;
      
        // Divide the flow rate in litres/minute by 60 to determine how many litres have
        // passed through the sensor in this 1 second interval, then multiply by 1000 to
        // convert to millilitres.
        flowMilliLitres = (Calc / 60) * 1000;
          
        // Add the millilitres passed in this second to the cumulative total
        totalMilliLitres += flowMilliLitres;
      
        // Print the number of litres flowed in this second
        Serial.print("  Current Liquid Flowing: ");             // Output separator
        Serial.print(flowMilliLitres);
        Serial.print("mL/Sec");
        if(lastFlowVal != flowMilliLitres){
          gw.send(flowMsg.set(flowMilliLitres));
          lastFlowVal = flowMilliLitres;
        }
        
      
        // Print the cumulative total of litres flowed since starting
        Serial.print("  Output Liquid Quantity: ");             // Output separator
        Serial.print(totalMilliLitres);
        Serial.println("mL"); 
        if(lastTotalVal != totalMilliLitres){
          gw.send(volumeMsg.set(totalMilliLitres));
          lastTotalVal = totalMilliLitres;
          //Starting at the first byte on the eeprom.   
          //EEPROMWritelong(address, totalMilliLitres);
        }
      
      
        // get the battery Voltage
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef 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
         float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
      
         #ifdef DEBUG
         Serial.print("Battery Voltage: ");
         Serial.print(batteryV);
         Serial.println(" V");
      
         Serial.print("Battery percent: ");
         Serial.print(batteryPcnt);
         Serial.println(" %");
         #endif
         gw.sendBatteryLevel(batteryPcnt);
      
          
        
      }
      

      Would be nice to get some tipps for reducing the power consumption more, thanks!

      posted in Troubleshooting
      vga
      vga
    • RE: Moisture Sensor - Payload problem

      It is working! ;D ...thank you very much!
      Now i understand a little bit more with MySensors 😉

      posted in Troubleshooting
      vga
      vga
    • RE: Moisture Sensor - Payload problem

      Thank you AWI,
      While compiling the modified sketch in Arduino App, i´m getting the following error:

      no matching function for call to 'MySensor::MySensor(NULL, int)'
      
      posted in Troubleshooting
      vga
      vga
    • RE: Moisture Sensor - Payload problem

      i´m a totally beginner with MySensors, so sorry for my questions:

      I have a FHEM-Controller working.
      But haven´t connected the Controller to the Gateway yet.
      I thought i can test the Communication between the Gateway and the Sensor-Node, without connect the Gateway to my Controller. Isn´t that possible?

      What do you mean with "fixed node"?

      posted in Troubleshooting
      vga
      vga
    • Moisture Sensor - Payload problem

      Hi everyone,

      i want to use a Moisture-Sensor (YL69+YL39) to report the humidity-level (0-1023) to my serial-Gateway.
      All set-up well.
      My Serial-Gateway works fine, the Sensor-Node works also and is connected to the Gateway.
      Now, my problem is that the Sensor-Node doesn´t send the level data correctly, i think.

      The Sensor-Node should send the following Level:
      Humidity Level (0-1023): 19

      In the Serial Monitor from my Sensor-Node i always get this output, when a msg will be send:

      req id
      send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
      

      And this is the Gateway Serial Monitor:

      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      

      So to me, it looks like the msg has no content!?
      pl=0 and l=0 -> no data in the msg, doesn´t it?

      Here is my Sensor-Node Sketch:

      // MySensor Library hinzufügen
      #include <SPI.h>
      #include <MySensor.h> 
      
      #define CHILD_ID 0   // Id of the sensor child
      
      MySensor gw;
      
      //Definieren welche Sensor-ID die nachricht schickt 
      //und welcher Variablen-Typ übermittelt wird. (V_LEVEL ist in S_MOISTURE möglich)
      // Entsprechend der Sensor-Liste und Variablen-Liste
      MyMessage msg(CHILD_ID, V_LEVEL);
      int lastSoilValue = 0;
      
      // YL-39 + YL-69 humidity sensor
      byte humidity_sensor_pin = A1;
      byte humidity_sensor_vcc = 6;
      
      void setup() {
      
        // Start Gateway Kommunikation
        gw.begin();
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Soil Moisture Sensor", "1.0");     
        // Register all sensors to gw (they will be created as child devices)  
        gw.present(CHILD_ID, S_MOISTURE);
        
        // Init the humidity sensor board
        pinMode(humidity_sensor_vcc, OUTPUT);
        digitalWrite(humidity_sensor_vcc, LOW);
      
        // Setup Serial
      //while (!Serial);
      //delay(1000);
      //Serial.begin(9600);
      }
      
      int read_humidity_sensor() {
        digitalWrite(humidity_sensor_vcc, HIGH);
        delay(500);
        int value = analogRead(humidity_sensor_pin);
        digitalWrite(humidity_sensor_vcc, LOW);
        return 1023 - value;
      }
      
      void loop() {
        int soilValue = read_humidity_sensor();
        Serial.print("Humidity Level (0-1023): ");
        Serial.println(soilValue);
        delay(2000);
        if (soilValue != lastSoilValue) {
          Serial.println(soilValue);
          gw.send(msg.set(soilValue));  
          lastSoilValue = soilValue;
        }
      }
      

      So, can someone help my, finding the problem, why my Level-Value will not be transmitted?
      Thanks for help!

      posted in Troubleshooting
      vga
      vga