General Description
Leaf wetness sensor developed by YetiSystems is resistive. It has low consumption, quality of the data and long operating life.
It operates at 3V3 or 5V and needs to be connected to a digital input PIN (GPIO).
It is easy to integrate and provides an easy interpretation of the data collected.
The output range from 0 Hz (wet) to 1200Hz as the sensor gets drier. The user can select the threshold level under which the sensor is considered wet .

Specification
| PARAMETER | MIN | TYP | MAX | UNITS |
|---|---|---|---|---|
| Operating Voltage | 3 | 3.3 or 5 | 5.5 | V |
| Operating Temperature Range | -40 | - | +85 | °C |
| Storage Temperature Range | -55 | - | +125 | °C |
| Consumption | 0.5 | 0.85 | 1.0 | mA |
Pinouts
| PINOUT | (DIN 47100) |
|---|---|
| Brown | VCC (3.3V or 5V) |
| Blue | DATA - OUT |
| Black | GND |
Mechanical Informations

Example 1: Reading YetiSystems Leaf Wetness Sensor MK1 with Archimede
This module works with acme boards using acmepins library which provide raspberry-gpio-python like GPIO functions for Acme boards.
-*- coding: utf-8 -*-
from acmepins import GPIO
from time import sleep
import time
# GPIO lw sensor
anem_input = GPIO('N17', 'INPUT')
# initialize vars
last_click = 0
event_started = 0
now_freq = []
def median(lst):
n = len(lst)
if n < 1:
return 0
if n % 2 == 1:
return sorted(lst)[n//2]
else:
return sum(sorted(lst)[n//2-1:n//2+1])/2.0
# interrupt handler
def event_handler():
global last_click
global now_freq
now = time.time()*1000.
delta_t = now - last_click
# first click
if (last_click != 0) and (len(now_freq) < 10):
last_click = now
now_freq.append( freq(delta_t))
elif (last_click == 0):
last_click = now
else:
sleep(5)
# calculate freq in Hz from milliseconds
def freq(delta_t):
return int(1./(delta_t/1000.))
# return 1 if the sensor is weat (frequency above threshold) or 0 otherwise
def is_weat(threshold=150):
global now_freq
global event_started
now_freq = []
# polling
if event_started == 0:
event_started = 1
anem_input.set_edge("falling", event_handler)
# wait 1 sec
sleep(2)
now_freq_med = median(now_freq)
return int(now_freq_med < threshold), now_freq_med
Example 2: Reading YetiSystems Leaf Wetness Sensor MK1 with Raspberry
In this example we use the RPi.GPIO Python Module. The sensor data cable is connected to port 25 of Raspberry.
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
from time import sleep
import time
# GPIO lw sensor
anem_input = GPIO('N17', 'INPUT')
# initialize vars
last_click = 0
event_started = 0
now_freq = []
def median(lst):
n = len(lst)
if n < 1:
return 0
if n % 2 == 1:
return sorted(lst)[n//2]
else:
return sum(sorted(lst)[n//2-1:n//2+1])/2.0
# interrupt handler
def event_handler():
global last_click
global now_freq
now = time.time()*1000.
delta_t = now - last_click
# first click
if (last_click != 0) and (len(now_freq) < 10):
last_click = now
now_freq.append( freq(delta_t))
elif (last_click == 0):
last_click = now
else:
sleep(5)
# calculate freq in Hz from milliseconds
def freq(delta_t):
return int(1./(delta_t/1000.))
# return 1 if the sensor is weat (frequency above threshold) or 0 otherwise
def is_weat(threshold=150):
global now_freq
global event_started
now_freq = []
# polling
if event_started == 0:
event_started = 1
GPIO.add_event_detect(25, GPIO.FALLING, callback=event_handler)
# wait 1 sec
sleep(2)
now_freq_med = median(now_freq)
return int(now_freq_med < threshold), now_freq_med
Example 3: Reading YetiSystems Leaf Wetness Sensor MK1 with Arduino
The example prints the frequency detected on sensor connected on pin 7 of Arduino board.
int pin = 7;
unsigned long duration;
unsigned long frequency;
void setup() {
Serial.begin(9600);
pinMode(pin, INPUT);
}
void loop() {
duration = pulseIn(pin, HIGH);
frequency = 500000/duration;
Serial.println(frequency);
}