{"id":1582,"date":"2015-02-21T23:00:43","date_gmt":"2015-02-21T22:00:43","guid":{"rendered":"http:\/\/labalec.fr\/erwan\/?p=1582"},"modified":"2015-02-28T13:37:07","modified_gmt":"2015-02-28T12:37:07","slug":"water-impulse-counter-and-arduino-part-3","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=1582","title":{"rendered":"Water impulse counter and Arduino : Part 3"},"content":{"rendered":"<p>In <a href=\"https:\/\/labalec.fr\/erwan\/?p=1576\" target=\"_blank\">previous article<\/a>, my water pulse was settled in my garage.<\/p>\n<p>Lets now design a wiring schema based on Arduino.<br \/>\nThe 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.<br \/>\nWe then want to detect either when it is LOW, or FALLING, or CHANGE.<br \/>\nFor now I&rsquo;ll go for FALLING as this one is the easiest to implement.<\/p>\n<p><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2015\/02\/rising-edge.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1587 size-medium\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2015\/02\/rising-edge-300x169.png\" alt=\"rising-edge\" width=\"300\" height=\"169\" srcset=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2015\/02\/rising-edge-300x169.png 300w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2015\/02\/rising-edge.png 562w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1588 size-medium\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2015\/02\/falling-edge-300x169.png\" alt=\"falling-edge\" width=\"300\" height=\"169\" srcset=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2015\/02\/falling-edge-300x169.png 300w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2015\/02\/falling-edge.png 562w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>We would then use something like the below :<\/p>\n<p><code><br \/>\n\/\/in the setup<br \/>\nattachInterrupt(1, CallBack, FALLING);<\/code><\/p>\n<p>void CallBack(){<br \/>\n\/\/the below check will software debounce our switch<br \/>\nif (millis()-last_water&gt;500) {<br \/>\nlast_water=millis();<br \/>\nwater=water+1;<br \/>\n}<br \/>\n}<\/p>\n<p><a href=\"http:\/\/imgur.com\/FLEFlZi\"><img decoding=\"async\" title=\"source: imgur.com\" src=\"http:\/\/i.imgur.com\/FLEFlZi.png\" alt=\"\" \/><\/a><\/p>\n<p>Next article will be about the code (a web server, logging to SD card, monitoring impulses &#8230;).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 <a href='https:\/\/labalec.fr\/erwan\/?p=1582' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[72],"class_list":["post-1582","post","type-post","status-publish","format-standard","hentry","category-arduino","tag-water-impulse-counter","category-18-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1582"}],"version-history":[{"count":6,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1582\/revisions"}],"predecessor-version":[{"id":1593,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1582\/revisions\/1593"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}