Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. รอเรือ
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    รอเรือ

    @รอเรือ

    22
    Reputation
    74
    Posts
    764
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    รอเรือ Follow

    Best posts made by รอเรือ

    • My Wind Station

      I made a wind station using the two following sensors that I bought on e-bay.

      • Wind Sensor JL-FS2 Wind Direction Sensor (4-20mA, 0-5V) Signal Output
      • Wind Speed Sensor Anemometer Three Cups Aluminium Alloyed pulse signal output

      0_1533548833049_s-l500.jpg
      0_1533548847083_s-l1600.jpg

      I think they are quite nice. They are fed with 12V DC and are giving a 5V output signal. Therefore I'm using a 5V Arduino Mini Pro for the sketch.

      The following sketch is measuring the wind data once a second, storing it into an array and doing calculations to get the average wind speed, direction and gust for each minute, each other minute and each 10 minutes.

      Before getting the average the wind is split into it's vector components. Cool isn't it?

      I upload the average 10 minute wind data to Weather Underground. It looks very smooth.

      Here is the sketch:

      /**
       * WindMonitor
       * 
      
      About the windspeed sensor, have a look here:
      https://www.dfrobot.com/wiki/index.php/Wind_Speed_Sensor_Voltage_Type(0-5V)_SKU:SEN0170#Connection_Diagram
      
      */
      #define MY_NODE_ID 17
      
      #define SKETCH_NAME "Wind Station"
      #define SKETCH_VERSION "1.1.1"
      #define DWELL_TIME 1000  // this allows for radio to come back to power after a transmission, ideally 0
      
      //#define MY_DEBUG // Enable debug Serial.prints to serial monitor and arrays are smaller
      
      #if defined MY_DEBUG
      #define MY_BAUD_RATE 115200 // Sets the serial baud rate for console and serial gateway
      
      #define Sprintln(a) (Serial.println(a))
      #define Sprint(a) (Serial.print(a))
      const uint8_t num1mReadings = 2; // Use a low value to free memory for making debug possible
      const uint8_t num2mReadings = 2; // Use a low value to free memory for making debug possible
      const uint8_t num10mReadings = 2; // Use a low value to free memory for making debug possible
      const uint8_t FORCE_TRANSMIT_CYCLE = 10; // Force sending value even if hasn't changed after N cycles
      const uint16_t WAIT_TIME = 5000;
      #else 
      #define Sprintln(a)
      #define Sprint(a)
      const uint8_t num1mReadings = 60; //Defines number of reading to calculate average windspeed
      const uint8_t num2mReadings = 2;
      const uint8_t num10mReadings = 10;
      const uint8_t FORCE_TRANSMIT_CYCLE = 10; // Force sending value even if hasn't changed after N cycles
      const uint16_t WAIT_TIME = 1000;
      #endif
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_PARENT_NODE_ID 0
      //#define MY_PARENT_NODE_IS_STATIC
      #include <MySensors.h>
      
      #define LED_PIN 8
      #define ANEMOMETER_ANALOG_PIN 0
      #define WIND_VANE_ANALOG_PIN 1
      
      #define CHILD_ID_WIND 0
      #define CHILD_ID_WIND2M 1
      #define CHILD_ID_WIND10M 2
      #define CHILD_ID_GUST_DIR 3 // Specifically for wind gust direction
      #define CHILD_ID_GUST2M_DIR 4
      #define CHILD_ID_GUST10M_DIR 5
      
      
      #define FORCE_TRANSMIT_CYCLE 60 // Force sending value even if hasn't changed after N cycles
      uint8_t cycleCountWindSpeed = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindGust = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindGustDir = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindDir = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindSpeed2m = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindGust2m = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindGustDir2m = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindDir2m = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindSpeed10m = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindGust10m = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindGustDir10m = FORCE_TRANSMIT_CYCLE;
      uint8_t cycleCountWindDir10m = FORCE_TRANSMIT_CYCLE;
      
      float last_wspeed;
      float last_wgust;
      uint16_t last_wdirection;
      uint16_t last_wgustdirection;
      float last_wspeed2m;
      float last_wgust2m;
      uint16_t last_wdirection2m;
      uint16_t last_wgustdirection2m;
      float last_wspeed10m;
      float last_wgust10m;
      uint16_t last_wdirection10m;
      uint16_t last_wgustdirection10m;
      
      float windSpeedReadings[num1mReadings]; // the readings from the analog input
      float windSpeedReadings2m[num2mReadings]; // For 2 minute average wind speed
      float windSpeedReadings10m[num10mReadings]; // For 10 minute average wind speed
      float windDirReadings[num1mReadings]; // the readings from the analog input
      float windDirReadings2m[num2mReadings]; // For 2 minute average wind dir
      float windDirReadings10m[num10mReadings]; // For 10 minute average wind dir
      float windGustReadings2m[num2mReadings]; // For 2 minute wind gust
      float windGustDirReadings2m[num2mReadings]; // For 2 minute wind gust direction
      float windGustReadings10m[num10mReadings]; // For 10 minute wind gust
      float windGustDirReadings10m[num10mReadings]; // For 10 minute wind gust direction
      boolean got2mins = false;
      boolean got10mins = false;
      
      float windSpeed = 0.0; // Wind speed in meters per second (m/s)
      float windDir = 0; // Wind dir in degrees 0-360
      uint8_t readIndex = 0; // the index of the current reading
      uint8_t minute2Index = 0; // the index of the current reading
      uint8_t minute10Index = 0; // the index of the current reading
      uint16_t sensorValue = 0; //Variable stores the value direct from the analog pin
      const uint8_t wsMin = 22; // Mininum reading
      const uint16_t wsMax = 1023; // Maximum reading
      const uint8_t wdMin = 3; // Mininum reading
      const uint16_t wdMax = 941; // Maximum reading
      const uint8_t windSpeedMax = 30; // Wind speed in meters/sec corresponding to maximum voltage
      
      
      MyMessage msgWSpeed(CHILD_ID_WIND, V_WIND);
      MyMessage msgWGust(CHILD_ID_WIND, V_GUST);
      MyMessage msgWDirection(CHILD_ID_WIND, V_DIRECTION);
      MyMessage msgWSpeed2m(CHILD_ID_WIND2M, V_WIND);
      MyMessage msgWGust2m(CHILD_ID_WIND2M, V_GUST);
      MyMessage msgWDirection2m(CHILD_ID_WIND2M, V_DIRECTION);
      MyMessage msgWSpeed10m(CHILD_ID_WIND10M, V_WIND);
      MyMessage msgWGust10m(CHILD_ID_WIND10M, V_GUST);
      MyMessage msgWDirection10m(CHILD_ID_WIND10M, V_DIRECTION);
      MyMessage msgWGustDir(CHILD_ID_GUST_DIR, V_DIRECTION);
      MyMessage msgWGust2mDir(CHILD_ID_GUST2M_DIR, V_DIRECTION);
      MyMessage msgWGust10mDir(CHILD_ID_GUST10M_DIR, V_DIRECTION);
      
      void setup()  
      {
        Sprint(SKETCH_NAME);
        Sprint(F(" version "));
        Sprint(SKETCH_VERSION);
        Sprint(F(" (using MY_NODE_ID: "));
        Sprint(MY_NODE_ID);
        Sprintln(F(") says hello!"));
      
        // Initialize arrays
        for (readIndex = 0; readIndex < num1mReadings; readIndex++) {
          windSpeedReadings[readIndex] = 0;
          windDirReadings[readIndex] = 0;
        }
        for (minute2Index = 0; minute2Index < num2mReadings; minute2Index++) {
          windSpeedReadings2m[minute2Index] = 0;
          windDirReadings2m[minute2Index] = 0;
          windGustReadings2m[minute2Index] = 0;
          windGustDirReadings2m[minute2Index] = 0;
        }
        for (minute10Index = 0; minute10Index < num10mReadings; minute10Index++) {
          windSpeedReadings10m[minute10Index] = 0;
          windDirReadings10m[minute10Index] = 0;
          windGustReadings10m[minute10Index] = 0;
          windGustDirReadings10m[minute10Index] = 0;
        }
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        wait(DWELL_TIME);
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_WIND, S_WIND);
        wait(DWELL_TIME);
        present(CHILD_ID_WIND2M, S_WIND);
        wait(DWELL_TIME);
        present(CHILD_ID_WIND10M, S_WIND);
        wait(DWELL_TIME);
        present(CHILD_ID_GUST_DIR, S_WIND);
        wait(DWELL_TIME);
        present(CHILD_ID_GUST2M_DIR, S_WIND);
        wait(DWELL_TIME);
        present(CHILD_ID_GUST10M_DIR, S_WIND);
        wait(DWELL_TIME);
      }
      
      struct speedAndDir {    
       float uv;
       float Dv;
      };
      
      struct speedAndDir windvec(float speedArr[], float dirArr[], uint8_t size) {
        /*
         *
         *       Function to calculate the wind vector from time series of wind speed and direction.
         *       
         *       Parameters:
         *           - u: array of wind speeds [m s-1].
         *           - D: array of wind directions [degrees from North].
         *           
         *       Returning speedAndDir struct values:
         *           - uv: Vector wind speed [m s-1].
         *           - Dv: Vector wind direction [degrees from North].
         *
         */
        struct speedAndDir o;
        float ve = 0.0; // define east component of wind speed
        float vn = 0.0; // define north component of wind speed
      
        for (int i = 0; i < size; ++i) {
          ve += speedArr[i] * sin(dirArr[i] * PI / 180.0); // calculate sum east speed components
          vn += speedArr[i] * cos(dirArr[i] * PI / 180.0); // calculate sum north speed components
        }
        ve = - ve / size; // determine average east speed component
        vn = - vn / size; // determine average north speed component
        o.uv = sqrt(ve * ve + vn * vn); // calculate wind speed vector magnitude
        // Calculate wind speed vector direction
        float vdir = atan2(ve, vn);
        vdir = vdir * 180.0 / PI; // Convert radians to degrees
        if (vdir < 180) {
          o.Dv = vdir + 180.0;
        }
        else {
          if (vdir > 180.0) {
            o.Dv = vdir - 180;
          }
          else {
            o.Dv = vdir;
          }
        }
        o.uv = ((int) (o.uv * 10.0 + 0.5) / 10.0); // Round to one decimal
        o.Dv = (o.uv == 0.0) ? 0 : ((int) (o.Dv + 0.5)); // Round to integer
        return o;
      }
      
      void loop()
      {
        readIndex++;
        if (readIndex >= num1mReadings) {
          readIndex = 0;
        }
      
        /* 
         * Wind speed reading 
         */
        sensorValue = analogRead(ANEMOMETER_ANALOG_PIN); //Get a value between 0 and 1023 from the analog pin connected to the anemometer
        sensorValue = (sensorValue < wsMin) ? wsMin : sensorValue;
        windSpeed = (float)(sensorValue - wsMin)*windSpeedMax/(wsMax - wsMin);
        windSpeedReadings[readIndex] = windSpeed;
      
        Sprint(F("Reading: "));
        Sprint(readIndex);
        Sprint(F(", Wind speed sensor value: "));
        Sprint(sensorValue);
        Sprint(F(", wind speed: "));
        Sprint(windSpeed);
        Sprint(F(" m/s."));
      
        /* 
         * Wind vane reading 
         */
        const float dirTable[] PROGMEM = {0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 135.0, 157.5, 180.0, 202.5, 225.0, 247.5, 270.0, 292.5, 315.0, 337.5};
        sensorValue = (windSpeed > 0) ? analogRead(WIND_VANE_ANALOG_PIN) : wdMin; //Get a value between 0 and 1023 from the analog pin connected to the wind vane
        sensorValue = (sensorValue < wdMin) ? wdMin : sensorValue;
      
        windDir = (sensorValue - wdMin)*337.5/(wdMax - wdMin); // This will be close but not exact.
        // Find the closest of the 16 predefined wind directions
        for (int i = 0; i < 16; ++i)
        {
          if (windDir < (dirTable[i] + 11.25)) {
            windDir = dirTable[i];
            break;
          }
        }
        windDirReadings[readIndex] = windDir;
      
        Sprint(F("\tWind direction sensor value: "));
        Sprint(sensorValue);
        Sprint(F(", wind direction: "));
        Sprint(windDir);
        Sprintln(F("°"));
      
        if (readIndex == num1mReadings - 1) {
          minute2Index++;
          minute2Index = (minute2Index >= num2mReadings) ? 0 : minute2Index;
          minute10Index++;
          minute10Index = (minute10Index >= num10mReadings) ? 0 : minute10Index;
          got2mins = (minute2Index == num2mReadings-1) ? true : got2mins; // One time switch
          got10mins = (minute10Index == num10mReadings-1) ? true : got10mins;
      
          cycleCountWindSpeed++;
          cycleCountWindGust++;
          cycleCountWindGustDir++;
          cycleCountWindDir++;
          cycleCountWindSpeed2m++;
          cycleCountWindGust2m++;
          cycleCountWindGustDir2m++;
          cycleCountWindDir2m++;
          cycleCountWindSpeed10m++;
          cycleCountWindGust10m++;
          cycleCountWindGustDir10m++;
          cycleCountWindDir10m++;
      
          struct speedAndDir o;
          o = windvec(windSpeedReadings, windDirReadings, num1mReadings);
          Sprint(F("\nWind vector calculation results: Speed: "));
          Sprint(o.uv);
          Sprint(F(" m/s"));
          Sprint(F(" \tDirection: "));
          Sprint(o.Dv);
          Sprintln(F("°\n"));
      
          float gust = 0;
          uint16_t gustDir = 0;
          for (int i = 0; i < num1mReadings; ++i)
          {
            if (windSpeedReadings[i] > gust)
              gust = windSpeedReadings[i];
              gustDir = windDirReadings[i];
          }
          gust = ((int) (gust * 10.0 + 0.5) / 10.0);
      
          windSpeedReadings10m[minute10Index] = windSpeedReadings2m[minute2Index] = o.uv;
          windDirReadings10m[minute10Index] = windDirReadings2m[minute2Index] = o.Dv;
          windGustReadings10m[minute10Index] = windGustReadings2m[minute2Index] = gust;
          windGustDirReadings10m[minute10Index] = windGustDirReadings2m[minute2Index] = gustDir;
      
          if ((o.uv != last_wspeed) or (cycleCountWindSpeed >= FORCE_TRANSMIT_CYCLE)) {
            cycleCountWindSpeed = 0;
            last_wspeed = o.uv;
            Sprint(F("Sending wind speed: "));
            Sprint(o.uv);
            Sprintln(F(" m/s"));
            send(msgWSpeed.set(o.uv, 1));
            wait(DWELL_TIME);
          }
          if ((gust != last_wgust) or (cycleCountWindGust >= FORCE_TRANSMIT_CYCLE)) {
            cycleCountWindGust = 0;
            last_wgust = gust;
            Sprint(F("Sending wind gust speed: "));
            Sprint(gust);
            Sprintln(F(" m/s"));
            send(msgWGust.set(gust, 1));
            wait(DWELL_TIME);
          }
          if ((o.Dv != last_wdirection) or (cycleCountWindDir >= FORCE_TRANSMIT_CYCLE)) {
            cycleCountWindDir = 0;
            last_wdirection = o.Dv;
            Sprint(F("Sending wind direction: "));
            Sprint(o.Dv);
            Sprintln(F("°"));
            send(msgWDirection.set(o.Dv, 0));
            wait(DWELL_TIME);
          }
          if ((gustDir != last_wgustdirection) or (cycleCountWindGustDir >= FORCE_TRANSMIT_CYCLE)) {
            cycleCountWindGustDir = 0;
            last_wgustdirection = gustDir;
            Sprint(F("Sending wind gust direction: "));
            Sprint(gustDir);
            Sprintln(F("°"));
            send(msgWGustDir.set(gustDir, 0));
            wait(DWELL_TIME);
          }
          // Do the 2 minute average but only if we have been running for 2 minutes or more.
          if (got2mins) {
            o = windvec(windSpeedReadings2m, windDirReadings2m, num2mReadings);
            Sprint(F("\n==========2 minute wind vector calculation results: Speed: "));
            Sprint(o.uv);
            Sprint(F(" m/s"));
            Sprint(F(" \tDirection: "));
            Sprint(o.Dv);
            Sprintln(F("°\n"));
      
            gust = gustDir = 0;
            for (int i = 0; i < num2mReadings; ++i)
            {
              if (windGustReadings2m[i] > gust)
                gust = windGustReadings2m[i];
                gustDir = windDirReadings2m[i];
            }
            gust = ((int) (gust * 10.0 + 0.5) / 10.0);
      
            if ((o.uv != last_wspeed2m) or (cycleCountWindSpeed2m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindSpeed2m = 0;
              last_wspeed2m = o.uv;
              Sprint(F("Sending 2 min wind speed: "));
              Sprint(o.uv);
              Sprintln(F(" m/s"));
              send(msgWSpeed2m.set(o.uv, 1));
              wait(DWELL_TIME);
            }
            if ((gust != last_wgust2m) or (cycleCountWindGust2m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindGust2m = 0;
              last_wgust2m = gust;
              Sprint(F("Sending 2 min wind gust speed: "));
              Sprint(gust);
              Sprintln(F(" m/s"));
              send(msgWGust2m.set(gust, 1));
              wait(DWELL_TIME);
            }
            if ((o.Dv != last_wdirection2m) or (cycleCountWindDir2m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindDir2m = 0;
              last_wdirection2m = o.Dv;
              Sprint(F("Sending 2 min wind direction: "));
              Sprint(o.Dv);
              Sprintln(F("°"));
              send(msgWDirection2m.set(o.Dv, 0));
              wait(DWELL_TIME);
            }
            if ((gustDir != last_wgustdirection2m) or (cycleCountWindGustDir2m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindGustDir2m = 0;
              last_wgustdirection2m = gustDir;
              Sprint(F("Sending 2 min wind gust direction: "));
              Sprint(gustDir);
              Sprintln(F("°"));
              send(msgWGust2mDir.set(gustDir, 0));
              wait(DWELL_TIME);
            }
          }
      
          // Do the 10 minute average but only if we have been running for 10 minutes or more.
          if (got10mins) {
            o = windvec(windSpeedReadings10m, windDirReadings10m, num10mReadings);
            Sprint(F("\n#############10 minute wind vector calculation results: Speed: "));
            Sprint(o.uv);
            Sprint(F(" m/s"));
            Sprint(F(" \tDirection: "));
            Sprint(o.Dv);
            Sprintln(F("°\n"));
      
            gust = gustDir = 0;
            for (int i = 0; i < num10mReadings; ++i)
            {
              if (windGustReadings10m[i] > gust)
                gust = windGustReadings10m[i];
                gustDir = windDirReadings10m[i];
            }
            gust = ((int) (gust * 10.0 + 0.5) / 10.0);
      
            if ((o.uv != last_wspeed10m) or (cycleCountWindSpeed10m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindSpeed10m = 0;
              last_wspeed10m = o.uv;
              Sprint(F("Sending 10 min wind speed: "));
              Sprint(o.uv);
              Sprintln(F(" m/s"));
              send(msgWSpeed10m.set(o.uv, 1));
              wait(DWELL_TIME);
            }
            if ((gust != last_wgust10m) or (cycleCountWindGust10m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindGust10m = 0;
              last_wgust10m = gust;
              Sprint(F("Sending 10 min wind gust speed: "));
              Sprint(gust);
              Sprintln(F(" m/s"));
              send(msgWGust10m.set(gust, 1));
              wait(DWELL_TIME);
            }
            if ((o.Dv != last_wdirection10m) or (cycleCountWindDir10m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindDir10m = 0;
              last_wdirection10m = o.Dv;
              Sprint(F("Sending 10 min wind direction: "));
              Sprint(o.Dv);
              Sprintln(F("°"));
              send(msgWDirection10m.set(o.Dv, 0));
              wait(DWELL_TIME);
            }
            if ((gustDir != last_wgustdirection10m) or (cycleCountWindGustDir10m >= FORCE_TRANSMIT_CYCLE)) {
              cycleCountWindGustDir10m = 0;
              last_wgustdirection10m = gustDir;
              Sprint(F("Sending 10 min wind gust direction: "));
              Sprint(gustDir);
              Sprintln(F("°"));
              send(msgWGust10mDir.set(gustDir, 0));
              wait(DWELL_TIME);
            }
          }
        }
        
        wait(WAIT_TIME);
      }
      

      0_1533549913325_graph.png

      Feel free to improve the code if you want. It's occupying a great deal of dynamic memory. I guess that the wind directions could be stored in a uint16_t type instead (multiplied by 10) but I haven't done that.

      0_1533550317138_ws.JPG

      The arrangement above is temporary. I just used what I had available.

      Wind Sensor JL-FS2 Wind Direction Sensor (4-20mA, 0-5V) Signal Output

      $52.57
      Sold out
      posted in My Project
      รอเรือ
      รอเรือ
    • RE: 💬 Soil Moisture Sensor

      How would you guys protect one of these capacitive soil moisture sensors from moisture in case the probe shall be buried 20 cm deep in the soil outdoors.

      The way they are made now, they may only be used in a indoor flower pot and even then there is a risk that the probes electronic components will be drowned in water while watering your flowers. Ideally, they should be water proof from the beginning, that's what I think.

      Anyway, now I have a few of them and I intend to do a solar powered a multi depth soil moisture sensor using capacitive soil moisture sensors at various depths.

      So, how to protect them?

      I have an idea but I'm not sure it's working: Put it partly inside a plastic tube and cover the electronics with 2 component expoxy glue. ...

      EDIT 1 : maybe silicone rubber would work...
      EDIT 2 : Adding a photo of an untested prototype. Plastic housing filled with construction silicone rubber!
      0_1529322106621_sensor.jpg

      EDIT 3: Prototype sensor works great. (At least for the moment. I hope it will last several years.)
      Cheers!

      posted in Announcements
      รอเรือ
      รอเรือ
    • RE: Where to buy components now if you happen to live in Sweden

      Sorry for the monologue!

      Today I found a seller on E-bay that has most of the things that I will need. The new strategy is to buy many items from a single seller in a single transaction. Kindly asking him to put everything inside one box (We'll see if GONG TAO manages to do that)

      The sellers store: https://www.ebay.com/str/modulefans

      There are many other stores too of course but I think the above mentioned is quite good.

      Cheers!

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: 💬 Easy/Newbie PCB for MySensors

      Hello @sundberg84

      What if feeding a Pro Mini 3.3V (EasyPCB Nrf24l01+ edition rev 10) with regulated power on RAW. (I have 5 VDC). I guess I can feed the radio via the VCC terminal instead of using an external voltage regulator. Can the EasyPCB be used in such a setup?

      Edit: To answer my own question. I should RTFM 👊

      It states clearly that:

      "(If you are using regulated 3.3v, use 5v instructions but skip the voltage regulator and bypass this with a jumper between Vin and Vout"

      Thanks anyway!

      posted in OpenHardware.io
      รอเรือ
      รอเรือ
    • RE: Misol rain gauge tipping bucket rain amount

      @hek

      I let 1126-202 grams water slowly flow into the 55 cm2 gauge and it generated 475 tips.

      That gives me 0.3537 mm/tip. I'll go with that. ☺

      posted in Hardware
      รอเรือ
      รอเรือ
    • RE: !TSM:FPAR:NO REPLY

      My problem was caused by the fact that the radio was inserted into a socket. The 4.7uF stabilizing capacitor was put on the main board side of the socket. Moving the capacitor to the radio board or just soldering the radio to the main board (without using a socket) solved the problem. So, don't use a socket between the radio and the stabilizing capacitor.

      Another interesting thing is that by putting a finger onto the antenna also solved the problem. I could use that method for testing all my radios (using the socket) before permanently soldering them onto the main board.

      posted in Troubleshooting
      รอเรือ
      รอเรือ
    • RE: Node behavior after connection lost

      @hek said:

      It takes a few failed transmission before it tries to "find new parent". Not sure what happended here without seeing the node log.

      @mfalkvidd said:

      @รอเรือ which version are you using? 2.0 has a problem with nodes that go back to sleep too soon after a failed send. This is fixed in the development version. See https://github.com/mysensors/MySensors/pull/558 for details.

      Thanks guys! Well, I'm on 2.0.0. I'm not the "adventurous type" so I'm not on the development version if You get my point (ha ha).

      It's good to know that there exists some healing mechanisms in the communication. I might wait for the next stable release or I might build me a dedicated "MySensor : RepeaterNode" with an external antenna to facilitate the communication with my upcoming battery powered nodes in my garden and for the lawn mower that really must be automated soon.

      Hej tjolahopp! (Cheers!)

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: NRF24L01+ range of only few meters

      I'm currently in the process of trying to figure out why one of my battery powered nodes isn't working very well with a newly purchased NRF24L01+PA+LNA module. I've shielded it as described in earlier posts. There is plenty of pure power in the batteries.

      Just as in the case for @pkjjneal it works well only if I'm touching the antenna with a finger.

      I decided to look inside the antenna:
      0_1533729640287_DSC_1916.JPG

      As you see above, it starts with an antenna cable that leads to a half wave dipole (where the antenna element is of about 1/4 wave length) and there is a "sleeve balun" going back over the cable . I can find no ground plane though. The problem that I can see is that the antenna length is 27 mm where it should optimally be 28.8 mm.

      Now, if I remove the antenna completely my node works quite well. At least better than if I use the original antenna unmodified.

      If I insert a wire (DIY antenna made by a paper clip) extending 121 mm out of the antenna sockets forming a full wave length antenna things work great.

      I also modified the original antenna so that the antenna element becomes 28.8 mm. It works a bit better but it's far from perfect and communication errors are shown in the log.

      As the final test, I added a nice ground plane to the original antenna and now it works really perfect!
      0_1533729823658_DSC_1917.JPG

      So what can I learn from this?

      My test rig is an EasyPCB powered with batteries. I'm quite sure that my NRF24L01+PA+LNA module used in another scenario, for example connected to a Arduino Nano fed by a FTDI connector could actually work. It's because it would create a different environment. The antenna will work in relation to what it's connected to, shielding the grounding, and surrounding objects. Capacitive and inductive reactances are involved in mysterious ways.

      Anyway. My conclusion is that the two original antennas I have are not working very good. They obviously have the wrong length just a little bit, and I'd say that the the way the antenna is constructed with the sleeve balun and no ground plane, doesn't seem to work well. At least not here.

      I'll do some more experimenting with making my own antennas. Starting with taking apart an original antenna is not so bad, I can solder anything (solderable) onto the cable.

      Cheers!

      From wikipedia:

      Sleeve balun
      At VHF frequencies, a sleeve balun can also be built to remove feeder radiation.

      Another narrow-band design is to use a λ/4 length of metal pipe. The coaxial cable is placed inside the pipe; at one end the braid is wired to the pipe while at the other end no connection is made to the pipe. The balanced end of this balun is at the end where no connection is made to the pipe. The λ/4 conductor acts as a transformer, converting the zero impedance at the short to the braid into an infinite impedance at the open end. This infinite impedance at the open end of the pipe prevents current flowing into the outer coax formed by the outside of the inner coax shield and the pipe, forcing the current to remain in the inside coax.

      posted in Hardware
      รอเรือ
      รอเรือ
    • RE: Build a reliable power supply chain

      Thanks @Mathea90 for bringing up this interesting subject.

      It's sure difficult I believe to find a power supply for various Arduino projects that's both reliable and has a low cost.

      @sundberg84 made a nice breakout PCB for the HLK-PM01, that "was considered at that time (2015-2017) the best AC to DC 5v module option (within reasonable price range)."

      I hesitate though to build them due to that they will not be certified and if I cause a fire at my home, my home insurance may not cover the damages that can arise. With that being said, I'm quite sure that the HLK-PM01-breakout-board is by far much more safer than many wall plug chargers marked with CE (China Export).

      It would be nice to have a breakout board that can turn the power from any random 5V wall plug charger into something that's clean and ripple free with a good margin to feed NRF24L01+ nodes with. With such a board I wouldn't have to be involved in working directly with 230V AC.

      Meanwhile I'll probably try to build me a couple of LC filters using prototype breadboards.

      Thanks again and keep up the good work!

      posted in Troubleshooting
      รอเรือ
      รอเรือ
    • RE: CDEBYTE's new NRF24 modules are great! (and cheap)

      @yveaux said in CDEBYTE's new NRF24 modules are great! (and cheap):

      This patch makes both regular and amplified nRF24 modules work correctly!

      Dear @Yveaux

      Thanks for all the work you've put into investigating this issue.

      I have a different brand of the Nano IO Shield but the quality is equally very low. I guess I'll need to inspect them carefully before I use them. I guess I have 10 of them and I will try to apply the HW patch you've suggested but I'm not sure I'll be able to make it, I don't have any SMD resistors and they are to small to work with for me. I'll need to give it a try anyway.

      Thanks again and merry christmas btw 🎅

      posted in General Discussion
      รอเรือ
      รอเรือ

    Latest posts made by รอเรือ

    • RE: EV Charger (type 2) with RESTful API and Wifi recommendations?

      @rmh said in EV Charger (type 2) with RESTful API and Wifi recommendations?:

      @รอเร-อ btw Normal single phase type 2 charging on an EV is 32a = 7 Kw. If your ev can charge at 22Kw, then it will need a 3 phase supply. OpenEVSE can do this but you will need to put a 3 phase contactor in it.
      R

      Thanks a lot. That seems to be exactly what I'm looking for. I didn't order the kit though. I ordered the EmonEVSE WiFi Connected EV Charging Station IEC 60947-5 (Type-2)

      I'm very excited to get started. Ohh... I'll need an EV too... ha ha

      posted in General Discussion
      รอเรือ
      รอเรือ
    • EV Charger (type 2) with RESTful API and Wifi recommendations?

      Hi there!

      Time for me to invest in a EV Charger (type 2).

      Of course I'd like it to have a RESTful API and Wifi. Even better if it could connect to my MQTT server as well. 22 kW would be fine.

      I can't just install any "smart" charger that measures the used grid power because it can't determine the direction of the current. I export solar energy daytime which makes power flow outwards to the grid. I'd like to be able to set the max power depending on how much solar power I produce and how much I can import. If I can control when charging occurs I can also select the cheapest hours.

      BTW, I prefer to buy my EV charger in Europe.

      Cheers!

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: CDEBYTE's new NRF24 modules are great! (and cheap)

      @yveaux

      I've managed to replace the SMD resistors according to your suggested hack described above. It wasn't easy though. Anyway, it seems to work well. Thanks!!!

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: CDEBYTE's new NRF24 modules are great! (and cheap)

      @yveaux said in CDEBYTE's new NRF24 modules are great! (and cheap):

      This patch makes both regular and amplified nRF24 modules work correctly!

      Dear @Yveaux

      Thanks for all the work you've put into investigating this issue.

      I have a different brand of the Nano IO Shield but the quality is equally very low. I guess I'll need to inspect them carefully before I use them. I guess I have 10 of them and I will try to apply the HW patch you've suggested but I'm not sure I'll be able to make it, I don't have any SMD resistors and they are to small to work with for me. I'll need to give it a try anyway.

      Thanks again and merry christmas btw 🎅

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: CDEBYTE's new NRF24 modules are great! (and cheap)

      @skywatch said in CDEBYTE's new NRF24 modules are great! (and cheap):

      What current rating is the power source you are using?

      I intend to run them on power level RF24_PA_MAX. I have tried other power levels in my efforts without any success.

      @yveaux said in CDEBYTE's new NRF24 modules are great! (and cheap):

      recently received the same Nano IO shields and discovered the IO lines to the nRF are fed through a voltage divider; levels are halved w.r.t. direct connection.
      According to Nordic's datasheet this should be ok (minimum HIGH level input voltage is 0.7 * VDD, so 0.7 * 3.3V = 2.31V) as long as your Arduino is fed with 5V this should just work, but it is tricky IMHO.
      You could measure the VCC of the Nano to see if it is below 5V, or try powering the board through the power jack and see if things improve.

      That's interesting. I'm powering it with USB only but i have tried to connect an additional power source as well but it made no difference, I will do some more tests and measure the voltage levels.

      @yveaux said in CDEBYTE's new NRF24 modules are great! (and cheap):

      Did you also try the shielded module with #define MY_RF24_PA_LEVEL RF24_PA_MIN ?

      From what I recall, I have tried RF24_PA_LOW. I will test RF24_PA_MIN too.

      @yveaux said in CDEBYTE's new NRF24 modules are great! (and cheap):

      Currently I'm out of Nanos, but as soon as the new batch comes in I can replicate your setup.

      I'd be happy to send you one from my batch. Please send me a PM if you'd like that.

      @alowhum said in CDEBYTE's new NRF24 modules are great! (and cheap):

      Since moving to these boards all my connection troubles have stopped. I'm very happy with them.

      Sounds very promising 😀

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: CDEBYTE's new NRF24 modules are great! (and cheap)

      @yveaux

      I have spent 2 days trying to solve my various NRF24 related problems at my home.

      What I'd like to achieve is to make my serial gateway using a NRF24-transciever with an external antenna to extends it's range.

      CDEBYTE's new NRF24-transciever (the unshielded one) works in my serial gateway (built with a Nano IO Shield) and fed with USB power only. I can attach a separate power source if I want to but it seems to work well without it.

      However, CDEBYTE's new shielded NRF24-transciever (Shielded nRF24L01 PA+LNA) refuses to work. I get only NACKs in the log even if I attach a separate power source. I've also tried just connecting my Nano board directly to the radio with cables (without the IO shield) just like in the Build a serial gateway demo. (I've tried all kind of power settings) I also tried to power the radio with a battery. Those NACKs are resilient indeed. Of course I've tried all kind of decouple capacitors and several combinations of electrolytic and ceramic ones... No way.

      BUT, there is always a but isn't there? ... I have managed to get the CDEBYTE Shielded nRF24L01 PA+LNA to work stable on a battery powered node, a Pro Mini ATmega 328 (1.8V 1 MHz). I can't tell why that works while not working with the Nano.

      My current working solution is using the "old" unshielded nRF24L01 PA+LNA mounted on the Nano IO Shield fed with usb power only. #define MY_RF24_PA_LEVEL RF24_PA_MAX While this seems to work (at least for the moment) I can not just switch to using the shielded radio.

      So if someone succeeds using the CDEBYTE Shielded nRF24L01 PA+LNA connected to a Nano board I'm interested to hear how you made it work.

      The thing is that everything that I have tried gives so random results that it's driving me crazy. Whatever seems to work one minute stops to work the next minute.

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: CDEBYTE's new NRF24 modules are great! (and cheap)

      @yveaux I'll investigate further today and report here afterwards. Thanks.

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: CDEBYTE's new NRF24 modules are great! (and cheap)

      @alowhum said in CDEBYTE's new NRF24 modules are great! (and cheap):

      I've also ordered a shielded version that I'm still waiting for.

      Today, I've tried the unshielded one and the few that I've tried seem to work.

      However, I haven't been able to make the shielded one work on a IO Shield for Arduino Nano. I've used antennas from older traditional NRF24L01+PA+LNA Antenna version. No way. I will try different decoupling-Capacitors tomorrow.

      I feel I'm stuck in the NRF24-hell...

      posted in General Discussion
      รอเรือ
      รอเรือ
    • RE: Interrupted sleep

      @mfalkvidd Thanks a lot for your suggestion. I will think this through during the day. It might still be problems due to the dynamic nature of the rain.

      It would be hard for me to define a reasonable good value for MAX_NUMBER_OF_TRIPS_WITHOUT_SENSOR_REPORT when rain in the interval ranging from 11 mm per hour up to maybe as much as 240 mm per hour (extreme but not impossible) would disrupt the readings of other sensors.

      I also have a doubt that my sketch will work well in a case where the Arduino is already awake (handling other sensors) when the rain bucket tips. It's just a guess but I believe that the tipping will not be counted at all in such a scenario.

      What do you think? If so my sketch is badly designed (only myself to blame) and maybe I should consider giving the rain gauge it's own Arduino board. It would make things much cleaner. What do you think?

      @Yveaux, you are right.

      posted in Development
      รอเรือ
      รอเรือ
    • Interrupted sleep

      Hi guys.

      I have a sketch for a battery powered node that sleeps a certain amount of time, let's say 2 minutes. unsigned long SLEEP_TIME = 120000; // Wait time between reads (in milliseconds) When it wakes up, it will check a few sensors and report new values (if any) to the gateway. So far so good.

      However (there's always a but, isn't there?), the 2 minute sleep is allowed to be interrupted by the change of a pin. That pin is connected to a rain meter. Measuring the rain must be done instantly.

      Every time that the loop() function runs, other sensors are checked.

      That's OK if it rains normally but sometimes it rains like h*ll. I'm concerned that the rain meter will be tripped so frequently that there is no time to check other sensors and report them to the gateway.

      I'm useless when it comes to explain things. But I'd like the rain sensor to report whenever the rain sensor is tripped. I would like the other sensors to report at the 2 minutes interval regardless of the rain sensor. As it is now, every time the rain sensor interrupts the sleep, all sensors gets checked. I would like it to report the rain and go back to sleep the REMAINING SLEEP TIME. I understand if my explanation is beyond what ca be understood (it's worse than Kurt Olsson) so I add the source below:

      /**
       * WeatherStation
       * 
       * DESCRIPTION
       * Arduino BH1750FVI Light sensor
       * communicate using I2C Protocol
       * this library enable 2 slave device addresses
       * Main address  0x23
       * secondary address 0x5C
       * connect the sensor as follows :
       *
       *   VCC  >>> 5V
       *   Gnd  >>> Gnd
       *   ADDR >>> NC or GND  
       *   SCL  >>> A5
       *   SDA  >>> A4
       * http://www.mysensors.org/build/light
      
      
      https://forum.mysensors.org/topic/9359/soft-wdt-reset-on-esp8266-rfm69-gateway-after-find-parent/20
      Connecting the BME280 Sensor:
      Sensor              ->  Board
      -----------------------------
      Vin (Voltage In)    ->  3.3V
      Gnd (Ground)        ->  Gnd
      SDA (Serial Data)   ->  A4
      SCK (Serial Clock)  ->  A5
      
      
      For temperature measurements we've selected the standard Dallas DS18B20.
      
      */
      
      #define MY_NODE_ID 15
      #define SKETCH_NAME "Weather Station"
      #define SKETCH_VERSION "1.1"
      #define DWELL_TIME 200  // this allows for radio to come back to power after a transmission, ideally 0
      
      // Enable debug Serial.prints to serial monitor
      //#define MY_DEBUG 
      
      #if defined MY_DEBUG
      
      #define Sprintln(a) (Serial.println(a))
      #define Sprint(a) (Serial.print(a))
      #else 
      #define Sprintln(a)
      #define Sprint(a)
      #endif
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>                                  // A communication backbone, the Serial Peripheral Interface.
      #include <MySensors.h>                            // The MySensors library.
      #include <Wire.h>                                 // Enables the Wire communication protocol.
      #include <DallasTemperature.h>
      #include <OneWire.h>
      #include <BH1750.h>
      //#include <BME280I2C.h> // From Library Manager
      #include <Adafruit_Sensor.h>
      #include <Adafruit_BME280.h>
      #undef BME280_ADDRESS         // Undef BME280_ADDRESS from the BME280 library to easily override I2C address
      #define BME280_ADDRESS (0x76) // Low = 0x76 , High = 0x77 (default on adafruit and sparkfun BME280 modules, default for library)
      
      uint8_t tipSensorPin = 3; // Pin the tipping bucket is connected to. Must be interrupt capable pin
      
      #define CHILD_ID_LIGHT 0
      #define CHILD_ID_TEMP_1 1
      #define CHILD_ID_TEMP_2 2 // Dallas DS18B20
      #define CHILD_ID_HUM 3
      #define CHILD_ID_BARO 4
      #define CHILD_ID_RAIN 5
      
      unsigned long SLEEP_TIME = 120000; // Wait time between reads (in milliseconds)
      #define FORCE_TRANSMIT_CYCLE 30
      uint8_t cycleCountLux = 0;
      uint8_t cycleCountPressure = 0;
      uint8_t cycleCountTemp2 = 0;
      uint8_t cycleCountHum = 0;
      
      int8_t interruptedBy = -1;
      
      Adafruit_BME280 bme; // I2C
      BH1750 lightSensor;
      
      #define ONE_WIRE_BUS 5 // Digital pin where dallas sensor is connected 
      OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      DallasTemperature DS18B20sensor(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
      
      uint16_t lastLux;
      float lastPressure;
      //float lastTemp1; // Temp from the BME280 Temp Hum Bar Sensor
      float lastTemp2; // Dallas DS18B20. Temp
      float lastHum;
      
      float tempThreshold = 0.2;                        // How big a temperature difference has to minimally  be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
      uint8_t humThreshold = 1;                         // How big a humidity difference has to minimally be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
      uint8_t presThreshold = 1;
      uint8_t luxThreshold = 1;
      
      MyMessage msgLight(CHILD_ID_LIGHT, V_LEVEL);  
      MyMessage msgTemp1(CHILD_ID_TEMP_1, V_TEMP);
      MyMessage msgTemp2(CHILD_ID_TEMP_2, V_TEMP);
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgPressure(CHILD_ID_BARO, V_PRESSURE);
      MyMessage msgRain(CHILD_ID_RAIN, V_TRIPPED);
      
      void setup()  
      {
        Wire.begin(); // Wire.begin(sda, scl) // starts the wire communication protocol, used to chat with the BME280 sensor.
        Sprint(SKETCH_NAME);
        Sprint(F(" version "));
        Sprint(SKETCH_VERSION);
        Sprint(F(" (using MY_NODE_ID: "));
        Sprint(MY_NODE_ID);
        Sprintln(F(") says hello!"));
        delay(500);// just in case
        Sprintln(F("Running bme.begin()"));
        if (!bme.begin())
         {
          Serial.println("BME init failed!");
         }
        else Sprintln("BME init success!");
        Sprintln(F("Running lightSensor.begin()"));
        lightSensor.begin();
        Sprintln(F("Running DS18B20sensor.begin()"));
        DS18B20sensor.begin(); // Startup up the OneWire library used for Dallas DS18B20 Temp
        DS18B20sensor.setWaitForConversion(false); // requestTemperatures() will not block current thread
        pinMode(tipSensorPin, INPUT); // sets the rain sensor digital pin as input
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        wait(DWELL_TIME);
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        wait(DWELL_TIME);
        //present(CHILD_ID_TEMP_1, S_TEMP); //  Temp sensor on the BME280 multi sensor
        //wait(DWELL_TIME);
        present(CHILD_ID_TEMP_2, S_TEMP); // Dallas DS18B20. Temp
        wait(DWELL_TIME);
        present(CHILD_ID_HUM, S_HUM);
        wait(DWELL_TIME);
        present(CHILD_ID_BARO, S_BARO);
        wait(DWELL_TIME);
        present(CHILD_ID_RAIN, S_MOTION);
        wait(DWELL_TIME);
      }
      
      void loop()      
      {
        bool rainBucketTripped = (interruptedBy == digitalPinToInterrupt(tipSensorPin));
      
        wait(500); // Give radio some time to warm up
      
        cycleCountLux++;
        cycleCountPressure++;
        cycleCountTemp2++;
        cycleCountHum++;
      
        if (rainBucketTripped) {
          Sprintln("Tipping bucket rain sensor was tripped");
          send(msgRain.set(1));  // Send tripped value to gw
          wait(DWELL_TIME);
        }
      
        // Fetch temperature from Dallas DS18B20 Temp sensor
        DS18B20sensor.requestTemperatures();
      
        // query conversion time and sleep until conversion completed
        int16_t conversionTime = DS18B20sensor.millisToWaitForConversion(DS18B20sensor.getResolution());
        // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
        sleep(conversionTime);
        // Fetch and round temperature to one decimal
        float temp2 = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?DS18B20sensor.getTempCByIndex(0):DS18B20sensor.getTempFByIndex(0)) * 10.)) / 10.;
        if (isnan(temp2)) {
          Sprintln("Failed reading temp2");
        } else if (((abs(temp2 - lastTemp2) >= tempThreshold) or (cycleCountTemp2 >= FORCE_TRANSMIT_CYCLE)) && temp2 != -127.00 && temp2 != 85.00) {
          // Only send temp2 if it changed since the last measurement
          lastTemp2 = temp2;
          cycleCountTemp2 = 0;
          Sprint("Temperature: ");
          Sprint(temp2);
          Sprintln("°C");
          send(msgTemp2.set(temp2 ,1));
          wait(DWELL_TIME);
        }
      
        uint16_t lux = lightSensor.readLightLevel();// Get Lux value
        if (isnan(lux)) {
          Sprintln("Failed reading lux");
        } else if ((abs(lux - lastLux) >= luxThreshold) or  (cycleCountLux >= FORCE_TRANSMIT_CYCLE)){
          // Only send Lux if it changed since the last measurement
          lastLux = lux;
          cycleCountLux = 0;
          Sprint("Light: ");
          Sprint(lux);
          Sprintln(" Lux");
          send(msgLight.set(lux));
          wait(DWELL_TIME);
        }
      
        double pres, hum;
        pres=bme.readPressure()/100.0;
        hum=bme.readHumidity();
      
        if (isnan(hum)) {
          Sprintln("Failed reading humidity");
        } else {
          hum = round(hum);
          if ((abs(hum - lastHum) >= humThreshold) or (cycleCountHum >= FORCE_TRANSMIT_CYCLE)){
            // Only send humidity if it changed since the last measurement
            lastHum = hum;
            cycleCountHum = 0;
            Sprint("Humidity: ");
            Sprint(hum);
            Sprintln("% RH");
            send(msgHum.set(hum, 0));
            wait(DWELL_TIME);
          }
        }
      
        if (isnan(pres)) {
          Sprintln("Failed reading pressure");
        } else {
          pres = round(pres);
          if ((abs(pres - lastPressure) >= presThreshold) or (cycleCountPressure >= FORCE_TRANSMIT_CYCLE)) {
            // Only send pressure if it changed since the last measurement
            lastPressure = pres;
            cycleCountPressure = 0;
            Sprint("Pressure: ");
            Sprint(pres);
            Sprintln(" hPa");
            send(msgPressure.set(pres, 0));
            wait(DWELL_TIME);
          }
        }
      
        // Sleep until interrupt comes in on rain tip bucket sensor. Send update every SLEEP_TIME.
        Sprintln(F("Waiting ")); Sprint(SLEEP_TIME /1000); Sprintln(F(" seconds before next reading."));
        interruptedBy = sleep(digitalPinToInterrupt(tipSensorPin), CHANGE, SLEEP_TIME);
      }
      

      Another try to explain: When it rains heavily, I don't want to check and report humidity and temp. Humidity and temp should be reported in the interval that I've set in SLEEP_TIME.

      alt text

      Can it be done?

      posted in Development
      รอเรือ
      รอเรือ