{"id":8027,"date":"2020-10-08T11:13:50","date_gmt":"2020-10-08T08:13:50","guid":{"rendered":"https:\/\/roboromania.ro\/produs\/senzor-de-debit-de-apa-water-flow-sensor-compatibil-arduino\/"},"modified":"2021-07-18T11:05:55","modified_gmt":"2021-07-18T08:05:55","slug":"senzor-de-debit-de-apa-water-flow-sensor-compatibil-arduino","status":"publish","type":"product","link":"https:\/\/roboromania.ro\/?product=senzor-de-debit-de-apa-water-flow-sensor-compatibil-arduino","title":{"rendered":"Senzor de debit de ap\u0103 (Water Flow Sensor) compatibil Arduino"},"content":{"rendered":"<p>Senzor de debit de ap\u0103 (Water Flow Sensor) compatibil Arduino<\/p>\n<p class=\"themes_products_title\">YF-S201 1\/2&#8221;<\/p>\n<p><a href=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-8028\" src=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-1-300x287.jpg\" alt=\"debit-apa-1\" width=\"300\" height=\"287\" srcset=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-1-300x287.jpg 300w, https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-1.jpg 590w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Utilizat \u00een principal la instalatiile pentru testarea apei, sistemul de r\u0103cire\/inc\u0103lzire a apei<\/p>\n<p>Aplica\u021bie:<br \/>\n\u00eenc\u0103lzitoare de ap\u0103<br \/>\nma\u0219ini pentru imbuteliat<br \/>\ndistribuitor automat de ap\u0103<br \/>\ndispozitiv de m\u0103surare a debitului<\/p>\n<p>Amplitudine mare: \u2265 4,6V<br \/>\nAmplitudine redus\u0103: \u2264 0,5V<br \/>\nTestarea presiunii hidrostatice: \u2264 2,0 MPa<br \/>\nRezisten\u021ba izola\u021biei: \u2265 100M\u03a9<br \/>\nTemperatura de utilizare: \u2264 80 \u00b0 C<br \/>\nCea mai mic\u0103 tensiune nominal\u0103 de lucru: DC4,5 &#8230; 5V<br \/>\nCurent maxim de func\u021bionare: 15mA (DC 5V)<br \/>\nCapacitate de \u00eenc\u0103rcare: \u2264 10mA (DC 5V)<br \/>\nGama de umiditate de func\u021bionare: 35% ~ 90% RH (f\u0103r\u0103 \u00eenghe\u021b)<br \/>\nPresiune admisibil\u0103: presiune 2.0Mpa<br \/>\nTemperatura: -25 ~ +80 \u00b0 C<br \/>\nRacorduri externe: 1\/2 &#8221;<br \/>\n2.5 &#8222;x 1,4&#8243; x 1,4 &#8221;<\/p>\n<p><a href=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-8029\" src=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-2-293x300.jpg\" alt=\"debit-apa-2\" width=\"293\" height=\"300\" srcset=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-2-293x300.jpg 293w, https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Debit-apa-2.jpg 560w\" sizes=\"auto, (max-width: 293px) 100vw, 293px\" \/><\/a><a href=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Senzor-debit-Arduino.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-8636\" src=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Senzor-debit-Arduino-300x167.jpg\" alt=\"Senzor-debit-Arduino\" width=\"300\" height=\"167\" srcset=\"https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Senzor-debit-Arduino-300x167.jpg 300w, https:\/\/roboromania.ro\/wp-content\/uploads\/2020\/10\/Senzor-debit-Arduino.jpg 619w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>5V VCC (red wire)<br \/>\nGND (black wire)<br \/>\nSignal\/pulse (usually yellow)<\/p>\n<p>Exemplu cod:<\/p>\n<p>\/*<br \/>\nLiquid flow rate sensor<\/p>\n<p>Measure the liquid\/water flow rate using this code.<br \/>\nConnect Vcc and Gnd of sensor to arduino, and the<br \/>\nsignal line to arduino digital pin 2.<\/p>\n<p>*\/<\/p>\n<p>byte statusLed = 13;<\/p>\n<p>byte sensorInterrupt = 0; \/\/ 0 = digital pin 2<br \/>\nbyte sensorPin = 2;<\/p>\n<p>\/\/ The hall-effect flow sensor outputs approximately 4.5 pulses per second per<br \/>\n\/\/ litre\/minute of flow.<br \/>\nfloat calibrationFactor = 4.5;<\/p>\n<p>volatile byte pulseCount;<\/p>\n<p>float flowRate;<br \/>\nunsigned int flowMilliLitres;<br \/>\nunsigned long totalMilliLitres;<\/p>\n<p>unsigned long oldTime;<\/p>\n<p>void setup()<br \/>\n{<\/p>\n<p>\/\/ Initialize a serial connection for reporting values to the host<br \/>\nSerial.begin(38400);<\/p>\n<p>\/\/ Set up the status LED line as an output<br \/>\npinMode(statusLed, OUTPUT);<br \/>\ndigitalWrite(statusLed, HIGH); \/\/ We have an active-low LED attached<\/p>\n<p>pinMode(sensorPin, INPUT);<br \/>\ndigitalWrite(sensorPin, HIGH);<\/p>\n<p>pulseCount = 0;<br \/>\nflowRate = 0.0;<br \/>\nflowMilliLitres = 0;<br \/>\ntotalMilliLitres = 0;<br \/>\noldTime = 0;<\/p>\n<p>\/\/ The Hall-effect sensor is connected to pin 2 which uses interrupt 0.<br \/>\n\/\/ Configured to trigger on a FALLING state change (transition from HIGH<br \/>\n\/\/ state to LOW state)<br \/>\nattachInterrupt(sensorInterrupt, pulseCounter, FALLING);<br \/>\n}<\/p>\n<p>\/**<br \/>\n* Main program loop<br \/>\n*\/<br \/>\nvoid loop()<br \/>\n{<\/p>\n<p>if((millis() &#8211; oldTime) &gt; 1000) \/\/ Only process counters once per second<br \/>\n{<br \/>\n\/\/ Disable the interrupt while calculating flow rate and sending the value to<br \/>\n\/\/ the host<br \/>\ndetachInterrupt(sensorInterrupt);<\/p>\n<p>\/\/ Because this loop may not complete in exactly 1 second intervals we calculate<br \/>\n\/\/ the number of milliseconds that have passed since the last execution and use<br \/>\n\/\/ that to scale the output. We also apply the calibrationFactor to scale the output<br \/>\n\/\/ based on the number of pulses per second per units of measure (litres\/minute in<br \/>\n\/\/ this case) coming from the sensor.<br \/>\nflowRate = ((1000.0 \/ (millis() &#8211; oldTime)) * pulseCount) \/ calibrationFactor;<\/p>\n<p>\/\/ Note the time this processing pass was executed. Note that because we&#8217;ve<br \/>\n\/\/ disabled interrupts the millis() function won&#8217;t actually be incrementing right<br \/>\n\/\/ at this point, but it will still return the value it was set to just before<br \/>\n\/\/ interrupts went away.<br \/>\noldTime = millis();<\/p>\n<p>\/\/ Divide the flow rate in litres\/minute by 60 to determine how many litres have<br \/>\n\/\/ passed through the sensor in this 1 second interval, then multiply by 1000 to<br \/>\n\/\/ convert to millilitres.<br \/>\nflowMilliLitres = (flowRate \/ 60) * 1000;<\/p>\n<p>\/\/ Add the millilitres passed in this second to the cumulative total<br \/>\ntotalMilliLitres += flowMilliLitres;<\/p>\n<p>unsigned int frac;<\/p>\n<p>\/\/ Print the flow rate for this second in litres \/ minute<br \/>\nSerial.print(&#8222;Flow rate: &#8222;);<br \/>\nSerial.print(int(flowRate)); \/\/ Print the integer part of the variable<br \/>\nSerial.print(&#8222;.&#8221;); \/\/ Print the decimal point<br \/>\n\/\/ Determine the fractional part. The 10 multiplier gives us 1 decimal place.<br \/>\nfrac = (flowRate &#8211; int(flowRate)) * 10;<br \/>\nSerial.print(frac, DEC) ; \/\/ Print the fractional part of the variable<br \/>\nSerial.print(&#8222;L\/min&#8221;);<br \/>\n\/\/ Print the number of litres flowed in this second<br \/>\nSerial.print(&#8221; Current Liquid Flowing: &#8222;); \/\/ Output separator<br \/>\nSerial.print(flowMilliLitres);<br \/>\nSerial.print(&#8222;mL\/Sec&#8221;);<\/p>\n<p>\/\/ Print the cumulative total of litres flowed since starting<br \/>\nSerial.print(&#8221; Output Liquid Quantity: &#8222;); \/\/ Output separator<br \/>\nSerial.print(totalMilliLitres);<br \/>\nSerial.println(&#8222;mL&#8221;);<\/p>\n<p>\/\/ Reset the pulse counter so we can start incrementing again<br \/>\npulseCount = 0;<\/p>\n<p>\/\/ Enable the interrupt again now that we&#8217;ve finished sending output<br \/>\nattachInterrupt(sensorInterrupt, pulseCounter, FALLING);<br \/>\n}<br \/>\n}<\/p>\n<p>\/*<br \/>\nInsterrupt Service Routine<br \/>\n*\/<br \/>\nvoid pulseCounter()<br \/>\n{<br \/>\n\/\/ Increment the pulse counter<br \/>\npulseCount++;<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>Arduino projects.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Senzor umiditate sol (Soil Hygrometer Humidity) pentru proiectele Arduino.<\/p>\n","protected":false},"featured_media":8028,"comment_status":"open","ping_status":"closed","template":"","meta":[],"product_brand":[],"product_cat":[9],"product_tag":[282,7,195,196,281,193,41,40],"class_list":{"0":"post-8027","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-senzori","7":"product_tag-apa","8":"product_tag-arduino","9":"product_tag-detectare","10":"product_tag-meteo","11":"product_tag-nivel","12":"product_tag-ploaie","13":"product_tag-sensor","14":"product_tag-senzor","16":"first","17":"instock","18":"sale","19":"shipping-taxable","20":"purchasable","21":"product-type-simple"},"_links":{"self":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/product\/8027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/product"}],"about":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/types\/product"}],"replies":[{"embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8027"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=\/wp\/v2\/media\/8028"}],"wp:attachment":[{"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8027"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fproduct_brand&post=8027"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fproduct_cat&post=8027"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/roboromania.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fproduct_tag&post=8027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}