Navigation

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

    Enfeet

    @Enfeet

    1
    Reputation
    13
    Posts
    445
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Enfeet Follow

    Best posts made by Enfeet

    • RE: 💬 Rain Gauge

      Hi all,

      finally i rewrite a code for myself. There is no More EEPROM usage at all.
      I'm using MajorDoMo (http://majordomohome.com/) and it more suitable for me to have a 10 minutes counts from Rain Gauge.

      Here is my new code:

      #define MY_RFM69_ENABLE_ENCRYPTION
      
      /**
       * 
       Author: Sergey E. Yakovlev
       Date: 2017/02/25 u001
       
       * 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.
       *
      */
      
      #define SKETCH_NAME "Enic Rain Gauge"
      #define SKETCH_VERSION "0.1"
      #define DWELL_TIME 40  // this allows for radio to come back to power after a transmission, ideally 0 
      #define DHT_ON // uncomment out this line to enable DHT sensor
      
      
      
      // Enable debug prints to serial monitor
      //#define MY_DEBUG
      //#define MY_DEBUG_VERBOSE
      //#define MY_NODE_ID AUTO
      #define MY_NODE_ID 15
      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      #define MY_RFM69_FREQUENCY RF69_433MHZ
      #define MY_RFM69_NETWORKID 100
      #define MY_RFM69_TX_POWER 31
      
      #include <MySensors.h>
      #include <Adafruit_Sensor.h>
      #include <DHT_U.h>
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_RAIN_LOG 3  // Keeps track of accumulated rainfall
      int tipSensorPin = 3; // Pin the tipping bucket is connected to. Must be interrupt capable pin
      int ledPin = 5; // Pin the LED is connected to.  PWM capable pin required
      #define DHTPIN       8         // Pin which is connected to the DHT sensor.
      // Uncomment the type of sensor in use:
      //#define DHTTYPE           DHT11     // DHT 11 
      #define DHTTYPE           DHT22     // DHT 22 (AM2302)
      //#define DHTTYPE           DHT21     // DHT 21 (AM2301)
      char buff[10];
      unsigned long SEND_FREQUENCY = 60000*10; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway.
      DHT_Unified dht(DHTPIN, DHTTYPE);
      #define TIP_SENSOR_PIN 3
      //d=112 mm
      //11689.863832 mm2 =  116,89863832 cm2
      //42,77209787776081 mm
      //88 89 91 91 90 = 89,8
      //0,4763039852757329
      #define CALIBRATE_FACTOR 48 // amount of rain per rain bucket tip e.g. 5 is .05mm
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgRain(CHILD_ID_RAIN_LOG, V_RAIN);
      
      sensors_event_t event;
      unsigned long lastSend;               //Last Send millis()
      unsigned long lastTipTime=millis();
      volatile unsigned int rainBucket=0;
      
      void presentation()  {
        // Register all sensors to gw (they will be created as child devices)
        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        wait(DWELL_TIME);
        present(CHILD_ID_RAIN_LOG, S_RAIN);
        wait(DWELL_TIME);
      
      #ifdef DHT_ON
        present(CHILD_ID_HUM, S_HUM);
        wait(DWELL_TIME);
        present(CHILD_ID_TEMP, S_TEMP);
        wait(DWELL_TIME);
      #endif
      
      
      //  M_DEBUG_PRINTLN(F("Sensor Presentation Complete"));
      }
      
      void setup()
      {
        // Set up the IO
        pinMode(TIP_SENSOR_PIN, INPUT);
        attachInterrupt (digitalPinToInterrupt(TIP_SENSOR_PIN), sensorTipped, FALLING);  // depending on location of the hall effect sensor may need CHANGE
        pinMode(ledPin, OUTPUT);
        digitalWrite(ledPin, HIGH);
      
      }
      
      void loop(){
        unsigned long now = millis();
        if (now - lastSend > SEND_FREQUENCY) {
        send(msgRain.set((float)rainBucket / 100, 1));
        rainBucket=0;
        wait(DWELL_TIME);
      
        // Get temperature event and print its value.
        double t = -1;
        dht.temperature().getEvent(&event);
        if (isnan(event.temperature)) {
          debug(PSTR("!USR:DHT:Error reading temperature!\n"));
        } else {
            t = event.temperature;
            dtostrf(t,6,(uint8_t)2,buff); 
            debug(PSTR("USR:DHT:t=%s\n"),buff);
            send(msgTemp.set(buff)); 
        }
        // Get humidity event and print its value.
        double h = -1;
        dht.humidity().getEvent(&event);
        if (isnan(event.relative_humidity)) {
          debug(PSTR("!USR:DHT:Error reading humidity!\n"));
        } else {
            h = event.relative_humidity;
            dtostrf(h,6,(uint8_t)2,buff); 
            debug(PSTR("USR:DHT:h=%s\n"),buff);
            send(msgHum.set(buff));        
        }
          lastSend=now;
        }
      }
      void sensorTipped()
      {
        unsigned long thisTipTime = millis();
        if (thisTipTime - lastTipTime > 100UL)
        {
          rainBucket += CALIBRATE_FACTOR; // adds CALIBRATE_FACTOR hundredths of unit each tip
        }
        lastTipTime = thisTipTime;
      }
      

      0_1505816593504_RainGauge20170918.png

      And now i able to see when it was a rain and how strong it was 😉


      SY
      Sergey

      posted in Announcements
      Enfeet
      Enfeet

    Latest posts made by Enfeet

    • RE: 💬 Rain Gauge

      Hi all,

      finally i rewrite a code for myself. There is no More EEPROM usage at all.
      I'm using MajorDoMo (http://majordomohome.com/) and it more suitable for me to have a 10 minutes counts from Rain Gauge.

      Here is my new code:

      #define MY_RFM69_ENABLE_ENCRYPTION
      
      /**
       * 
       Author: Sergey E. Yakovlev
       Date: 2017/02/25 u001
       
       * 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.
       *
      */
      
      #define SKETCH_NAME "Enic Rain Gauge"
      #define SKETCH_VERSION "0.1"
      #define DWELL_TIME 40  // this allows for radio to come back to power after a transmission, ideally 0 
      #define DHT_ON // uncomment out this line to enable DHT sensor
      
      
      
      // Enable debug prints to serial monitor
      //#define MY_DEBUG
      //#define MY_DEBUG_VERBOSE
      //#define MY_NODE_ID AUTO
      #define MY_NODE_ID 15
      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      #define MY_RFM69_FREQUENCY RF69_433MHZ
      #define MY_RFM69_NETWORKID 100
      #define MY_RFM69_TX_POWER 31
      
      #include <MySensors.h>
      #include <Adafruit_Sensor.h>
      #include <DHT_U.h>
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_RAIN_LOG 3  // Keeps track of accumulated rainfall
      int tipSensorPin = 3; // Pin the tipping bucket is connected to. Must be interrupt capable pin
      int ledPin = 5; // Pin the LED is connected to.  PWM capable pin required
      #define DHTPIN       8         // Pin which is connected to the DHT sensor.
      // Uncomment the type of sensor in use:
      //#define DHTTYPE           DHT11     // DHT 11 
      #define DHTTYPE           DHT22     // DHT 22 (AM2302)
      //#define DHTTYPE           DHT21     // DHT 21 (AM2301)
      char buff[10];
      unsigned long SEND_FREQUENCY = 60000*10; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway.
      DHT_Unified dht(DHTPIN, DHTTYPE);
      #define TIP_SENSOR_PIN 3
      //d=112 mm
      //11689.863832 mm2 =  116,89863832 cm2
      //42,77209787776081 mm
      //88 89 91 91 90 = 89,8
      //0,4763039852757329
      #define CALIBRATE_FACTOR 48 // amount of rain per rain bucket tip e.g. 5 is .05mm
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgRain(CHILD_ID_RAIN_LOG, V_RAIN);
      
      sensors_event_t event;
      unsigned long lastSend;               //Last Send millis()
      unsigned long lastTipTime=millis();
      volatile unsigned int rainBucket=0;
      
      void presentation()  {
        // Register all sensors to gw (they will be created as child devices)
        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        wait(DWELL_TIME);
        present(CHILD_ID_RAIN_LOG, S_RAIN);
        wait(DWELL_TIME);
      
      #ifdef DHT_ON
        present(CHILD_ID_HUM, S_HUM);
        wait(DWELL_TIME);
        present(CHILD_ID_TEMP, S_TEMP);
        wait(DWELL_TIME);
      #endif
      
      
      //  M_DEBUG_PRINTLN(F("Sensor Presentation Complete"));
      }
      
      void setup()
      {
        // Set up the IO
        pinMode(TIP_SENSOR_PIN, INPUT);
        attachInterrupt (digitalPinToInterrupt(TIP_SENSOR_PIN), sensorTipped, FALLING);  // depending on location of the hall effect sensor may need CHANGE
        pinMode(ledPin, OUTPUT);
        digitalWrite(ledPin, HIGH);
      
      }
      
      void loop(){
        unsigned long now = millis();
        if (now - lastSend > SEND_FREQUENCY) {
        send(msgRain.set((float)rainBucket / 100, 1));
        rainBucket=0;
        wait(DWELL_TIME);
      
        // Get temperature event and print its value.
        double t = -1;
        dht.temperature().getEvent(&event);
        if (isnan(event.temperature)) {
          debug(PSTR("!USR:DHT:Error reading temperature!\n"));
        } else {
            t = event.temperature;
            dtostrf(t,6,(uint8_t)2,buff); 
            debug(PSTR("USR:DHT:t=%s\n"),buff);
            send(msgTemp.set(buff)); 
        }
        // Get humidity event and print its value.
        double h = -1;
        dht.humidity().getEvent(&event);
        if (isnan(event.relative_humidity)) {
          debug(PSTR("!USR:DHT:Error reading humidity!\n"));
        } else {
            h = event.relative_humidity;
            dtostrf(h,6,(uint8_t)2,buff); 
            debug(PSTR("USR:DHT:h=%s\n"),buff);
            send(msgHum.set(buff));        
        }
          lastSend=now;
        }
      }
      void sensorTipped()
      {
        unsigned long thisTipTime = millis();
        if (thisTipTime - lastTipTime > 100UL)
        {
          rainBucket += CALIBRATE_FACTOR; // adds CALIBRATE_FACTOR hundredths of unit each tip
        }
        lastTipTime = thisTipTime;
      }
      

      0_1505816593504_RainGauge20170918.png

      And now i able to see when it was a rain and how strong it was 😉


      SY
      Sergey

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      @schmucke I'm using 5V 1Amp from tiny mobile charger https://www.thingiverse.com/thing:2171813

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      Ups! After 3 days.....

      0_1498752618409_20170629_1909.png

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      @dbemowsk Sorry, i m living in metric units 😉 But, i think it can be calculated logically. Just look at a DIY project: https://www.education.com/science-fair/article/DIY-rain-gauge/ The logic is to attach a scale to a bottle and measure the mm or inches of rain occured. Our goal is recalculate the number of impulses to the amount of precipitation depending on square of our bucket. So it's possible to take a bottle with the same square like our bucket, attach a scale (inches or mm does not matter) and let collect all water out of our measuring gauge i.e. take a litter or half flow it to a gauge and collect after. And finally just divide measured level of collected water to the number of impulses counted....
      Sorry if method is not clear... 😉 I can draw an idea in a pictures 😉

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      @Enfeet Precipitation intensity
      "Strong" is called rain, if it drops from 15 to 49 mm in 12 hours. Precipitation is also "very strong" when it falls from 50 mm in 12 hours.
      "Strong snow" - the amount of precipitation from 7 to 19 mm for 12 hours. "Very heavy snow," when its amount exceeds 20 mm in 12 hours.

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      @dbemowsk I think it's time to look in a book 😉 "The amount of precipitation is expressed in millimeters of a layer of water that would be formed from the precipitation, if they did not evaporate, did not seep into the soil and would not drain. Numerically, the amount of precipitation in millimeters is equal to the amount of kilograms of water left on the site in 1 sq.meter, i.e. 1 mm = 1 kg / 1 m2.

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      @Enfeet o! d=122 not 112... uff correct 😉

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      @dbemowsk i use first found online calculator http://onlinemschool.com/math/assistance/figures_area/circle/
      and... strange.... it gives other result 😉 So my calculations are incorrect ;-(
      A = 1 4 π d2 = 1 4 π 1122 = 3136 π ≈ 9852.032512

      SY
      Sergey

      posted in Announcements
      Enfeet
      Enfeet
    • RE: 💬 Rain Gauge

      @dbemowsk

      20mm magnetic contact like this:
      alt text

      SY
      Enfeet

      posted in Announcements
      Enfeet
      Enfeet
    • RE: Rain Guage

      Lets continue in correct topic https://forum.mysensors.org/topic/4821/rain-gauge/35

      posted in My Project
      Enfeet
      Enfeet