0
0
Raspberry Piprogramming~30 mins

Automated plant watering system in Raspberry Pi - Mini Project: Build & Apply

Choose your learning style9 modes available
Automated Plant Watering System
📖 Scenario: You have a small garden with a few plants. You want to build a simple program to help water your plants automatically when the soil is dry.This program will check soil moisture levels and decide if watering is needed.
🎯 Goal: Build a program that reads soil moisture levels for three plants, checks if the moisture is below a set threshold, and prints which plants need watering.
📋 What You'll Learn
Create a dictionary with plant names and their soil moisture levels.
Set a moisture threshold value to decide when to water.
Use a for loop to check each plant's moisture level against the threshold.
Print the names of plants that need watering.
💡 Why This Matters
🌍 Real World
Automated plant watering helps keep plants healthy by watering them only when needed, saving water and effort.
💼 Career
Understanding how to read sensor data and make decisions is useful in IoT (Internet of Things) and embedded systems jobs.
Progress0 / 4 steps
1
Create the soil moisture data
Create a dictionary called soil_moisture with these exact entries: 'Fern': 30, 'Cactus': 70, 'Bonsai': 45 representing the moisture levels of each plant.
Raspberry Pi
Need a hint?

Use curly braces {} to create a dictionary with keys and values.

2
Set the moisture threshold
Create a variable called threshold and set it to 50. This will be the moisture level below which plants need watering.
Raspberry Pi
Need a hint?

Just assign the number 50 to the variable threshold.

3
Check which plants need watering
Use a for loop with variables plant and moisture to iterate over soil_moisture.items(). Inside the loop, check if moisture is less than threshold and if so, add plant to a list called needs_watering. Create the list before the loop.
Raspberry Pi
Need a hint?

Remember to create the list before the loop. Use append() to add plants to the list.

4
Print the plants that need watering
Write a print statement to display the text "Plants that need watering:" followed by the needs_watering list.
Raspberry Pi
Need a hint?

Use print("Plants that need watering:", needs_watering) to show the result.