This PowerShell module is for interacting with BME280 environmental sensor for reading temperature, pressure and humidity.
Several vendors have breakout boards with BME280 sensor. In this example we'll use BME280 breakout board from Adafruit.
BME280 sensor supports both I2C and SPI interfaces; in this example we'll use I2C.
Later, in the software section, we'll need to use I2C address of the BME280 sensor. The default I2C address is 0x77. It can be changed to 0x76 by connecting SDO to GND.
Wiring diagram with Raspberry Pi 3 is like this:
Installation instructions can be found here.
sudo raspi-config
5 Interfacing options
P5 I2C
Would you like ARM I2C interface to be enabled -> Yes
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
PS /home/pi> $device = Get-BME280Device -Id 0x77 # I2C address of the sensor
PS /home/pi> $data = Get-BME280Data -Device $device
PS /home/pi> $data
Temperature Pressure Humidity
----------- -------- --------
26.08 1009.41 29.21
PS /home/pi> "Temperature in Fahrenheit = $($data.Temperature * 1.8 + 32)"
Temperature in Fahrenheit = 76.69