Home AI for Earth's Future
🌍 Module 04 · Advanced

AI for Earth's Future

What if you could be a high-tech detective for the entire planet? 🕵️‍♀️ Not just for weather, but for protecting animals, oceans, and forests! AI is a powerful tool that helps us understand and protect our world. You'll even train your own AI with your webcam to sort recycling—no code needed! Let's get started. 🚀

🛡️ Safety Check: Handling Eco-Anxiety

Learning about environmental challenges can sometimes feel big and scary. That's a normal feeling called 'eco-anxiety'. But remember: every scientist, engineer, and builder you see here started just like you—curious and wanting to help. Focus on the one small, cool thing you can learn or build today. That's how we build a better tomorrow, one step at a time.

🐋

AI: A Guardian for Wildlife

See how AI is helping scientists listen to and protect whales! (Video: TED)

From tracking whale songs across the ocean to spotting poachers😠 Rule Breakers!
These are people who illegally hunt or capture protected animals. AI helps rangers spot them from drones or satellites.
from space, AI is giving conservationists👩‍🔬 Nature Heroes!
Awesome people who work to protect animals, plants, and their homes.
superpowers! It can analyze gazillionsWhoa, That's a Lot of Data! 🐘
Scientists use a word called a 'petabyte'. It's so much information that if it were a movie, it would take you over 200 years to watch! That's why we need super-fast computers to help.
of data points—like photos, sounds, and satellite images—to help protect endangered species🐅 Needs Our Help!
An animal or plant species that is at serious risk of disappearing forever.
and their habitats.

✍️ Your Turn: Be an AI Designer

You're designing an AI to protect Snow Leopards. Let's write its job description by filling in the blanks!

My Snow Leopard AI needs to learn how to tell the difference between a [adjective] leopard and a [adjective] rock. Its main job will be to [verb] all the photos and alert me when it finds a [noun].

🧠 Data Detective Challenge: Spot the Trend

An AI model's first job is to find patterns. Look at this simple climate data. First, click on the bars in the chart to see what I mean. Then look at the numbers below. Can you spot the pattern a computer would see?

2020
2021
2022
2023
    Year: 2020, Extra Warmth: +0.98°C
    Year: 2021, Extra Warmth: +1.05°C
    Year: 2022, Extra Warmth: +1.12°C
    Year: 2023, Extra Warmth: +1.19°C
          

Question: Based on the trend, what is the most likely temperature anomaly for 2024?

A) +1.15°C (Cooler)
B) +1.26°C (Warmer)
C) +1.50°C (Much Warmer)

🚀 Challenge Question:

If this trend of +0.07°C per year continues, in approximately what year would the anomaly first pass +1.50°C?

A) 2026
B) 2028
C) 2030

🚀 Code Challenge: For Ages 12+ (Click to dive deeper!)

Thinking Like a Computer: A Robot's Story

You just spotted the trend like a real data detective! Awesome. But what if you had 1,000 years of data? You can't eyeball that! We need to teach the computer how to think step-by-step. Here's the story of how a computer finds the warmest year:

🤖
Frame 1: First Look. The computer looks at the first number in the list: +0.85°C. It thinks, "Okay, this is the hottest I've seen so far," and jots it down on a notepad.
🤔
Frame 2: The Comparison. Next, it looks at the second number: +0.98°C. It asks, "Is this new number bigger than what's on my notepad?" Yes, it is! So it erases +0.85°C and writes +0.98°C.
🏆
Frame 3: The Winner! The computer repeats this "compare and update" process for every single year in the list. The very last number left on its notepad is the winner—the highest temperature!

🤖 Teaching the Computer to Think

This step-by-step process is called an algorithm. In Python, we can write this algorithm in a few different ways.

Code Breakdown: The Long Way (with a Loop)

The most straightforward way is to build the logic we just described using a `for` loop. This is how you might explain it to a friend. It's the robot's story, but written in code!

# 1. Create a variable to hold the "hottest so far" (our notepad)
hottest_so_far = None

# 2. Loop through every 'item' in our data list
for item in climate_data:
    # 3. If it's the very first item, or if its temp is hotter than our record...
    if hottest_so_far is None or item['temp_anomaly'] > hottest_so_far['temp_anomaly']:
        # 4. ...then update our record!
        hottest_so_far = item

print(hottest_so_far)
              

⚡ The Pro Shortcut: `max()` with a `lambda`

Loops work great! But pros often use shortcuts. Python has a built-in `max()` function that does all that looping work for you. We just need to give it one special instruction:

hottest_year_data = max(climate_data, key=lambda item: item['temp_anomaly'])

Think of key=lambda item: item['temp_anomaly'] as a tiny, one-time instruction you give to `max()`. It says: "Hey `max()`! As you look through the `climate_data` list, don't compare the whole file folder. **Just look at the `'temp_anomaly'` number inside each one.** Use that number to decide which is biggest."

Python Sandbox: Your Climate Report Mission

Your mission is to generate a climate report in three parts. Complete each mission to build the full script!

Mission 1: Find the Hottest Year 🔥

Awaiting your code...

Mission 2: Calculate the Average 📊

Awaiting your code...

Mission 3: Find Years Above Average 📈

Awaiting your code...

🏆 Bonus Mission Unlocked! Find the Connection

Awesome work! Now for the real science. Let's look at new data. Your mission: find out if the year with the highest CO2 level is *also* the year with the highest sea level rise. Are they connected?

Analysis awaiting your command...

🤔 Think Like a Scientist: Correlation vs. Causation

You probably found that the years match! This is a correlation—two things that change in a similar pattern. But be careful—that doesn't always mean one thing causes the other! Always ask "why?".

Brain Teaser: What's the connection?

In the summer, ice cream sales go up. At the same time, shark attacks also go up. Are these two things connected?

A) Yes! Eating ice cream causes shark attacks.
B) They are correlated (happen together), but one doesn't cause the other.
C) No, it's just a coincidence.

How is finding the hottest year like spotting a plastic bottle? It's all about patterns! In the data, you looked for a pattern of rising numbers. With images, the AI looks for patterns of pixels—the crinkle of paper, the shine of plastic. You're about to become an AI pattern trainer.

Hands-On Project: Build a Smart Recycling Sorter

Enough code for now—let's build a real AI! We're going to use a super cool tool called Teachable Machine from Google. It lets you train an AI model right in your browser, no code required. Your mission: teach it to tell the difference between paper, plastic, and maybe an aluminum can.

See how Teachable Machine works in just 2 minutes! (Video: Google AI)

1
Gather Your Materials: Find a few recyclable items around your house. Grab a piece of paper (a receipt or junk mail), a plastic bottle, and an aluminum can if you have one.
2
Open the Tool: With a parent's permission, click this link to open Google's Teachable Machine. Click "Get Started" and choose "Image Project."
3
Train Your AI: You'll see different "Classes." Rename Class 1 to "Paper." Hold up your piece of paper to the webcam and click and hold "Hold to Record" to take lots of pictures. Do the same for "Plastic" in the next class. The more pictures, the smarter your AI will be!
4
Test It!: Click the "Train Model" button (this might take a minute). Once it's done, hold up your items to the webcam again. Does the AI correctly guess what each item is? Try crumpling the paper—does it still know?
💡
Pro Tip: Add a "Nothing" Class. Real AIs need to know what to ignore! Add a new class and call it "Nothing." Then, hold down the record button while pointing your webcam at your empty desk, the wall, or your chair. This teaches the AI what to do when it doesn't see a recyclable item, making it much smarter and less likely to guess randomly.
5
Export Your Model: After you train your AI, click the "Export Model" button. You'll see an upload option that gives you a shareable link. This link contains your trained AI!

🚀 Team Up Challenge: Use Your Model on a Real Webpage

Ask a parent or older sibling for help with this mission! That shareable link isn't just for looking at—it's how you put your AI to work! We've set up a starter project for you. It's a real, working webpage that's just missing one thing: the link to *your* AI model.

Click the link below to open the project on Glitch. Find the line that says // PASTE YOUR MODEL URL HERE and replace it with your own link. That's it! You've just become an AI developer.

Take Me to the Code ↗

🔍 PEEK UNDER THE HOOD

In Glitch, open the sketch.js file. This is where the magic happens!

  • classifier.classify(video, gotResult); is the line that asks your AI model to make a guess based on the webcam video.
  • The gotResult function is what runs after the AI makes its guess. Look inside it to see how it displays the label on the screen.
  • Challenge: Can you find the `gotResult` function and add a line of code so that when the AI is 90% sure it sees 'Plastic', the webpage's background turns blue? (Hint: `document.body.style.backgroundColor = 'blue';` and you'll need to check `results[0].confidence`).

🛡️ Safety Check: What if the AI gets it wrong?

1. AI Bias: What happens if your AI only ever sees clean, perfect plastic bottles? Will it recognize a crumpled, dirty one? This is called "bias"—when an AI is only trained on one type of data, it gets confused by new things. This often leads to a problem called overfittingMemorized the Test!
Overfitting is when an AI learns its training data *too* perfectly. It gets an A+ on things it's seen, but fails when it sees a new problem (like a crumpled bottle!). Training on more varied, 'messy' data helps prevent it.
, where the AI is great at recognizing its training examples but terrible at anything new.

Your Turn: Test for Bias! Go back to your Teachable Machine project. You trained it on a clean plastic bottle. What happens when you show it a crumpled, dirty one? Or a green bottle instead of a clear one? If it fails, you've found bias! Add more varied examples to your training data to make your AI smarter.

2. Your Face is Data: When you use your webcam, you're creating data. Only use tools like Teachable Machine that don't save your personal data, and always ask a parent before turning on your camera for any website or app.

👨‍👩‍👧 Parent Corner: Dinner Table Conversation Starters

The Teachable Machine project is a fantastic opportunity to talk about how AI works in the real world. This shifts the conversation from "magic" to a powerful tool people design and manage. Try these questions tonight:

  • Besides sorting recycling, what are three other ways you think AI could help our planet?
  • What's one way an AI trying to help the planet could be accidentally harmful? (For example, an AI that protects forests might not recognize the rights of people who live there).
  • If a self-driving trash-collecting robot makes a mistake, who is responsible? The person who owns it, the company that made it, or the programmer who wrote the code?

📚 Go Deeper

  • NASA's Global Temperature Data - See the real, live data that scientists use every day.
  • Kaggle Climate Datasets - Ready for a bigger mission? Challenge: Download a real dataset and use a tool like Google Sheets or Python to find the average temperature for *your city*. (Requires parental supervision to create an account).
  • Explore a Real-Time Data API - Want to see how apps get live data? An APIApplication Programming Interface
    Think of it like a drive-thru window for data. A program makes a structured request (an order) and the server sends back just the data it needs (your food). It's how apps get weather, stocks, and more.
    is how programs 'talk' to each other. This one has live air quality data from around the world!

This is what raw data from an API often looks like! It's a `JSON` object, which is very similar to the Python dictionaries you just used. A real program would just pull out the `value` for `pm25` to show the air quality.

{
  "location": "Los Angeles",
  "parameter": "pm25",
  "value": 12.5,
  "unit": "µg/m³",
  "lastUpdated": "2026-07-20T10:00:00Z"
}