Le capteur de pluie :

  • Une sortie numérique 1/0
  • Une sortie analogique 0 à 1023

Capteur de pluie

Features:
  • Voltage: 5V
  • Power indicator light, the output signal LED indicating lamp.
  • TTL level output, TTL output signal for low level drive capacity of around 100MA, can directly drive the relay, a buzzer, a small fan, etc..
  • Sensitivity adjustment via potentiometer
  • No rain when the LED light output is high, the output level, go up, LED bright.
  • The board and the control board is separate, convenient wire.
  • A large area of the board, more conducive to detect the rain.
  • The board is equipped with a positioning hole to facilitate installation
  • Control panel board size: 3*1.6 MM
  • A large area of raindrop detection board 5.4*4.0 MM
  • Connect cable: 200MM

 

Code test pour l'entrée analogique :

int sensorPin = A0;    // select the input pin for the potentiometer 0/1023
int sensorValue = 0;  // variable to store the value coming from the sensor
int oldValue = 0;
int sensorDelay=100;

// Seuil en dessous duquel regarder l'évolution
int seuil = 1000;

void setup() {
  Serial.begin( 115200 );
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);

  if ( sensorValue < seuil )
  {
    // si la valeur a changé de 1 on n'en tient pas compte, il y a trop de fluctuation sur la ligne pour que ce soit important
    if ( abs(  oldValue - sensorValue ) > 1 )
    {
      Serial.print("D");
      Serial.println(sensorValue);
    }
  }

  delay(sensorDelay);
  oldValue = sensorValue;
}