Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naoto64/arduino-rainsense
Rain sensor library for Arduino
https://github.com/naoto64/arduino-rainsense
arduino arduino-rainsense rain-sensor rainfall
Last synced: 4 days ago
JSON representation
Rain sensor library for Arduino
- Host: GitHub
- URL: https://github.com/naoto64/arduino-rainsense
- Owner: naoto64
- License: mit
- Created: 2019-06-17T12:32:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-29T12:01:54.000Z (about 4 years ago)
- Last Synced: 2023-12-16T15:16:50.588Z (11 months ago)
- Topics: arduino, arduino-rainsense, rain-sensor, rainfall
- Language: C++
- Homepage: https://naoto64.web.fc2.com/page/electric/181222-rain-sense.html
- Size: 154 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Arduino-RainSense
====## Overview
This is a rain sensor library for Arduino. Prepare two electrodes and connect them to GND and analog input pins.
This library can use a rain sensor to detect if it is raining. Since it is possible to detect each drop of raindrops, it is possible to measure precipitation intensity, etc. If you do not have a rainfall sensor, you can make your own using aluminum tape.## Demo
![RainSense](https://github.com/naoto64/Arduino-RainSense/blob/master/RainSense.png)
````cpp:example.ino
#include
#define delayTime 10
RainSense rs = RainSense (A0);
unsigned long time = 0;
int rainBool = 0;
void setup () {
Serial.begin (9600);
if (rs.rain (40)) {
Serial.println ("It's raining");
rainBool = 1;
} else {
Serial.println ("It is not raining.");
}
}
void loop () {
if (time> = 1000 * 60 * 5) {
time = 0;
rainBool = 0;
Serial.println ("It is not raining.");
}
if (rs.rain (40)) {
if (rainBool == 0) {
Serial.println ("It's raining");
rainBool = 1;
}
time = 0;
} else if (rainBool == 1) {
time + = delayTime;
}
delay (delayTime);
}
````## Usage
#### Method
````cpp:example.ino
RainSense RainSense (uint8_t pin)
````pin: Analog pin number
Create an instance.````cpp:example.ino
value (byte samples=1, byte sensitivity=16)
````Returns the sensor value in bytes. Values range from 0 to 100. A higher value indicates a stronger response. samples is the number of samples. The larger the value, the better the accuracy, but the processing takes longer. sensitivity is the sensitivity correction. Increase if there is noise. The larger the value, the longer it takes to process.
````cpp:example.ino
rain (byte threshold, byte samples=1, byte sensitivity=16)
````Compares the value of the sensor with the threshold and returns the result as a boolean. The main specifications are the same as value. Returns 1 if the sensor value is above the threshold.
## License
MIT