Navigation

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

    Tommy Petersen

    @Tommy Petersen

    5
    Reputation
    9
    Posts
    290
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Tommy Petersen Follow

    Best posts made by Tommy Petersen

    • RE: Serial Gateway problems

      @mfalkvidd

      Looks like running 2 gateways was the issue, have been stabil ever since I shut down one of them.

      Thanks a lot for the help.

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • RE: Water pressure sensors?

      If you want to measure level in a sewer and get a measurement that can be used for something "that have a high degree of accuracy" it needs to be atmospheric compensated, otherwise the measurement will be off by a lot, because of pressure in the pipe system, normally a sewer system is not open to the atmospheric pressure because of gases.

      If your application is anything like the picture, that would not be a good solution, since a atmospheric sensor would have a small air tube and getting water into those would make it unstable.

      if you can put your vent tube so no water gets in then a pressure level measurement would be a good solution.
      I normally use alibaba for that.
      https://www.alibaba.com/trade/search?IndexArea=product_en&CatId=&fsb=y&SearchText=pressure+sensor+for+sewer

      But if you only want to know when the water level reach a certain height there is the option of using a float switch.

      I often find that there is a need for a combine solution, both pressure/ultrasonic and a float, to keep up a high accuracy, sewer systems are a whole other world when it come to sensor technology, but again it depends on what you need.

      posted in Hardware
      Tommy Petersen
      Tommy Petersen
    • RE: Serial Gateway problems

      Normally it takes anywhere from 30 min to 4 hours before it happens, but I will make an update.

      The gateway I made following the guide https://www.mysensors.org/build/raspberry
      With the command --my-transport=nrf24 --my-rf24-irq-pin=15 as I thought that might fix the issue

      The node sketch is this one.

      /**
       * 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
       *
       * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller
       * http://www.mysensors.org/build/temp
       *
       * The cool thing about this temperature sensor (pun intended) is thay you can attach multiple Dallas temperature sensors outputs to the same arduino pin. They will all automatically be recognised as separate sensors.
       *
       * At the moment of writing (februari 2017) you need older versions of the Dallas and OneWire libraries. Please check the website or forum to see if this is still the case.
       *
       * Modifications by anonymous user so that it can now simultaneously function as a MySensors repeater.
       */
      
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24                            // A 2.4Ghz transmitter and receiver, often used with MySensors.
      #define MY_RF24_PA_LEVEL RF24_PA_MAX              // This sets a low-power mode for the radio. Useful if you use the verison with the bigger antenna, but don' want to power that from a separate source. It can also fix problems with fake Chinese versions of the radio.
      //#define MY_RADIO_RFM69                          // 433Mhz transmitter and reveiver.
      
      // Choose if you want this sensor to also be a repeater.
      // #define MY_REPEATER_FEATURE                    // Just remove the two slashes at the beginning of this line to also enable this sensor to act as a repeater for other sensors. If this node is on battery power, you probably shouldn't enable this.
      // Are you using this sensor on battery power?
      #define BATTERY_POWERED                   // Just remove the two slashes at the beginning of this line if your node is battery powered. It will then go into deep sleep as much as possible. But when it' sleeping it can' work as a repeater.
      #define MY_NODE_ID 20
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      
      // These defines and variables can be changed:
      #define COMPARE_TEMP 1                            // Send temperature only if changed? 1 = Yes 0 = No. Can save battery.
      #define ONE_WIRE_BUS 3                            // Pin where Dallas sensor(s) is/are connected.
      #define MAX_ATTACHED_DS18B20 16                   // Maximum amount of teperature sensors you can connect to this arduino (16).
      
      unsigned long measurementInterval = 3000;        // Time to wait between reads (in milliseconds).
      
      // You should not change these:
      OneWire oneWire(ONE_WIRE_BUS);                    // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      DallasTemperature sensors(&oneWire);              // Pass the oneWire reference to Dallas Temperature.
      float lastTemperature[MAX_ATTACHED_DS18B20];      // creates an array to hold the previous temperature measurements for each possible sensor.
      int numSensors=0;                                 // variable to contain the number of found attached sensors.
      boolean metric = true;                            // old Mysensors??
      unsigned long measurementSleepTime = 0;           // variable to store the Sleep time if the node is battery powered.
      
      
      // Mysensors settings
      MyMessage msg(0,V_TEMP);                          // Sets up the message format that we'l be sending to the MySensors gateway later.
      
      
      void before()
      {
         sensors.begin();                              // Startup up the OneWire library. It allows multiple sensors to talk over one wire (one pin).
      }
      
      void setup()
      {
         for(int i=0; i<MAX_ATTACHED_DS18B20; i++) {
            lastTemperature[i] = 0;  //Pre-filling array with 0's.
         }
         sensors.setWaitForConversion(false);            // requestTemperatures() will not block current thread
      
      #ifdef BATTERY_POWERED
         measurementSleepTime = measurementInterval;
         measurementInterval = 1;                    // We'll let Sleep take over the scheduling. When the arduino is asleep, millis doesn't increment anymore (time stops as it were). To fix this, we'l set the measurement interval time to 1, so that when the arduino wakes up it will immediately try to measure again.
      #endif
      
         Serial.begin(115200);                           // for serial debugging.
         Serial.print("Hello world, I am a sensor. \n ");
      
      }
      
      void presentation()
      {
         sendSketchInfo("Temperature Sensor", "1.2");    // Send the sketch version information to the gateway and Controller
         numSensors = sensors.getDeviceCount();          // Fetch the number of attached temperature sensors
         for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
            present(i, S_TEMP);                          // Present all sensors to controller (16 maximum).
         }
      }
      
      
      void loop()
      {
      
         // You should not change these variables:
         static boolean isMeasuring = true;                // Used to indicate when the time is right for a new measurement to be made.
         static boolean isCalculating = false;                     // Used to bridge the time that is needed to calculate the temperature values by the Dallas library.
         static unsigned long currentMillis = 0;                   // The millisecond clock in the main loop.
         static unsigned long previousMeasurementMillis = 0;       // Used to remember the time of the last temperature measurement.
         static int16_t conversionTime = 0;                        // Used to store the time needed to calculate the temperature from measurements.
      
         currentMillis = millis(); // The time since the sensor started, counted in milliseconds. This script tries to avoid using the Sleep function, so that it could at the same time be a MySensors repeater.
      
         // Let's measure the temperature
         if(isMeasuring == true && currentMillis - previousMeasurementMillis >= measurementInterval) { // If we're not calculating, and enough time has passed, we'll start again.
            isMeasuring = false; // We're measuring, so let's take it off our to-do list.
            Serial.print("Starting new measurement(s)\n");
            previousMeasurementMillis = currentMillis; // Mark the time of the initialiation of this measurement.
      
            // Fetch temperatures from Dallas sensors
            sensors.requestTemperatures();
      
            // query conversion time. Apparently it takes a while to calculate.
            //CONVERSION_TIME = sensors.millisToWaitForConversion(sensors.getResolution());
            conversionTime = millisToWaitForConversion(sensors.getResolution());
            isCalculating = true; //Next step is to re-calculate the temperature again.
         }
      
      
         // Next, let's calculate and send the temperature
         if(isCalculating == true && currentMillis > previousMeasurementMillis + conversionTime ) {
            isCalculating = false; // check calculating off the to-do list too.
      
            for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {    // Loop through all the attached temperatur sensors.
               float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;   // Fetch and round temperature to one decimal
               Serial.print("Sensor #");
               Serial.print(i);
               Serial.print(" says it is ");
               Serial.print(temperature);
               Serial.print(" degrees\n");
               if(temperature != -127.00 && temperature != 85.00) { // avoid working with measurement errors.
                  if (COMPARE_TEMP == 1 && lastTemperature[i] == temperature) {
                     Serial.print("Not sending it though, because it's the same temperature as before.\n");
                  } else {
                     Serial.print("Sending the temperature to the gateway.\n");
                     send(msg.setSensor(i).set(temperature,1));
                     lastTemperature[i] = temperature; // Save new temperatures to be able to compare in the next round.
                  }
               }
            }
      
            // Both tasks are done. Time to wait until we should measure again.
            Serial.print("zzzzZZZZzzzzZZZZzzzz\n");
      
      #ifdef BATTERY_POWERED
            unsigned long quicktimecheck = millis(); // check how much time has passed during the measurement (can be up to 750 milliseconds), and then calculate from that how long to sleep until the next intended measuring time.
            unsigned long sleeptime = measurementSleepTime - (quicktimecheck - previousMeasurementMillis); //How much time has passed already during the calculating? Subtract that from the intended interval time.
            sleep (sleeptime);
      #endif
      
            isMeasuring = true;
         }
      }
      
      
      // This function helps to avoid a problem with the latest Dallas temperature library.
      int16_t millisToWaitForConversion(uint8_t bitResolution)
      {
         switch (bitResolution) {
         case 9:
            return 94;
         case 10:
            return 188;
         case 11:
            return 375;
         default:
            return 750;
         }
      }```
      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • RE: Serial Gateway problems

      @mfalkvidd

      ohh I think I might have found the problem.

      I was running the gateway as a service from when I followed the guide on my PI.
      and was also running sudo ./bin/mysgw -d in Putty, so the might have been the issue.
      I have just restarted my test to see if that fixes the problem.

      The sensor is powered via batteries and a booster up to 3,3 volt,
      along with some stabilization circuit and a 1mF on the NRF power
      On the gateway I use a 100µf.

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen

    Latest posts made by Tommy Petersen

    • RE: Advice needed

      @skywatch Thanks for the advice.
      I think I will go for the option of sending the data from node to node.

      Funny thing though, this feature of node to node is the first time I am hearing of it, but after some forum search, I can see it's been about for a while, this open up a whole new level of complexity for my sensor network 🙂

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • Advice needed

      Hello All

      I am in need of some advice, for a expansion of my setup.

      My current setup is as follows.

      Temp/Moist node--RPI Gateway--Node Red--InfluxDB--Grafana Dashboard.

      Now what I want to do is, when temp on node 1 is higher than XX and the time is between this and that.
      Activate relay on node 2 for x amount of time.

      My questions is how would I go about to setup this up.
      Can it be done within the MySensor network or should I do it in node-red?

      Any advice is welcome

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • RE: Water pressure sensors?

      If you want to measure level in a sewer and get a measurement that can be used for something "that have a high degree of accuracy" it needs to be atmospheric compensated, otherwise the measurement will be off by a lot, because of pressure in the pipe system, normally a sewer system is not open to the atmospheric pressure because of gases.

      If your application is anything like the picture, that would not be a good solution, since a atmospheric sensor would have a small air tube and getting water into those would make it unstable.

      if you can put your vent tube so no water gets in then a pressure level measurement would be a good solution.
      I normally use alibaba for that.
      https://www.alibaba.com/trade/search?IndexArea=product_en&CatId=&fsb=y&SearchText=pressure+sensor+for+sewer

      But if you only want to know when the water level reach a certain height there is the option of using a float switch.

      I often find that there is a need for a combine solution, both pressure/ultrasonic and a float, to keep up a high accuracy, sewer systems are a whole other world when it come to sensor technology, but again it depends on what you need.

      posted in Hardware
      Tommy Petersen
      Tommy Petersen
    • RE: Serial Gateway problems

      @mfalkvidd

      Looks like running 2 gateways was the issue, have been stabil ever since I shut down one of them.

      Thanks a lot for the help.

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • RE: Serial Gateway problems

      @mfalkvidd

      ohh I think I might have found the problem.

      I was running the gateway as a service from when I followed the guide on my PI.
      and was also running sudo ./bin/mysgw -d in Putty, so the might have been the issue.
      I have just restarted my test to see if that fixes the problem.

      The sensor is powered via batteries and a booster up to 3,3 volt,
      along with some stabilization circuit and a 1mF on the NRF power
      On the gateway I use a 100µf.

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • RE: Serial Gateway problems

      @mfalkvidd

      So this is the log from the gateway.

      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.5
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.5
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.5
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.5
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSM:READY:NWD REQ
      mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.3
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.3
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.4
      mysgw: TSF:SAN:OK
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.2
      mysgw: TSF:MSG:READ,20-20-0,s=0,c=1,t=0,pt=7,l=5,sg=0:-1.2
      mysgw: TSM:READY:NWD REQ
      
      

      This is the log from the node.

      12202557 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12202567 TSF:TDI:TSL
      12202569 MCO:SLP:WUP=-1
      12202573 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Sending the temperature to the gateway.
      12203384 TSF:MSG:SEND,20-20-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:-1.2
      zzzzZZZZzzzzZZZZzzzz
      12203395 MCO:SLP:MS=2180,SMS=0,I1=255,M1=255,I2=255,M2=255
      12203401 TSF:TDI:TSL
      12203403 MCO:SLP:WUP=-1
      12203407 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12204193 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12204204 TSF:TDI:TSL
      12204206 MCO:SLP:WUP=-1
      12204210 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12204996 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12205006 TSF:TDI:TSL
      12205008 MCO:SLP:WUP=-1
      12205012 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12205799 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12205809 TSF:TDI:TSL
      12205811 MCO:SLP:WUP=-1
      12205815 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12206602 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12206612 TSF:TDI:TSL
      12206614 MCO:SLP:WUP=-1
      12206618 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12207405 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12207415 TSF:TDI:TSL
      12207417 MCO:SLP:WUP=-1
      12207421 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12208207 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12208218 TSF:TDI:TSL
      12208220 MCO:SLP:WUP=-1
      12208224 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12209010 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12209020 TSF:TDI:TSL
      12209022 MCO:SLP:WUP=-1
      12209027 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12209813 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12209823 TSF:TDI:TSL
      12209825 MCO:SLP:WUP=-1
      12209829 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12210616 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12210626 TSF:TDI:TSL
      12210628 MCO:SLP:WUP=-1
      12210632 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12211419 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12211429 TSF:TDI:TSL
      12211431 MCO:SLP:WUP=-1
      12211435 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12212221 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12212232 TSF:TDI:TSL
      12212234 MCO:SLP:WUP=-1
      12212238 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12213024 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12213035 TSF:TDI:TSL
      12213037 MCO:SLP:WUP=-1
      12213041 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12213827 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12213837 TSF:TDI:TSL
      12213839 MCO:SLP:WUP=-1
      12213843 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12214630 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12214640 TSF:TDI:TSL
      12214642 MCO:SLP:WUP=-1
      12214646 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12215433 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12215443 TSF:TDI:TSL
      12215445 MCO:SLP:WUP=-1
      12215449 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12216236 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12216246 TSF:TDI:TSL
      12216248 MCO:SLP:WUP=-1
      12216252 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12217038 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12217049 TSF:TDI:TSL
      12217051 MCO:SLP:WUP=-1
      12217055 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12217841 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12217851 TSF:TDI:TSL
      12217853 MCO:SLP:WUP=-1
      12217858 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12218644 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12218654 TSF:TDI:TSL
      12218656 MCO:SLP:WUP=-1
      12218660 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12219447 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12219457 TSF:TDI:TSL
      12219459 MCO:SLP:WUP=-1
      12219463 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12220250 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12220260 TSF:TDI:TSL
      12220262 MCO:SLP:WUP=-1
      12220266 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12221052 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12221063 TSF:TDI:TSL
      12221065 MCO:SLP:WUP=-1
      12221069 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12221855 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12221865 TSF:TDI:TSL
      12221868 MCO:SLP:WUP=-1
      12221872 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12222658 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12222668 TSF:TDI:TSL
      12222670 MCO:SLP:WUP=-1
      12222674 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12223461 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12223471 TSF:TDI:TSL
      12223473 MCO:SLP:WUP=-1
      12223477 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12224264 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12224274 TSF:TDI:TSL
      12224276 MCO:SLP:WUP=-1
      12224280 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12225067 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12225077 TSF:TDI:TSL
      12225079 MCO:SLP:WUP=-1
      12225083 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12225869 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12225880 TSF:TDI:TSL
      12225882 MCO:SLP:WUP=-1
      12225886 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12226672 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12226682 TSF:TDI:TSL
      12226684 MCO:SLP:WUP=-1
      12226689 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12227475 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12227485 TSF:TDI:TSL
      12227487 MCO:SLP:WUP=-1
      12227491 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12228278 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12228288 TSF:TDI:TSL
      12228290 MCO:SLP:WUP=-1
      12228294 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12229081 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12229091 TSF:TDI:TSL
      12229093 MCO:SLP:WUP=-1
      12229097 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12229883 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12229894 TSF:TDI:TSL
      12229896 MCO:SLP:WUP=-1
      12229900 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12230686 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12230696 TSF:TDI:TSL
      12230699 MCO:SLP:WUP=-1
      12230703 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12231489 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12231499 TSF:TDI:TSL
      12231501 MCO:SLP:WUP=-1
      12231505 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12232292 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12232302 TSF:TDI:TSL
      12232304 MCO:SLP:WUP=-1
      12232308 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12233095 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12233105 TSF:TDI:TSL
      12233107 MCO:SLP:WUP=-1
      12233111 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12233897 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12233908 TSF:TDI:TSL
      12233910 MCO:SLP:WUP=-1
      12233914 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12234700 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12234711 TSF:TDI:TSL
      12234713 MCO:SLP:WUP=-1
      12234717 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12235503 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12235513 TSF:TDI:TSL
      12235515 MCO:SLP:WUP=-1
      12235520 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12236306 MCO:SLP:MS=2216,SMS=0,I1=255,M1=255,I2=255,M2=255
      12236316 TSF:TDI:TSL
      12236318 MCO:SLP:WUP=-1
      12236322 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12237109 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12237119 TSF:TDI:TSL
      12237121 MCO:SLP:WUP=-1
      12237125 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.20 degrees
      Not sending it though, because it's the same temperature as before.
      zzzzZZZZzzzzZZZZzzzz
      12237912 MCO:SLP:MS=2215,SMS=0,I1=255,M1=255,I2=255,M2=255
      12237922 TSF:TDI:TSL
      12237924 MCO:SLP:WUP=-1
      12237928 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -1.10 degrees
      Sending the temperature to the gateway.
      12238747 !TSF:MSG:SEND,20-20-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=NACK:-1.1
      zzzzZZZZzzzzZZZZzzzz
      12238757 MCO:SLP:MS=2173,SMS=0,I1=255,M1=255,I2=255,M2=255
      12238764 TSF:TDI:TSL
      12238766 MCO:SLP:WUP=-1
      12238770 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -0.80 degrees
      Sending the temperature to the gateway.
      12239587 TSF:MSG:SEND,20-20-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=1,st=OK:-0.8
      zzzzZZZZzzzzZZZZzzzz
      12239595 MCO:SLP:MS=2177,SMS=0,I1=255,M1=255,I2=255,M2=255
      12239601 TSF:TDI:TSL
      12239605 MCO:SLP:WUP=-1
      12239607 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -0.40 degrees
      Sending the temperature to the gateway.
      12240427 !TSF:MSG:SEND,20-20-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=NACK:-0.4
      zzzzZZZZzzzzZZZZzzzz
      12240437 MCO:SLP:MS=2172,SMS=0,I1=255,M1=255,I2=255,M2=255
      12240443 TSF:TDI:TSL
      12240445 MCO:SLP:WUP=-1
      12240449 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is -0.10 degrees
      Sending the temperature to the gateway.
      12241254 TSF:MSG:SEND,20-20-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=1,st=OK:-0.1
      zzzzZZZZzzzzZZZZzzzz
      12241262 MCO:SLP:MS=2189,SMS=0,I1=255,M1=255,I2=255,M2=255
      12241270 TSF:TDI:TSL
      12241272 MCO:SLP:WUP=-1
      12241274 TSF:TRI:TSB
      Starting new measurement(s)
      Sensor #0 says it is 0.00 degrees
      Sending the temperature to the gateway.
      12242067 TSF:MSG:SEND,20-20-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:0.0
      

      I took sensor in door again, so that's why the temperature went up again in the last readings.

      But as of right now the serial is just standing on NWD REQ and nothing else happens.

      I hope this helps

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • RE: Serial Gateway problems

      Normally it takes anywhere from 30 min to 4 hours before it happens, but I will make an update.

      The gateway I made following the guide https://www.mysensors.org/build/raspberry
      With the command --my-transport=nrf24 --my-rf24-irq-pin=15 as I thought that might fix the issue

      The node sketch is this one.

      /**
       * 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
       *
       * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller
       * http://www.mysensors.org/build/temp
       *
       * The cool thing about this temperature sensor (pun intended) is thay you can attach multiple Dallas temperature sensors outputs to the same arduino pin. They will all automatically be recognised as separate sensors.
       *
       * At the moment of writing (februari 2017) you need older versions of the Dallas and OneWire libraries. Please check the website or forum to see if this is still the case.
       *
       * Modifications by anonymous user so that it can now simultaneously function as a MySensors repeater.
       */
      
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24                            // A 2.4Ghz transmitter and receiver, often used with MySensors.
      #define MY_RF24_PA_LEVEL RF24_PA_MAX              // This sets a low-power mode for the radio. Useful if you use the verison with the bigger antenna, but don' want to power that from a separate source. It can also fix problems with fake Chinese versions of the radio.
      //#define MY_RADIO_RFM69                          // 433Mhz transmitter and reveiver.
      
      // Choose if you want this sensor to also be a repeater.
      // #define MY_REPEATER_FEATURE                    // Just remove the two slashes at the beginning of this line to also enable this sensor to act as a repeater for other sensors. If this node is on battery power, you probably shouldn't enable this.
      // Are you using this sensor on battery power?
      #define BATTERY_POWERED                   // Just remove the two slashes at the beginning of this line if your node is battery powered. It will then go into deep sleep as much as possible. But when it' sleeping it can' work as a repeater.
      #define MY_NODE_ID 20
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      
      // These defines and variables can be changed:
      #define COMPARE_TEMP 1                            // Send temperature only if changed? 1 = Yes 0 = No. Can save battery.
      #define ONE_WIRE_BUS 3                            // Pin where Dallas sensor(s) is/are connected.
      #define MAX_ATTACHED_DS18B20 16                   // Maximum amount of teperature sensors you can connect to this arduino (16).
      
      unsigned long measurementInterval = 3000;        // Time to wait between reads (in milliseconds).
      
      // You should not change these:
      OneWire oneWire(ONE_WIRE_BUS);                    // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      DallasTemperature sensors(&oneWire);              // Pass the oneWire reference to Dallas Temperature.
      float lastTemperature[MAX_ATTACHED_DS18B20];      // creates an array to hold the previous temperature measurements for each possible sensor.
      int numSensors=0;                                 // variable to contain the number of found attached sensors.
      boolean metric = true;                            // old Mysensors??
      unsigned long measurementSleepTime = 0;           // variable to store the Sleep time if the node is battery powered.
      
      
      // Mysensors settings
      MyMessage msg(0,V_TEMP);                          // Sets up the message format that we'l be sending to the MySensors gateway later.
      
      
      void before()
      {
         sensors.begin();                              // Startup up the OneWire library. It allows multiple sensors to talk over one wire (one pin).
      }
      
      void setup()
      {
         for(int i=0; i<MAX_ATTACHED_DS18B20; i++) {
            lastTemperature[i] = 0;  //Pre-filling array with 0's.
         }
         sensors.setWaitForConversion(false);            // requestTemperatures() will not block current thread
      
      #ifdef BATTERY_POWERED
         measurementSleepTime = measurementInterval;
         measurementInterval = 1;                    // We'll let Sleep take over the scheduling. When the arduino is asleep, millis doesn't increment anymore (time stops as it were). To fix this, we'l set the measurement interval time to 1, so that when the arduino wakes up it will immediately try to measure again.
      #endif
      
         Serial.begin(115200);                           // for serial debugging.
         Serial.print("Hello world, I am a sensor. \n ");
      
      }
      
      void presentation()
      {
         sendSketchInfo("Temperature Sensor", "1.2");    // Send the sketch version information to the gateway and Controller
         numSensors = sensors.getDeviceCount();          // Fetch the number of attached temperature sensors
         for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
            present(i, S_TEMP);                          // Present all sensors to controller (16 maximum).
         }
      }
      
      
      void loop()
      {
      
         // You should not change these variables:
         static boolean isMeasuring = true;                // Used to indicate when the time is right for a new measurement to be made.
         static boolean isCalculating = false;                     // Used to bridge the time that is needed to calculate the temperature values by the Dallas library.
         static unsigned long currentMillis = 0;                   // The millisecond clock in the main loop.
         static unsigned long previousMeasurementMillis = 0;       // Used to remember the time of the last temperature measurement.
         static int16_t conversionTime = 0;                        // Used to store the time needed to calculate the temperature from measurements.
      
         currentMillis = millis(); // The time since the sensor started, counted in milliseconds. This script tries to avoid using the Sleep function, so that it could at the same time be a MySensors repeater.
      
         // Let's measure the temperature
         if(isMeasuring == true && currentMillis - previousMeasurementMillis >= measurementInterval) { // If we're not calculating, and enough time has passed, we'll start again.
            isMeasuring = false; // We're measuring, so let's take it off our to-do list.
            Serial.print("Starting new measurement(s)\n");
            previousMeasurementMillis = currentMillis; // Mark the time of the initialiation of this measurement.
      
            // Fetch temperatures from Dallas sensors
            sensors.requestTemperatures();
      
            // query conversion time. Apparently it takes a while to calculate.
            //CONVERSION_TIME = sensors.millisToWaitForConversion(sensors.getResolution());
            conversionTime = millisToWaitForConversion(sensors.getResolution());
            isCalculating = true; //Next step is to re-calculate the temperature again.
         }
      
      
         // Next, let's calculate and send the temperature
         if(isCalculating == true && currentMillis > previousMeasurementMillis + conversionTime ) {
            isCalculating = false; // check calculating off the to-do list too.
      
            for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {    // Loop through all the attached temperatur sensors.
               float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;   // Fetch and round temperature to one decimal
               Serial.print("Sensor #");
               Serial.print(i);
               Serial.print(" says it is ");
               Serial.print(temperature);
               Serial.print(" degrees\n");
               if(temperature != -127.00 && temperature != 85.00) { // avoid working with measurement errors.
                  if (COMPARE_TEMP == 1 && lastTemperature[i] == temperature) {
                     Serial.print("Not sending it though, because it's the same temperature as before.\n");
                  } else {
                     Serial.print("Sending the temperature to the gateway.\n");
                     send(msg.setSensor(i).set(temperature,1));
                     lastTemperature[i] = temperature; // Save new temperatures to be able to compare in the next round.
                  }
               }
            }
      
            // Both tasks are done. Time to wait until we should measure again.
            Serial.print("zzzzZZZZzzzzZZZZzzzz\n");
      
      #ifdef BATTERY_POWERED
            unsigned long quicktimecheck = millis(); // check how much time has passed during the measurement (can be up to 750 milliseconds), and then calculate from that how long to sleep until the next intended measuring time.
            unsigned long sleeptime = measurementSleepTime - (quicktimecheck - previousMeasurementMillis); //How much time has passed already during the calculating? Subtract that from the intended interval time.
            sleep (sleeptime);
      #endif
      
            isMeasuring = true;
         }
      }
      
      
      // This function helps to avoid a problem with the latest Dallas temperature library.
      int16_t millisToWaitForConversion(uint8_t bitResolution)
      {
         switch (bitResolution) {
         case 9:
            return 94;
         case 10:
            return 188;
         case 11:
            return 375;
         default:
            return 750;
         }
      }```
      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen
    • Serial Gateway problems

      Hello All

      First time poster here, so I hope I am in the right place.

      At some point the Serial Gateway comes up with TSM:READY:NWD REQ and nothing more happens.
      I have to restart to get it up and running again.

      Now it looks to me that I am missing something, I have been searching the forum for some help but haven't found it.
      I am running a temp sketch on a pro mini and the gateway on a pi.

      Any help would be appreciated.

      posted in Troubleshooting
      Tommy Petersen
      Tommy Petersen