In previous article, my water pulse was settled in my garage.
Lets now design a wiring schema based on Arduino.
The idea is to use interrupts on the Arduino : it will be HIGH (i.e near 5V) always except and it will be LOW when the reed switch will be closed.
We then want to detect either when it is LOW, or FALLING, or CHANGE.
For now I’ll go for FALLING as this one is the easiest to implement.
We would then use something like the below :
//in the setup
attachInterrupt(1, CallBack, FALLING);
void CallBack(){
//the below check will software debounce our switch
if (millis()-last_water>500) {
last_water=millis();
water=water+1;
}
}
Next article will be about the code (a web server, logging to SD card, monitoring impulses …).