{"id":298,"date":"2017-06-01T18:26:56","date_gmt":"2017-06-01T16:26:56","guid":{"rendered":"https:\/\/arduinoforlammers.wordpress.com\/?p=298"},"modified":"2022-04-29T22:36:28","modified_gmt":"2022-04-29T20:36:28","slug":"arduinoczujnik-gazu-i-dymu-mq-2","status":"publish","type":"post","link":"https:\/\/arduino.net.pl\/index.php\/arduinoczujnik-gazu-i-dymu-mq-2\/","title":{"rendered":"Arduino i MQ-2. Czujnik gaz\u00f3w i dymu"},"content":{"rendered":"\n<p>Czujnik gazu i dymu MQ-2 jest prostym&nbsp;modu\u0142em, kt\u00f3ry mo\u017cna wykorzysta\u0107 przy budowie instalacji ostrzegaj\u0105cej przed ulatniaj\u0105cym&nbsp;si\u0119 gazem albo dymem.<\/p>\n\n\n\n<p>Nota&nbsp;techniczna czujnika MQ-2:<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.dropbox.com\/s\/7kcfp1z5bhq492l\/Czujnik%20dymu%20MQ-2.pdf?dl=0\n<\/div><\/figure>\n\n\n\n<p>Na filmie&nbsp;pokazuj\u0119 zmiany napi\u0119cia wyj\u015bciowego&nbsp;w reakcji czujnika na gaz z zapalniczki.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"MQ-2 + Arduino. Test czujnika.\" width=\"774\" height=\"435\" src=\"https:\/\/www.youtube.com\/embed\/2pF4FNN-8to?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><strong><br>Schemat po\u0142\u0105cze\u0144:<\/strong><\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-embed is-type-photo is-provider-flickr wp-block-embed-flickr\"><div class=\"wp-block-embed__wrapper\">\n<a href=\"https:\/\/flic.kr\/p\/VsXg1n\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/live.staticflickr.com\/4202\/35091919241_18401199c5_z.jpg\" alt=\"MQ-2_connect\" width=\"640\" height=\"406\" \/><\/a>\n<\/div><\/figure>\n\n\n\n<p><strong>Kod:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Digital pin 8 will be called 'pin8'\nint pin8 = 8;\n\/\/ Analog pin 0 will be called 'sensor'\nint sensor = A0;\n\/\/ Set the initial sensorValue to 0\nint sensorValue = 0;\n\n\/\/ The setup routine runs once when you press reset\nvoid setup() {\n  \/\/ Initialize the digital pin 8 as an output\n  pinMode(pin8, OUTPUT);\n  \/\/ Initialize serial communication at 9600 bits per second\n  Serial.begin(9600);\n}\n\n\/\/ The loop routine runs over and over again forever\nvoid loop() {\n  \/\/ Read the input on analog pin 0 (named 'sensor')\n  sensorValue = analogRead(sensor);\n  \/\/ Print out the value you read\n  Serial.println(sensorValue, DEC);\n  \/\/ If sensorValue is greater than 500\n  if (sensorValue &amp;amp;gt; 800) {\n    \/\/ Activate digital output pin 8 - the LED will light up\n    digitalWrite(pin8, HIGH);\n  }\n  else {\n    \/\/ Deactivate digital output pin 8 - the LED will not light up\n    digitalWrite(pin8, LOW);\n  }\n\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Czujnik gazu i dymu MQ-2 jest prostym&nbsp;modu\u0142em, kt\u00f3ry mo\u017cna wykorzysta\u0107 przy budowie instalacji ostrzegaj\u0105cej przed ulatniaj\u0105cym&nbsp;si\u0119 gazem albo dymem. Nota&nbsp;techniczna czujnika MQ-2: Na filmie&nbsp;pokazuj\u0119 zmiany napi\u0119cia wyj\u015bciowego&nbsp;w reakcji czujnika na&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[143],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-arduino","tag-mq-2"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/comments?post=298"}],"version-history":[{"count":3,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/298\/revisions"}],"predecessor-version":[{"id":5182,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/298\/revisions\/5182"}],"wp:attachment":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/media?parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/categories?post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/tags?post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}