Chapter 7: Oxygen Sales Are Booming

Day 21: (Don’t) Waste Water

Day 21: (Don’t) Waste Water

Maintaining healthy plants is crucial for the oxygen factories aboard the Nebula Raider. To ensure that plants receive the optimal amount of water, you are tasked with building an automated watering system. This system will monitor water levels and automatically water the plants when needed, ensuring their health and continuous oxygen production.


Components Needed:


  • Raspberry Pi Pico WH Microcontroller
  • Water Level Sensor
  • SRD-05VDC-SL-C Power Relay
  • Water pump (or a small motor to simulate a pump)
  • LEDs (Green for sufficient water level, Red for low water level)
  • Resistors
  • Breadboard
  • Jumper wires


Instructions:


Set Up the Circuit:


  1. 1- Connect the Water Level Sensor to an analog input pin on the Raspberry Pi Pico (e.g., GP26).
  2. 2- Connect the relay module to a GPIO pin on the Raspberry Pi Pico (e.g., GP2) to control the water pump.
  3. 3- Connect the water pump to the relay module, ensuring the relay can safely handle the voltage and current           required by the pump.
  4. 4- Connect the Green LED to a GPIO pin on the Raspberry Pi Pico (e.g., GP3) with an appropriate resistor.
  5. 5- Connect the Red LED to a GPIO pin on the Raspberry Pi Pico (e.g., GP4) with an appropriate resistor.
  6. 6- Use jumper wires to make all necessary connections on the breadboard, ensuring a secure and organized           setup.


Write the Code:


Open your coding environment and write the following Python code to create the automated watering system:


Test the System:


  1. 1- Upload the code to the Raspberry Pi Pico and run it.
  2. 2- Test the water level sensor by inserting it into different water levels (low, medium, high) and         observing the readings.
  3. 3- Ensure the relay correctly turns the water pump on and off based on the water levels.
  4. 4- Verify that the LEDs provide accurate feedback on the water level conditions.


Learning Outcomes:


  • - Sensor Integration: Learn how to connect and use a water level sensor with the Raspberry Pi          Pico to monitor water conditions.
  • - Automated Control: Understand how to automate the control of a water pump using a relay and      water level sensor.
  • - Microcontroller Programming: Develop skills in writing code to integrate sensors and control        output devices.


Extension Ideas:


  • - Adjustable Threshold: Add buttons to allow the user to adjust the water level threshold for             watering.
  • - Data Logging: Implement data logging to record water levels and watering activity over time.
  • - Remote Monitoring: Create a web interface to remotely monitor water levels and control the         watering system.


By completing this project, you will have built an automated watering system that ensures plants receive the optimal amount of water for healthy growth. This system will help maintain the oxygen factories inside the Nebula Raider, contributing to the crew’s well-being.