Fév 212015
 

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.

rising-edgefalling-edge

 

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 …).

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.