Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Commit 3558dca

Browse files
author
Andrew Menagarishvili
committed
Basic Plant example doc
1 parent bb9d8dc commit 3558dca

File tree

1 file changed

+65
-0
lines changed
  • Examples/Microsoft.PowerShell.IoT.Plant

1 file changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Example module Microsoft.PowerShell.IoT.Plant
2+
3+
This PowerShell module is for automating taking care of potted indoor plants.
4+
This module allows a PowerShell script to control lights and water a plant when needed based on soil moisture level.
5+
This showcases GPIO functionality of Microsoft.PowerShell.IoT module.
6+
7+
## Hardware setup
8+
9+
Hardware pieces:
10+
11+
* For lights:
12+
* Desktop lamp
13+
* [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)
14+
* [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)
15+
* For watering:
16+
* [Small water pump](https://www.adafruit.com/product/1150)
17+
* [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)
18+
* [12V DC PowerAdapter (for water pump)](https://www.adafruit.com/product/798)
19+
* [Soil moisture sensor](https://www.ebay.com/i/122408308563?chn=ps)
20+
21+
Default pin configuration of Microsoft.PowerShell.IoT.Plant module:
22+
23+
* Water pump relay connected to GPIO pin 0.
24+
* Light relay connected to GPIO pin 2.
25+
* Soil moisture sensor sends data to GPIO pin 5.
26+
27+
Wiring diagram will be published shortly.
28+
29+
## Software setup
30+
31+
### Install PowerShell Core on Raspberry Pi
32+
33+
Installation instructions can be found [here](https://github.com/PowerShell/PowerShell/tree/master/docs/installation/linux.md#raspbian).
34+
35+
### Start Powershell and install modules
36+
37+
```powershell
38+
sudo pwsh
39+
Install-Module -Name Microsoft.PowerShell.IoT
40+
git clone https://github.com/PowerShell/PowerShell-IoT.git
41+
Import-Module ./PowerShell-IoT/Examples/Microsoft.PowerShell.IoT.Plant
42+
```
43+
44+
### Manual operation
45+
46+
```powershell
47+
PS /home/pi> # working with light
48+
PS /home/pi> Set-Light On
49+
PS /home/pi> Set-Light Off
50+
PS /home/pi>
51+
PS /home/pi> # working with water
52+
PS /home/pi> Start-Water
53+
PS /home/pi> Stop-Water
54+
PS /home/pi>
55+
PS /home/pi> # reading soil moisture level
56+
PS /home/pi> Read-SoilIsDry
57+
```
58+
59+
### Automated operation
60+
61+
See `full-plant-demo.ps1`.
62+
63+
This script runs 2 PS jobs - one controls light, the other - water.
64+
65+
For demo purposes script runs for 2 minutes. Adjust timeouts in the script for your scenario.

0 commit comments

Comments
 (0)