{"id":22600,"date":"2016-07-14T11:56:08","date_gmt":"2016-07-14T11:56:08","guid":{"rendered":"http:\/\/randomnerdtutorials.com\/?p=22600"},"modified":"2019-04-02T10:23:32","modified_gmt":"2019-04-02T10:23:32","slug":"guide-for-rain-sensor-fc-37-or-yl-83-with-arduino","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/guide-for-rain-sensor-fc-37-or-yl-83-with-arduino\/","title":{"rendered":"Guide for Rain Sensor FC-37 or YL-83 with Arduino"},"content":{"rendered":"<p>The rain sensor is used to detect water and it can detect beyond of what a humidity sensor do. This article explains how to use the FC-37 rain sensor module with the Arduino.<!--more--><\/p>\n<p>The FC-37 rain sensor (or other versions like YL-83) is set up by two pieces: the electronic board (at the left) and the collector board (at the right) that collects the water drops, as you can see in the following figure:<\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-23481\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=375%2C405&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"rain sensor\" width=\"375\" height=\"405\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?w=600&amp;quality=100&amp;strip=all&amp;ssl=1 600w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=139%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 139w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=278%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 278w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=74%2C80&amp;quality=100&amp;strip=all&amp;ssl=1 74w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=204%2C220&amp;quality=100&amp;strip=all&amp;ssl=1 204w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=93%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 93w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=220%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=384%2C415&amp;quality=100&amp;strip=all&amp;ssl=1 384w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=451%2C487&amp;quality=100&amp;strip=all&amp;ssl=1 451w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?resize=551%2C595&amp;quality=100&amp;strip=all&amp;ssl=1 551w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/p>\n<p>The rain sensor has a built-in potentiometer for sensitivity adjustment of the digital output (D0). It also has a power LED that lights up when the sensor is turned on and a digital output LED.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-23499\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=650%2C323&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"labeled sensor\" width=\"650\" height=\"323\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?w=650&amp;quality=100&amp;strip=all&amp;ssl=1 650w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=150%2C75&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=300%2C149&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=80%2C40&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=220%2C109&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=201%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 201w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=280%2C139&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/labeled-sensor.png?resize=479%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 479w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>You can also read this guide for the <a href=\"https:\/\/randomnerdtutorials.com\/guide-for-soil-moisture-sensor-yl-69-or-hl-69-with-the-arduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">Soil Moisture Sensor YL-69 or HL-69 with the Arduino<\/a>.<\/p>\n<h2>How does it work?<\/h2>\n<p>Basically, the resistance of the collector board varies accordingly to the amount of water on its surface.<\/p>\n<p>When the board is:<\/p>\n<ul>\n<li><strong>Wet:<\/strong> the resistance increases, and the output voltage decreases<\/li>\n<li><strong>Dry:<\/strong> the resistance is lower, and the output voltage is higher<\/li>\n<\/ul>\n<h2><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-20902\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=700%2C380&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"rainsensor\" width=\"700\" height=\"380\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=150%2C81&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=300%2C163&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=80%2C43&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=220%2C119&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=184%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 184w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=276%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 276w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/05\/rainsensor.png?resize=438%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 438w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/h2>\n<h2>Example: Rain Sensor with Arduino<\/h2>\n<p>This is a simple example for you to understand how you can use the rain sensor in your projects with Arduino.<\/p>\n<p>In this example, you\u00a0will just read the analog sensor values using the Arduino and printing those readings in the Arduino IDE serial monitor.<\/p>\n<h3>Parts required<\/h3>\n<p>For this example, you\u2019ll need:<\/p>\n<ul>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/yl-83-rain-sensor\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x Rain Sensor: FC-37\u00a0or\u00a0YL-83<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/compatible-arduino-uno-r3-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">Arduino UNO<\/a>\u00a0\u2013 read\u00a0<a href=\"https:\/\/makeradvisor.com\/best-arduino-starter-kits\/\" target=\"_blank\" rel=\"noopener noreferrer\">Best Arduino Starter Kits<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x\u00a0Breadboard<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\" target=\"_blank\" rel=\"noopener noreferrer\">2x 220 Ohm Resistors<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/3mm-5mm-leds-kit-storage-box\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x Red LED<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/3mm-5mm-leds-kit-storage-box\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x Green LED<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jumper wires<\/a><\/li>\n<\/ul>\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n<h3>Pin wiring<\/h3>\n<p>Wiring your sensor to the Arduino is pretty straightforward:<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"283\"><strong>Pin\u00a0<\/strong><\/td>\n<td width=\"283\"><strong>Wiring to Arduino<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"283\">A0<\/td>\n<td width=\"283\">Analog pins<\/td>\n<\/tr>\n<tr>\n<td width=\"283\">D0<\/td>\n<td width=\"283\">Digital pins<\/td>\n<\/tr>\n<tr>\n<td width=\"283\">GND<\/td>\n<td width=\"283\">GND<\/td>\n<\/tr>\n<tr>\n<td width=\"283\">VCC<\/td>\n<td width=\"283\">5V<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Schematics<\/h3>\n<p>Follow these schematics to complete the project:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-23507\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=700%2C377&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"rain-sensor_bb\" width=\"700\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=150%2C81&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=300%2C162&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=80%2C43&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=220%2C118&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=186%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 186w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=280%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor_bb.jpg?resize=442%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 442w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<h3>Code<\/h3>\n<p>Upload the following sketch to your Arduino board (feel free to adjust the variable<i>\u00a0<\/i><em>thresholdValue<\/em> <i><\/i>with a different threshold value):<\/p>\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\n \n All the resources for this project:\n http:\/\/randomnerdtutorials.com\/\n \n*\/\n\nint rainPin = A0;\nint greenLED = 6;\nint redLED = 7;\n\/\/ you can adjust the threshold value\nint thresholdValue = 500;\n\nvoid setup(){\n  pinMode(rainPin, INPUT);\n  pinMode(greenLED, OUTPUT);\n  pinMode(redLED, OUTPUT);\n  digitalWrite(greenLED, LOW);\n  digitalWrite(redLED, LOW);\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  \/\/ read the input on analog pin 0:\n  int sensorValue = analogRead(rainPin);\n  Serial.print(sensorValue);\n  if(sensorValue &lt; thresholdValue){\n    Serial.println(&quot; - It's wet&quot;);\n    digitalWrite(greenLED, LOW);\n    digitalWrite(redLED, HIGH);\n  }\n  else {\n    Serial.println(&quot; - It's dry&quot;);\n    digitalWrite(greenLED, HIGH);\n    digitalWrite(redLED, LOW);\n  }\n  delay(500);\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/rain_sensor_arduino.ino\" target=\"_blank\">View raw code<\/a><\/p>\n<p>Open the Arduino IDE serial monitor to see the values. Then you can start adding drops of water to the collector board.<\/p>\n<p>When the value goes below a certain threshold, a red LED will turn on, and when the value goes above a certain threshold, a green LED will turn on.<\/p>\n<h2>Wrapping up<\/h2>\n<p>If you want to know when it&#8217;s raining, \u00a0you need to set up your rain sensor with the Arduino outside.<\/p>\n<p>However, be aware that you should protect your Arduino and your circuit from water. A waterproof project\u00a0box can be pretty handy in this situation (or any plastic\u00a0box). Make sure you protect all your electronic components and only leave the collector board outside.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-23713\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=420%2C278&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"box\" width=\"420\" height=\"278\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?w=581&amp;quality=100&amp;strip=all&amp;ssl=1 581w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=150%2C99&amp;quality=100&amp;strip=all&amp;ssl=1 150w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=300%2C198&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=80%2C53&amp;quality=100&amp;strip=all&amp;ssl=1 80w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=220%2C145&amp;quality=100&amp;strip=all&amp;ssl=1 220w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=151%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 151w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=227%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 227w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/box-1.jpg?resize=360%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 360w\" sizes=\"(max-width: 420px) 100vw, 420px\" \/><\/p>\n<p>I hope you&#8217;ve found this guide useful.\u00a0Have you done any project with this sensor?<\/p>\n<p>Let me know by leaving a comment below.<\/p>\n<p>If you like this post probably you might like my next ones (<a href=\"https:\/\/randomnerdtutorials.com\/download\" target=\"_blank\" rel=\"noopener noreferrer\">click here to subscribe my blog<\/a>). Thanks for reading,<\/p>\n<p>Rui<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The rain sensor is used to detect water and it can detect beyond of what a humidity sensor do. This article explains how to use the FC-37 rain sensor module &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Guide for Rain Sensor FC-37 or YL-83 with Arduino\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/guide-for-rain-sensor-fc-37-or-yl-83-with-arduino\/#more-22600\" aria-label=\"Read more about Guide for Rain Sensor FC-37 or YL-83 with Arduino\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":23481,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[267,302,269,264,215],"tags":[],"class_list":["post-22600","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino-project","category-0-guide","category-guide-project","category-project","category-sensors"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/06\/rain-sensor.jpg?fit=600%2C648&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/22600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=22600"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/22600\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/23481"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=22600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=22600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=22600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}