Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rain gauge sensor #90

Closed
user2684 opened this Issue May 13, 2017 · 2 comments

Comments

Projects
None yet
1 participant
@user2684
Copy link
Contributor

user2684 commented May 13, 2017

@user2684 user2684 added this to the unassigned milestone May 13, 2017

@user2684

This comment has been minimized.

Copy link
Contributor Author

user2684 commented May 14, 2017

There are a few reasons why I cannot use the code at https://www.mysensors.org/build/rain:

  • Depends a the controller to request the current time
  • Different measures (V_RAIN, V_RAINRATE, etc.) would require different sensors but the interrupt can be attached only once
  • Having different messages in the same sensor would not work since loop() expects a single value
  • The idea behind storing information in EEPROM is nice but would make the code too complex
  • having a custom onLoop() which sends all the messages would require ALWAYS_ON mode preventing other sensors to report periodically

I will go for a over-simplified custom version

@user2684 user2684 modified the milestones: v1.5, unassigned May 14, 2017

@user2684

This comment has been minimized.

Copy link
Contributor Author

user2684 commented May 14, 2017

Added SENSOR_RAIN_GAUGE depending on MODULE_ANALOG_INPUT.
Made available the following functions:

     // set how frequently to report back to the controller in minutes. After reporting the measure is resetted (default: 60);
    void setReportInterval(int value);
    // set how many mm of rain to count for each tip (default: 0.11);
    void setSingleTip(float value);

Caveats:

  • The node cannot be powered with batteries since using millis() to keep track of the time and sleep would prevent it to work correctly. Use wait instead (e.g. nodeManager.setSleep(WAIT,1,HOURS);)
  • Use setReportInterval() to set the minimum time interval for reporting. Rain will be reported when loop() is executed and the elapsed from the last report is more than the defined interval. So for example to report every hour, set the sleep mode to WAIT for 1 hour and set setReportInterval() to be less than 60 .
  • Once the rain is reported, the counter is reset. This should allow the flexibility to measure hourly or daily intervals (not both) by setting setReportInterval() accordingly.
  • Use setSingleTip() to set the mm of rain to count for each tip. The default 0.11 is ok for the rain gauge available in the MySensors' shop. To measure, use a cough syrup glass which can measure the water in ml and drop it just the right amount to have the gauge tipping. Then use http://www.antiguamet.com/useful_conversions.htm to convert from ml to mm.

Example:

  nodeManager.registerSensor(SENSOR_RAIN_GAUGE,3);
  nodeManager.setSleep(WAIT,1,MINUTES);

@user2684 user2684 self-assigned this May 14, 2017

@user2684 user2684 added the fixed label May 14, 2017

@user2684 user2684 closed this May 14, 2017

user2684 pushed a commit that referenced this issue May 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.