
Using Microsoft PowerShell and Raspberry Pi to Build a Weather Station with XinaBox
In this project we will demonstrate how to use Microsoft Powershell to build a weather station and display, with XinaBox and a Raspberry Pi.
Contents:
- What you need
- To do
- Video guide
1. What you need
- xChip BR01 - Raspberry Pi Bridge
- xChip OD01 - Display 128x64 (SSD1306)
- xChip SW01- Advanced Weather Sensor (BME280)
- XC10 - xBus Connector
- not included: Raspberry Pi
2. To do
- First complete our RasPi Weather Station project to connect your Raspberry Pi and xChips, and ensure that I2C is setup correctly
- Follow this link to setup PowerShell
- Start Powershell, and install modules:
sudo pwsh
Install-Module -Name Microsoft.PowerShell.IoT
git clone https://github.com/PowerShell/PowerShell-IoT.git
- Collect Weather Data from xChip SW01 - Advanced Weather Sensor (BME280):
Import-Module ./PowerShell-IoT/Examples/Microsoft.PowerShell.IoT.BME280
$SW01 = Get-BME280Device -Id 0x76 # I2C address of the sensor
$wd = Get-BME280Data -Device $SW01
$wd
- Output:
Temperature Pressure Humidity
----------- ----------- -----------
25.35 1017.32 36.74
- Expand the project by adding xChip OD01 - Display 128x64 (SSD1306):
Import-Module ./PowerShell-IoT/Examples/Microsoft.PowerShell.IoT.SSD1306
do {
$wd = Get-BME280Data -Device $SW01
New-OledDisplay | Set-OledText -Value "** Weather Station **=====================Pressure: $($wd.Pressure)hPaTemperature: $($wd.Temperature)*CHumidity: $($wd.Humidity)%RH"
} while (1)
3. Video guide
Please see our Raspberry Pi XK03 kit, and especially the online instructions for other useful links to getting started, sample code and projects.