How Can We Prevent Fire Incidents? | IoT Cloud Kit for microbit-MakeCode-Tutorial
Lesson 6. How Can We Prevent Fire Incidents?
Objectives
1. Understand the function of flame sensor and water pump
2. Learn the principle of automatic fire extinguishing system
3. Make an automatic fire extinguishing system
4. Make a community fire alarm system
Learning Process
Preparation
Teachers: A computer, good internet, IoT internet kits.
Students: A computer, good internet, IoT internet kits.
Learning contents
Introduction: In 2004, a fire broke out in a wedding hall in Srirangam Town, Tamil Nadu, southern India. As a result, the happy event turned into a tragedy, the fire killed at least 51 people, including the groom, and injuring dozens of others. In the summer of 2007, more than 80 people died in Greece and 670,000 acres (2,711 square kilometers) were destroyed by fire. The same year in California, 500,000 acres (2,027 square kilometers) were destroyed by flames, killing at least 14 people. In April 2019, a fire broke out in the Notre Dame Cathedral, which caused serious damage to this classic and world cultural heritage in the history of architecture. In November 2019, the bushfires in eastern Australia raged and killed 3 billion animals as of July 28, 2020. According to statistics, in 2020, China received a total of 252,000 fires, 1183 deaths, 775 injuries and direct property losses of 4.009 billion yuan. Looking at these shocking data, do you feel the preciousness of life and the importance of fire prevention?
Question: Discuss the ways of preventing fire disasters.
There are many ways to prevent fires, such as detecting the fire early and stifling the open flame in the cradle. Therefore, many cities now have fire-fighting systems installed. When a flame is detected, the water spray device is automatically turned on. In fact, such a fire protection system can be completed with a flame sensor and a water pump. Next, let's get to know the principle of automatic sprinkler system.
The principle of automatic fire extinguishing system
In the early stage of a fire, the flame will gradually increase. When the flame sensor detects a flame, the sprinkler will spray water immediately. The system is simple in structure, easy to use, reliable, easy to construct, easy to manage, fast in fire extinguishing, high in fire control efficiency, relatively economical, and has a wide range of applications. It accounts for more than 75% of the entire sprinkler system. It is suitable for installation in buildings and structures where water can be used to extinguish fires. Its working principle is as follows:
The above are the common sprinkler extinguishing systems in large shopping malls, office buildings, and residential buildings. Today we will also make a small sprinkler system for what we just talked about.
Get to know Flame Sensor
The flame sensor is a sensor specially used by the robot to search for the fire source. Of course, the flame sensor can also be used to detect the brightness of the light, but this sensor is particularly sensitive to flames. The flame sensor, based on the principle that infrared rays are very sensitive to flames, uses a special infrared receiver tube to detect the flame, and then converts the brightness of the flame into high and low-level signals, then input to the central processing unit, and the central processing unit performs the related operations according to the changes in the signal.
The flame sensor in the kit can detect light sources with a wavelength in the range of 760 nanometers to 1100 nanometers, and the detection angle can reach 60 degrees. It can work at -25 to 85 degrees Celsius, with stable and reliable performance. Although this sensor is used to sense flames, it is not fireproof. Therefore, please keep a distance from the flame when using, so as not to burn the sensor.
Question: Other than using a flame sensor, is there other ways to detect flame sources? (Hint: The temperature at the fire site will continue to rise, and the smoke level will increase.)
Get to know Water Pump
A water pump is a machine used to transport liquids or pressurize liquids. The miniature water pump in the kit has a small working voltage, about 3V~5V. The lifting is 0.3~0.8 meters, which meets the production of small scientific and technological projects.
Note: During use, avoid splashing water on the desk.
Project Practice - Fire Extinguishing System
Through the previous study, we know that early detection of fire can reduce a lot of losses. Then we will simulate a fire extinguishing system using a flame sensor and a water pump.
Task 1: Automatic fire extinguishing system
In this project, we will use an automatic fire extinguishing system. The working principle of the project is as follows:
Hardware Preparation
Prepare hardware shown in the following diagram.
Hardware Connection
Insert micro:bit V2 into the micro:IoT Board for Cloud, Connect Flame sensor with P1, and connect the water pump with the Motor. (Red wire to M1A, white to M1B)
Program Design
Function Analysis
The function we need to achieve in this task is to read the value of the flame sensor, and then judge whether to turn on the water pump based on the readings. The read data is displayed in real time on the OLED screen.
Program Flowchart
Example Program
Program Website: https://makecode.microbit.org/_RhVDhW1YKeu9
Operating Effect
Cut a water pipe of about 25cm, and connect one end of the water pipe to the water pump, as shown in Figure 1. Then prepare a paper cup, put 1/3 of the water in the paper cup, put the water pump into the paper cup, and finally put the other end of the water pipe into the paper cup, as shown in Figure 2.
Figure 1
Figure 2
Note: During the operation, do not splash water on the components. If the paper cup is inconvenient to operate, a basin can be used as a water container.
After operating as shown in the figure above, turn on the switch on the expansion board, and then move the flame sensor close to the flame to observe the changes of the OLED screen and the water pump. If the value of the flame is greater than 100, the water pump will start pumping, if the value of the flame is less than 80, the pump will stop pumping, which means that your automatic fire extinguishing system has been completed.
Note: When using the water pump, an external power supply is required from the expansion board, otherwise the water pump cannot be driven.
Conclusion
In this case, we simulated an automatic fire extinguishing system using a flame sensor and a water pump. In this system, we realized the function of automatically sprinkling water to extinguish a fire when a flame is detected.
Task 2: Fire warning and automatic fire extinguishing system
In the previous section, we learned how to make an automatic fire extinguishing system. However, in real life, sometimes we need to know the real-time fire situation of a place. Thus, we need to set up an alarm system to tell us that there may be a fire here. The working principle of the project is as follows:
Create a new automated task
We first use the Webhooks and Notifications in IFTTT to establish a workflow as shown below:
Note: The phone system used here is IOS.
Create Trigger
1. Click "Create" in the upper right corner of the web page to set the trigger, select the service as Webhooks, and set the condition as "Receive a web request".
2. Set the event name for Webhooks as“fire”.
Note: The name of "Event Name" can be set as the actual location. It is set to "fire" here to make it easier to distinguish the course items.
3. Click “Create trigger” to complete the setting. Then we continue to create Action.
Create Action
1. First, we need to clarify what we need to do: When Trigger is triggered, automatically push messages through IFTTT App. So select the service corresponding to Action-Notifications, and set the action condition "Send a notification from the IFTTT app".
2. Set the content information that needs to be sent. First, clear the original template provided by IFTTT. Then add parameter values through Add ingredient-"Event Name, Value1, Value2, Value3".
3. Click Create action to complete the setting. Then we continuously click "Continue" → "Finish" to complete the creation of your Applet. As shown below:
Hardware Preparation and Connection
For specific operations, see Task 1: Automatic fire extinguishing system
Note: This project will use WIFI function, so we need to use the WIFI IoT SD card. The method of use is the same as before.
Program Design
Function Analysis
What we need to achieve in this task is that when the flame sensor detects a flame, turn on the water pump to start sprinkling the fire, and send a "Fire Hazard Area" message reminder to the mobile phone through IFTTT. When the water spray device extinguishes the fire, IFTTT sends a message reminder of "The fire is getting smaller" to the mobile phone.
Program Flowchart
Example Program
Program website: https://makecode.microbit.org/_Lj6dYjJVFez9
Note: The variable flag serves as the interrupt enable flag IF to avoid repeated message sending when the value of flame>120 or the value of flame
Operating Effect
Turn on the power switch, and then put the flame sensor close to the open flame, and observe the changes of the OLED screen and the water pump. When the flame value is greater than 120, the color of the RGB light should change to red, IFTTT sends a "Fire Hazard Area" message to your phone, and the water pump will start pumping; if the value of the flame is less than 80, the color of the RGB light should change to green, IFTTT sends a "The fire is getting smaller" message, and the water pump will stop pumping.
Pump water to extinguish
Message reminder from IFTTT App
Conclusion
We can deploy the fire prevention system in some remote places or warehouses with few people. When a fire occurs, the IFTTT app can prompt us that there is a fire in time. Based on the learning in this lesson, can we design a community fire alarm system? When a fire breaks out in a certain place, notify all residents of the community via text messages so that they can take preventive measures. (For the creation method of the text message service, please refer to the Extension part.)
Discussion
Extension
In the introduction, we learned about the terrible nature of fires and the importance of fire prevention. In the article, we also raised the issue of how to prevent fires. Next, we will learn more about the causes of fires and how to prevent fires.
Causes of fire
Generally, there are three conditions for a fire: 1. Combustible material; 2. Oxygen or oxidant; 3. Fire source.
Whether in a city or forest, fires do not happen for no reason. What causes fires in general? Normally, the common fires in cities are as follows:
1. Electrical equipment led to a fire.
2. Cigarette butts or matchsticks are also the main causes of fires.
3. Ignite combustibles when using candles
4. Improper use of gas and gas appliances may cause a fire.
5. Illegal use of electric or gas welding, sparks falling on combustible materials and causing a fire.
Types of fires commonly found in forests:
1. Natural occurrence: fires caused by lightning strikes, volcanic eruptions and falling meteorites, etc.
2. Man-made: The vast majority of forest fires are caused by accidental use of man-made fires, accounting for more than 95% of the total fire sources. Such as slash-and-burn cultivation, burning charcoal, locomotive leaking fir, exploitation of mountain, grazing, hunting and burning fire control lines, etc.; as well as cooking in the wild, heating, repelling mosquitoes and animals with fire, smoking, children playing with fire, and so on.
Harm of fires
To people, fire is like tigers and beasts, one can't wait to avoid it. Many people's awareness of fire may be limited to personal and property damage, but for humanity and society as a whole, the hazard of fire is not only the loss of life and property.
Let us take a systematic understanding of how much harm fire disasters can cause.
1. Endanger life safety
When a fire burns, it produces high temperature and high heat, causing serious damage to the human body, and even shock and death. According to statistics, the number of deaths caused by the heat of combustion accounted for about 1/4 of the total fire deaths. Secondly, among all fire victims, about 3/4 of them died directly after inhaling toxic and harmful fumes. Finally, after the building burned, it reached or exceeded the fire resistance limit of the load-bearing components, causing the whole or part of the building to collapse, causing casualties.
2. Cause economic loss
Fire will cause permanent damage to some delicate instruments, textiles and other items, and they cannot be used again. Water, dry powder, foam and other extinguishing agents used to put out fires are also a kind of resource loss. After a fire occurs, huge indirect economic losses will be caused due to the need for restoration and reconstruction of the building, personnel resettlement, and the suspension of production and operation.
3. Destroy the achievements of civilization
In the event of a fire in some historically protected buildings and cultural sites, in addition to causing casualties and property losses, a large number of cultural relics, classics, ancient buildings and many other rare treasures face the threat of burning, which will cause irreparable losses to the achievements of human civilization
4. Destroy the ecological environment
The hazards of fire are not only manifested in the destruction of property, causing casualties, but also damage to the ecological environment. The occurrence of forest fires will cause the extinction of a large number of animals and plants, environmental degradation, abnormal climate, drought and less rain, more storms, soil erosion, leading to the destruction of ecological balance, causing famine and disease epidemics, and serious threats to human survival and development.
How to Prevent Fire
The pain caused by the fire is far beyond our imagination. If we want to reduce the fire, we must take defensive measures. The main preventive measures are as follows:
1. Teach children not to play with fire
2. Be sure to unplug all unused electronics
3. When traveling far away, turn off the gas and power main gates
4. Don't throw cigarette butts anywhere, don't play with flames
5. Do not use high-power electrical appliances on the socket
6. Prohibition of burning sundries
7. Clear the safe passage
etc.…
In addition to the above, is there any other way to prevent fires?
Short message service
According to task 2, we learned how to use IFTTT's own notification message to send the fire situation. What should we do if we use SMS notification? Next, please follow the prompts to complete the “Community Fire Alarm System”
Create a new automated task
First, we use the webhooks and Android SMS in IFTTT to establish a workflow as shown in the figure below:
Because the services related to mobile phone text messages in IFTTT are only compatible with the Android system, new automated tasks need to be established on the Android system, and then we will directly create new automated tasks on the mobile APP.
Create Trigger
1. Click "Create" in the upper right corner of the web page to set the trigger, select the service as Webhooks, and set the condition as "Receive a web request".
2. Set the Event Name of Webhooks to "fire".
3. Click Create trigger to complete the setting. Then we continue to create Action.
Create Action
1. We must clarify what we need to do: when Trigger is triggered, automatically send SMS messages. So select the service corresponding to Action-Android SMS, and set the action condition "Send an SMS".
2. Then click "connect" to bind Android SMS, as shown below:
3. After the Android SMS binding is successful, start to set the content of the SMS service, fill in the phone number of the message recipient in the Phone number, delete the content in the Message, and click Add ingredient to re-add 4 Parameter value-"Value1, Value2, Value3, ". After the action content is set, click "Create action" to complete That. As shown below.
Note:
1. The SMS service needs to be established on the sender's account.
2. The system that the sender account logs in must be an Android system (mobile phone).
4. Click Create action to complete the setting. Then we continuously click "Continue" → "Finish" to complete the creation of your Applet. As shown below:
After creating the automated task of the SMS service, complete the program design of the "community fire alarm system" independently based on the knowledge you learned before.
Summary
In this class, we learned about the automatic fire extinguishing system and fire alarm system, which helped us know the disaster situation in time, and make corresponding assistance measures at the same time. In addition, we also learned how to establish a short message service on IFTTT to help us build a "community fire alarm system" faster. Regarding smart cities, we have solved the problem of noise and fire prevention. The next project is to use the Easy IoT platform to help us find available parking lots faster.