<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[2D - SDG 15 - Sensors for Forest Fire (Difficulty: 3)]]></title><description><![CDATA[<p dir="auto"> </p>
<h2><a class="anchor-offset" name="key-topics-covered"></a>Key Topics Covered</h2>
<ul>
<li><a href="/topic/62/painting-a-costume">Paint Costumes</a></li>
<li><a href="/topic/86/introduction-to-variables">Using variables</a></li>
<li><a href="/topic/212/set-or-change-size">Set or Change Sprite Size</a></li>
<li><a href="/topic/160/the-switch-costume-to-block">Switch Costumes</a></li>
<li><a href="/topic/296/graphic-effects-blocks">Graphic Effects</a></li>
<li><a href="/topic/489/the-when-touching-object-block">When touching event</a></li>
<li><a href="/topic/145/broadcasting-and-receiving-messages">Sending and receiving messages</a></li>
</ul>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="introduction"></a>Introduction</h2>
<p dir="auto">The <a href="https://sdgs.un.org/goals" target="_blank" rel="noopener noreferrer nofollow ugc">SDGs</a> are 17 goals adopted by the United Nations in 2015. They are a to-do list for everyone to work on together.</p>
<p dir="auto">This tutorial is about detecting wildfires in forests as soon as they occur, which is related to the 15th goal of “<a href="https://sdgs.un.org/goals/goal15" target="_blank" rel="noopener noreferrer nofollow ugc">preserving life on land</a>”.</p>
<p dir="auto">Wildfires in forests bring significant damage to the ecosystem. They not only ruin the natural habitat of many animals and plants, but also generates a huge amount of toxic smoke into the air. If we can detect them and put them off at the early stage, the damage will be much smaller.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2341d6a7-e712-4d11-8c4a-f5a8da35536a.jpg" width="900" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
In this project, you will build a simple demonstration that shows how we can use a network of sensors to help us detect wildfires as soon as possible. Whenever there is a fire, the sensors will detect the change in temperature, and then relay that information to the signal tower. Using such sensors are often better than analyzing satellite images, since satellites can not cover all forests at all times, and they are often blocked by cloud or smoke.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/932e31a7-54c3-4122-b3bb-94d6aa791241.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-1-remix-a-template-project"></a>Step 1 - Remix a Template Project</h2>
<p dir="auto">First, please click this link to open the project template:</p>
<p dir="auto"><a href="https://play.creaticode.com/projects/f90eb44373a71b07a7815efa" target="_blank">https://play.creaticode.com/projects/f90eb44373a71b07a7815efa</a><br /> <br />
<iframe src="https://play.creaticode.com/projects/f90eb44373a71b07a7815efa/embed" width="485" height="402" allowfullscreen></iframe></p>
<p dir="auto">Click the “remix” button to make a remix project of your own. Note that you need to be signed in to do this.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b3ba4fef-184d-45ad-9789-2d1771d9487d.png" width="600" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto">This project uses a forest picture from Google Maps, and it contains 3 sprites:</p>
<ul>
<li>The “Fire” sprite contains some costumes for a fire;</li>
<li>The “Sensor1” sprite is a green circle with a number 1, and it represents the location of sensor 1;</li>
<li>The “Signal Tower” sprite contains some costumes for a signal tower. A signal tower can send alert messages through the satellite to firefighters.</li>
</ul>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a2f37999-93c1-448c-8eec-f49d34b3444a.png" width="480" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-2-the-fire-animation"></a>Step 2 - The Fire Animation</h2>
<p dir="auto">First, let’s go to the “Fire” sprite, and make it display a burning fire when the program starts. It can simply show all the costumes one by one in a forever loop:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/e31197fb-5b8c-4c8e-a556-d0ea06014832.png" width="200" /></p>
<p dir="auto">Now we get a nice fire animation:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/72694e44-ea49-4d5e-95bb-3b9d99ddac53.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-3-grow-the-fire"></a>Step 3 - Grow the Fire</h2>
<p dir="auto">Next, let’s make the fire grow from a tidy dot to a large wildfire. We will set the Fire sprite’s size to 1, and <a href="/topic/212/set-or-change-size">make its size grow up</a> by 5 every second for 40 seconds:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d1521c4b-106f-4852-bade-6a84c2c6b7df.png" width="500" /></p>
<p dir="auto"> <br />
Now the fire will grow bigger and bigger:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/9135a5df-34ad-4023-9a73-80f7f3a049c8.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-4-show-alert-colors-when-touching-the-fire"></a>Step 4 - Show Alert Colors When Touching the Fire</h2>
<p dir="auto">Now we start to work on the “Sensor1” sprite. We will first complete its code, then make many copies of it.</p>
<p dir="auto">When the sensor sprite is <a href="/topic/489/the-when-touching-object-block">touching the Fire sprite</a>, we will <a href="/topic/296/graphic-effects-blocks">change its color</a> to indicate this sensor has detected the fire. We will use alternating color effects on the Sensor1 sprite:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a0afd772-84d9-4e23-9a6d-67323ac48eb5.png" width="300" /></p>
<p dir="auto">The 2 color effects will make the Sensor1 sprite look red and orange. Now let’s test it by putting the sensor next to the fire. When the fire grows large enough, it will start to touch the sensor.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/df56d6c0-1525-493e-8970-645b5c18db68.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-5-send-fire-alert-to-neighbor-sensors"></a>Step 5 - Send Fire Alert to Neighbor Sensors</h2>
<p dir="auto">When any sensor in the forest detects a fire nearby, it needs to let the firefighters know. These sensors do not have a direct way to communicate with firefighters. Instead, they can only send messages to their nearest neighbors, and these neighbors can relay these messages to other neighbors. After a few stops, the messages will be sent out by the signal tower.</p>
<p dir="auto">Now let’s <a href="/topic/145/broadcasting-and-receiving-messages">send a message</a> “fire” from “Sensor1” to 3 neighbor sprites when the sensor detects a fire. We will use the “send message with parameter to sprite” block. It allows us to send the message to only one other sprite, and we can attach a parameter to this message. Note that for now we only have one sensor sprite, so <span style="color:#ff0000"><strong>the last input of the receiver sprite will need to be changed later</strong></span>.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/e3f8989a-a5ce-4ccf-9672-192ce100cfff.png" width="450" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-6-receive-fire-alert-from-neighbor-sensors"></a>Step 6 - Receive Fire Alert from Neighbor Sensors</h2>
<p dir="auto">When any sensor receives the “fire” message, it needs to <strong>go through the same steps as when it touches the fire</strong>, so we can simply duplicate the existing blocks.</p>
<p dir="auto">We will need a new variable “number” to store the parameter of that message, which is the number of the sensor that has detected the fire.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/35564b06-40f5-4f1e-a862-040d6c7c54d0.png" width="900" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-7-merge-duplicate-blocks"></a>Step 7 - Merge Duplicate Blocks</h2>
<p dir="auto">Since all the blocks are duplicated, we can make a new block for these blocks. The new block will be called “handle fire”, and it takes one input as the number of the sensor that has detected the fire.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0dc75cb8-5274-4bf1-a01c-efa8e8f9a090.png" width="1000" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-8-sensors-2-3-4"></a>Step 8 - Sensors 2/3/4</h2>
<p dir="auto">Now we are ready to make some copies of Sensor1. Please use the right-click menu to duplicate it into “Sensor2”, “Sensor3” and “Sensor4”.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3ec66f6c-4559-4665-9ac8-fec31aeb021b.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto">Next, change their costumes to show “2”, “3” and “4” by double-clicking the text:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0d9d348a-314b-479a-aa85-14cc02abb30a.gif" width="700" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto">Lastly, move them to 3 different directions surrounding Sensor1.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/fe28f806-7b38-4c52-b4a4-0d18d22f93dc.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-9-send-message-from-sensor1-to-sensor-2-3-4"></a>Step 9 - Send Message from Sensor1 to Sensor 2/3/4</h2>
<p dir="auto">Now we are ready to update the message receiver in Sensor1. We can change the receiving sprites to the 3 new sensor sprites.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/60f6df08-4d8a-497e-9036-02379fcd8c9e.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto">For a test, now if we put the fire close to Sensor1, it will send this alert to the 3 new sensors:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5889c2d4-7195-4636-8fb9-16c58cdf446c.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-10-more-sensor-copies"></a>Step 10 - More Sensor Copies</h2>
<p dir="auto">Next, to cover the entire map, we need to make more copies of the sensor. Here is an example of 12 sensors:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/e8b7aba5-f96d-4a67-a0c8-6ce246fa7367.png" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-11-update-message-receivers"></a>Step 11 - Update Message Receivers</h2>
<p dir="auto">Sensor1 is sending the “fire” alert to Sensor 2/3/4, but the other sensors are not sending the message correctly yet. Please <strong>go through each sensor sprite, and update the receiver sprite to the 3 sensors that are closest to it</strong>.</p>
<p dir="auto">For example, Sensor2 can send to Sensor 1/6/8, and Sensor9 can send to Sensor 8/3/12.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b07dc6f5-4b14-4bbe-945e-17ba7ec88368.png" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-12-sending-to-the-signal-tower"></a>Step 12 - Sending to the Signal Tower</h2>
<p dir="auto">Sensors that are close to the signal tower should relay the message to the signal tower, so that the signal tower can send this message to the firefighters.</p>
<p dir="auto">In our example, Sensors 4/7/12 should send the alert message to the signal tower:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/65bd139c-0208-487c-8999-7d67c1abf463.png" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto">Here is the code change for Sensor4:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a9759ec1-e2ea-49cd-8eb4-4fa72b191498.png" width="500" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-13-signal-tower-sends-out-the-alert"></a>Step 13 - Signal Tower Sends Out the Alert</h2>
<p dir="auto">When the signal tower receives the “fire” alert, it should send it out through the satellite. To show that, we can make it animate through the 3 costumes. We will also need to reset its costume to “0” when the project starts.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/78f102dc-1679-4e65-a6ad-6440a2ce0c01.png" width="400" /></p>
<p dir="auto">To test the project, you can make the Fire sprite smaller, and then place it anywhere on the map close to a sensor.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0df63178-8253-4d86-87d8-5d0bd639f3d0.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-14-add-a-lag"></a>Step 14 - Add a Lag</h2>
<p dir="auto">Currently when the first sensor detects a fire, the alert message travels immediately to all other sensors and the signal tower. To illustrate how the alert message travels to the signal tower, we can add a 1-second delay in each of the 12 sensor sprites like this:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/6cdd00b0-e7de-4e25-976b-b221e2bbd0ea.png" width="300" /></p>
<p dir="auto">Now if you test again, you can clearly see how the alert message propagates across the sensor network.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/932e31a7-54c3-4122-b3bb-94d6aa791241.gif" width="500" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="next-steps"></a>Next Steps</h2>
<p dir="auto">There are many ways you can extend this project. Here are some examples:</p>
<ul>
<li>
<p dir="auto"><strong>Random Fire</strong>: You can make the “Fire” sprite go to a random starting point, and test whether the signal tower would always send out the alert.</p>
</li>
<li>
<p dir="auto"><strong>Redundancy Test</strong>: You can try to disable some sensors (detach their code blocks), and see if the sensor network can still handle fires successfully. Which sensors are the most critical?</p>
</li>
<li>
<p dir="auto"><strong>Using clones</strong>: Since most of the code blocks are the same among the 12 sensor sprites, you can try to simplify the program to use only 1 sensor sprite, but clone it 12 times. You can use a list or table to store the receiving sensor IDs for each sensor.</p>
</li>
</ul>
]]></description><link>https://forum.creaticode.com/topic/524/2d-sdg-15-sensors-for-forest-fire-difficulty-3</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 15:31:57 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/524.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Aug 2022 00:38:55 GMT</pubDate><ttl>60</ttl></channel></rss>