Smart Grids & Microgrids
What if your whole city was powered by the sun and wind, like a giant, super-smart toy? That's a Smart Grid! ๐๏ธโก Today, you're going to be the boss of the power company. Let's write the secret rules that tell the electricity where to go, making sure the lights always stay on, even on a cloudy day!
The Grid Gets a Brain
An old power grid is like a single light switch for the whole city. It's either on or off! ๐ง A Smart Grid is way cooler. It's like having thousands of smart sprinklers that know exactly which gardens are thirsty. It uses sunshine โ๏ธ and wind ๐ฌ๏ธ to send power where it's needed, and saves the leftovers in giant batteries for later. The "smart" part comes from two things: sensors giving real-time data, and an AI brain making super-fast decisions.
๐ฎ Your First Command!
It's a bright sunny day and the city needs power! Drag the best power source to the city to keep the lights on!
Okay, you can't *really* drag it, but click the right button to make the right choice!
๐ฐ๏ธ Deep Dive: Your House is Now a Power Plant!
The coolest part of a smart grid is decentralization. Instead of one giant power plant, thousands of homes with solar panels can share energy. Your turn, Grid Boss: What's the biggest advantage of having 1,000 small home batteries instead of one single, giant battery for the whole city?
Reveal a Hint
It's tougher! If the one giant battery fails, the whole city goes dark. But if one home battery goes offline, the other 999 can pick up the slack. This is called resilience! It's a superpower for modern tech.
Be the Grid Boss!
It's a windy night and the city needs power! What do you do? Click the best option.
Code the Microgrid Brain
Your mission is to complete the microgrid's AI brain! The code already handles sunny days. You need to add logic for other conditions and prepare for emergencies.
elif weather == "windy": block. It should return something like "ACTION: USE wind; CHARGE battery;"
elif time_of_day == "night": block. At night, we must use our stored power. The action should be "ACTION: USE battery;".
battery_level < 10)? Return a critical alert like "ACTION: CONSERVE POWER; ALERT: Battery critical!"
๐ป Microgrid Control Function
๐ Bridge to Physical Computing: Real Code
The Python you wrote is a simulation. On a real device like a Raspberry Pi Pico, the code would look like this. Notice how we read from a real sensor instead of just using a variable!
# This is real MicroPython code!
from machine import Pin, ADC
import time
light_sensor = ADC(Pin(26)) # Sensor is on pin 26
led = Pin(15, Pin.OUT) # LED is on pin 15
while True:
light_value = light_sensor.read_u16()
# If light value is low, it's "dark"
if light_value < 10000:
print("It's dark! Turning on light.")
led.on()
else:
print("It's bright! Turning off light.")
led.off()
time.sleep(1)
This code reads a real photoresistor (light sensor) and turns an LED on or off. You just bridged the gap from simulation to the real world!
๐จโ๐ฉโ๐ง Parent Corner & Project Hub
Is your teen ready for the next step? The principles of sensors and logic in this module are the foundation of physical computing. An Arduino or Raspberry Pi Pico starter kit is a fantastic, safe (low-voltage) way to experiment with these concepts in the real world. They can build anything from a smart plant-watering system to custom LED animations, turning abstract code into tangible results.
๐ Your First Physical Project: Get an Arduino starter kit and build a "smart light" sensor. Use a photoresistor to measure "sunlight" and write code to turn an LED (your city's light) on when it gets dark. You've just built the core sensor for a real-world smart grid!
๐ Learn More
- NASA Climate Kids: Power Up! - A great overview of different energy sources.
- TomorrowHub: Logic Puzzles - The 'if/then' logic you used here is the core of all programming. Sharpen your skills!