This PowerShell module is for automating taking care of potted indoor plants.
This module allows a PowerShell script to control lights and water a plant when needed based on soil moisture level.
This showcases GPIO functionality of the Microsoft.PowerShell.IoT module.
Hardware pieces:
- For lights:
- For watering:
Default pin configuration of Microsoft.PowerShell.IoT.Plant module:
- Water pump relay connected to GPIO pin 0.
- Light relay connected to GPIO pin 2.
- Soil moisture sensor sends data to GPIO pin 5.
Wiring diagram will be published shortly.
Installation instructions can be found here.
sudo pwsh
Install-Module -Name Microsoft.PowerShell.IoT
git clone https://github.com/PowerShell/PowerShell-IoT.git
Import-Module ./PowerShell-IoT/Examples/Microsoft.PowerShell.IoT.Plant
PS /home/pi> # working with light
PS /home/pi> Set-Light On
PS /home/pi> Set-Light Off
PS /home/pi>
PS /home/pi> # working with water
PS /home/pi> Start-Water
PS /home/pi> Stop-Water
PS /home/pi>
PS /home/pi> # reading soil moisture level
PS /home/pi> Read-SoilIsDry
See full-plant-demo.ps1
.
This script runs 2 PS jobs - one controls light, the other - water.
For demo purposes script runs for 2 minutes. Adjust timeouts in the script for your scenario.