Using Microsoft PowerShell and Raspberry Pi to Build a Weather Station with XinaBox

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:

  1. What you need
  2. To do
  3. Video guide

 

1. What you need

 

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
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
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.

    Previous article Tinder Maths with XinaBox and the Raspberry Pi
    Next article Code a Temperature Controlled Desk Fan, with XinaBox and Zerynth