Else, the red LED goes low and green remains high and the buzzer produces no tune. In the void loop, it has described the conditions, that if the value of the sensor is greater than the threshold value, the red LED goes high and green LED goes low.In the void setup, it has defined the Pin modes for input and output pins of an Arduino.The code first defines which pins of Arduino are connected with which component.And, when the smoke reaches a certain threshold value, it will turn ON the red LED and the buzzer. There is a comparator in the module sensor, it compares the value to the threshold value described in the code. Now, bring the smoke or gas in front of the sensor. Adjust the threshold using the potentiometer screw in the module. Upload the code in your Arduino that is mentioned above. The sensor is compact and simple to access.Ĭonnect the MQ-2 Gas/Smoke Sensor with Arduino in the same way as described above. The sensor works on a very low voltage of around 5Volts. That’s how the gas or smoke gets detected. When it detects smoke or fire, the value of its resistance changes. Its working principle is based on the resistor. Hence, also recognized as a chemiresistor. The MQ-2 smoke sensor is the metal oxide semiconductor sensor. Thus, this tutorial is about interfacing ” MQ-2 Gas/Smoke Sensor with Arduino UNO”. Therefore, it should be installed in every place. The main purpose of this device is to warn the people of the surroundings if a fire occurs. Industries bought this sensor so that it sends the signal if the explosion happens. In the homes and restaurants, they are used in the kitchens to give the signal if a flame gets burst. Whether it’s the industrial sector or a commercial sector, this sensor is utilized everywhere. This sensor is essentially a fire protection device. ![]() Posted on Utopian.Smoke sensors are found pretty much at every place. Thank You! Hope you learned something for this tutorial God Bless Everyone! Here is a sample output of the serial monitor. There you can see the output of your project. So when you try to test your code and your MQ-2 sensor together with your Arduino Nano, Just click on the Serial Monitor button. Once done uploading, It will say that you are finish uploading it. And if you are finish programming your Arduino IDE, just click the Upload button and wait for it to finish uploading. This code is for producing the output that It does not detect any fire or any gas else This code is for producing the output that it is detecting any fire or gas and settings its sensitivity to 50 void loop() This code is for setting your MQ-2 to an analog output
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |