From 3558dca44ece32c7a93c10e6c0441803c1ed468a Mon Sep 17 00:00:00 2001 From: Andrew Menagarishvili Date: Fri, 13 Apr 2018 15:38:19 -0700 Subject: [PATCH 1/2] Basic Plant example doc --- .../Microsoft.PowerShell.IoT.Plant/README.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Examples/Microsoft.PowerShell.IoT.Plant/README.md diff --git a/Examples/Microsoft.PowerShell.IoT.Plant/README.md b/Examples/Microsoft.PowerShell.IoT.Plant/README.md new file mode 100644 index 0000000..9dc44f4 --- /dev/null +++ b/Examples/Microsoft.PowerShell.IoT.Plant/README.md @@ -0,0 +1,65 @@ +# Example module Microsoft.PowerShell.IoT.Plant + +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 Microsoft.PowerShell.IoT module. + +## Hardware setup + +Hardware pieces: + +* For lights: + * Desktop lamp + * [Plant-specific light bulb](https://www.amazon.com/dp/B07567BPVH/ref=sspa_dk_detail_5?psc=1&pd_rd_i=B07567BPVH&pd_rd_wg=5iTv6&pd_rd_r=WYCAF6212XNJ9NQ14E5Q&pd_rd_w=2u0Gj) + * [Power relay for power mains (for the lamp)](https://www.amazon.com/POWERSWITCHTAIL-COM-PowerSwitch-Tail-II/dp/B00B888VHM/ref=sr_1_1?ie=UTF8&qid=1518818881&sr=8-1) +* For watering: + * [Small water pump](https://www.adafruit.com/product/1150) + * [Power Relay for 12V DC](https://www.ebay.com/itm/5V-2-Channel-Relay-Module-Shield-For-Arduino-PIC-ARM-DSP-AVR-Electronic-US/162876526032) + * [12V DC PowerAdapter (for water pump)](https://www.adafruit.com/product/798) + * [Soil moisture sensor](https://www.ebay.com/i/122408308563?chn=ps) + +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. + +## Software setup + +### Install PowerShell Core on Raspberry Pi + +Installation instructions can be found [here](https://github.com/PowerShell/PowerShell/tree/master/docs/installation/linux.md#raspbian). + +### Start Powershell and install modules + +```powershell +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 +``` + +### Manual operation + +```powershell +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 +``` + +### Automated operation + +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. \ No newline at end of file From 532d640409bc68cd7f8a7c3b507192a6b3bd164c Mon Sep 17 00:00:00 2001 From: Andrew Menagarishvili Date: Fri, 13 Apr 2018 15:58:38 -0700 Subject: [PATCH 2/2] Updated Plant example doc --- Examples/Microsoft.PowerShell.IoT.Plant/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Examples/Microsoft.PowerShell.IoT.Plant/README.md b/Examples/Microsoft.PowerShell.IoT.Plant/README.md index 9dc44f4..1217684 100644 --- a/Examples/Microsoft.PowerShell.IoT.Plant/README.md +++ b/Examples/Microsoft.PowerShell.IoT.Plant/README.md @@ -1,8 +1,10 @@ # Example module Microsoft.PowerShell.IoT.Plant 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 Microsoft.PowerShell.IoT module. + +This showcases GPIO functionality of [the Microsoft.PowerShell.IoT module](../../README.md). ## Hardware setup