Waveshare Pico Environment Sensor

The Waveshare Pico Environment Sensor [1] shield is a pico sized multi sensor module designed for the Raspberry Pi Pico and gives the ability to collect environmental data like temperature & humidity, air pressure, ambient light intensity, VOC, UV rays, etc. It can also be used to build a robot that can detect motion and orientation. It communicates with the Raspberry Pi Pico over I2C.

Board Overview

Hardware

Features and Resources

Printed Circuit Board

5V/~8.5㎃ 3.3V/~10㎃ 1.8V/~5㎃

THP : T H P VOC ALS UVS 9-DOF

1 1

  • THP: temperature, humidity and air pressure

  • VOC: air quality, Volatile Organic Compounds

  • ALS: ambient IR and visible light

  • UVS: ambient ultraviolet (UV) light

  • 9-DOF: motion and acceleration

  • 1 I2C bus interface for sensors

  • 1 GPIO to voltage regulator for optional VEN signal

Design Data

Waveshare Pico Environment Sensor

Positions

Waveshare Pico Environment Sensor details
  1. TSL25911
    digital ambient light sensor, measuring IR and visible light
  2. LTR-390UV-01
    ambient ultraviolet (UV) sensor
  3. SGP40
    air quality, Volatile Organic Compounds (VOC) sensor
  4. ICM-20948 (MPU-9250)
    3-axis accelerometer, 3-axis gyroscope and 3-axis magnetometer
  1. BME280
    temperature, humidity and air pressure (THP) sensor
  2. RT9193-33 / RT9193-18
    300㎃ low dropout, low noise, ultra-fast LDO
    5V to 3.3V/1.8V
  3. I2C bus and pin selection
    default: I2C0 at GP20 and GP21
    altern.: I2C1 at GP6 and GP7

Data Sheets

Pinouts

Pin Mapping

Pinout

on-edge(1-40):

1 1

on-shield:

5 SENSORS : T H P VOC ALS UVS 9-DOF

Default Zephyr Peripheral Mapping

 

  • 1 PIO/PWM : GP0 (PWM0)
  • 2 PIO/PWM : GP1 (PWM1)
  • 3 GND
  • 4 PIO/PWM : GP2 (PWM2)
  • 5 PIO/PWM : GP3 (PWM3)
  • 6 PIO/PWM : GP4 (PWM4)
  • 7 PIO/PWM : GP5 (PWM5)
  • 8 GND
  • 9 I2C1_SDA : GP6 (PWM6)
    nc alt. sensor i/f data SDA
  • 10 I2C1_SCL : GP7 (PWM7)
    nc alt. sensor i/f clock SCL
  • 11 PIO/PWM : GP8 (PWM8)
  • 12 PIO/PWM : GP9 (PWM9)
  • 13 GND
  • 14 PIO/PWM : GP10 (PWM10)
  • 15 PIO/PWM : GP11 (PWM11)
  • 16 PIO/PWM : GP12 (PWM12)
  • 17 PIO/PWM : GP13 (PWM13)
  • 18 GND
  • 19 PIO/PWM : GP14 (PWM14)
    nc on-shield LDO power enable
    nc (optional) VCC_EN
  • 20 PIO/PWM : GP15 (PWM15)
  • 21 PIO/PWM : GP16 (PWM0)
  • 22 PIO/PWM : GP17 (PWM1)
  • 23 GND
  • 24 PIO/PWM : GP18 (PWM2)
  • 25 PIO/PWM : GP19 (PWM3)
  • 26 I2C0_SDA : GP20 (PWM4)
    nc def. sensor i/f data SDA
  • 27 I2C0_SCL : GP21 (PWM5)
    nc def. sensor i/f clock SCL
  • 28 GND
  • 29 PIO/PWM : GP22 (PWM6)
  • 30 RUN (RESET)
  • nc PIO/PWM : GP23 (PWM7)
  • nc PIO/PWM : GP24 (PWM8)
  • nc PIO/PWM : GP25 (PWM9)
  • 31 ADC_CH0 : GP26 (PWM10)
  • 32 ADC_CH1 : GP27 (PWM11)
  • 33 GND
  • 34 ADC_CH2 : GP28 (PWM12)
  • nc ADC_CH3 : GP29 (PWM13)
  • 35 ADC_VREF
  • 36 3V3(OUT)
  • 37 3V3_EN
    nc on-shield LDO power enable
    nc (optional) VCC_EN
  • 38 GND
  • 39 VSYS
    nc on-shield LDO power enable
    nc (default) VCC_EN
  • 40 VBUS

Devicetree compatible

Waveshare Pico Environment Sensor edge pinout

Components

BME280 [8]

Default Setup

Devicetree / Kconfig

Measuring:

temperature, humidity and air pressure (THP).

Temperature range:

-40~+85℃ (resolution is 0.01°C, error ±1℃) @ 3.3V/~0.350㎃

Humidity range:

0~100%RH (resolution is 0.008%RH, error ±3%RH) @ 3.3V/~0.340㎃

Pressure range:

300~1100㍱ (resolution is 0.18㍱, error ±1㍱) @ 3.3V/~0.714㎃

 

BME280 in boards/rpipico_r3.dtsi
1wspes_sens_thp: bme280@76 {
2	status = "okay";
3	compatible = "bosch,bme280";
4	reg = <0x76>;
5};
  • Sensor I2C address: 0x76

  • Devicetree compatible: bosch,bme280

SGP40 [18]

Default Setup

Devicetree / Kconfig

Measuring:

air quality, Volatile Organic Compounds (VOC) with on-chip humidity compensation support.

Measuring range:

0~1000 ㏙ ethanol equivalent @ 3.3V/~2.6㎃

Limit condition:

< 0.05 ㏙ ethanol equivalent OR < 10% preset concentration point (the larger one should prevail)

Response time:

< 10s (𝜏 63%)

Start time:

< 60s

 

SGP40 in boards/rpipico_r3.dtsi
1wspes_sens_voc: sgp40@59 {
2	status = "okay";
3	compatible = "sensirion,sgp40";
4	reg = <0x59>;
5	enable-selftest;
6};

TSL25911 [20]

Default Setup

Devicetree / Kconfig

Measuring:

ambient IR and visible light (ALS).

Effective range:

0~88000 ㏓ @ 3.3V/~3.9㎃

 

NOT YET SUPPORTED, because of missing driver

  • Sensor I2C address: 0x29

  • Devicetree compatible: ams,tsl2591

LTR-390UV-01 [12]

Default Setup

Devicetree / Kconfig

Measuring:

ambient ultraviolet (UV) light (UVS).

Response wavelength:

280~430㎚ @ 3.3V/~0.3㎃

 

NOT YET SUPPORTED, because of missing driver

  • Sensor I2C address: 0x53

  • Devicetree compatible: ltr,390uv-01

ICM-20948 [10] with AK09916 [5] (MPU-9250 [14] with AK8963 [5])

Default Setup

Devicetree / Kconfig

Measuring:

motion and acceleration (9-DOF) with 3-axis accelerometer, 3-axis gyroscope and 3-axis magnetometer (compass). Also measuring the internal chip temperature.

Accelerometer resolution:

16-bit

Accelerometer range (configurable):

acceleration: ±2, ±4, ±8, ±16g @ 1.8V/~0.069㎃

Gyroscope resolution:

16-bit

Gyroscope range (configurable):

angular velocity: ±250, ±500, ±1000, ±2000°/ₛ @ 1.8V/~1.230㎃

Magnetometer resolution:

16-bit

Magnetometer range:

flux: ±4900µT (±4800µT) @ 1.8V/~0.090㎃

Temperature range:

-40~+85℃ (resolution is 0.05°C, error ±3%) @ 1.8V/~1.720㎃

Accelerometer:
  • full scale (range) set to ±2g

  • digital low pass filter set to fₘ=5.05㎐

  • 3㏈ with 32.48㎳ delay at sample rate fₛ=1㎑

Gyroscope:
  • full scale (range) set to ±250°/ₛ

  • digital low pass filter set to fₘ=5㎐

  • 3㏈ with 33.48㎳ delay at sample rate fₛ=1㎑

Magnetometer:
  • yielding factor on-chip is 0.14997558 (4912µT/32752µT⁻¹)

  • Zephyr unit is Gauss (10⁴T), so the sbsolute yielding factor for Zephyr sensor API is hard set to 1499

Sample rate:
  • fₛ=1㎑ scaled by 1/(1+9) and set to fₛₒ=100㎐

INTERIME SUPPORT, because of obsolete component

MPU-9250 in boards/rpipico_r3.dtsi
 1wspes_sens_dof: mpu9250@68 {
 2	status = "okay";
 3	compatible = "invensense,mpu9250";
 4	reg = <0x68>;
 5	accel-fs = <2>;
 6	accel-dlpf = "5.05";
 7	gyro-fs = <250>;
 8	gyro-dlpf = <5>;
 9	gyro-sr-div = <9>;
10};
MPU-9250 in waveshare_pico_environment_sensor.conf
1CONFIG_MPU9250_TRIGGER_NONE=y

NOT YET SUPPORTED, because of missing driver

  • Devicetree compatible: invensense,icm20948

RT9193-33 [3] and RT9193-18 [3]

Default Setup

Devicetree / Kconfig

Ultra-low noise, ultra-fast CMOS LDO regulator for 3.3V and 1.8V

  • Low Dropout of 220㎷ @ 300㎃

  • Standby current < 0.01μA when shutdown

  • Quick start-up (typically 50㎲)

  • Output voltage accuracy ±2%

  • Up to 300㎃ max output current

  • Output current limit protection at 360~400㎃

  • Thermal limit protection at 165°C

 

 

Utilization

Sensing Subsystem

The shield is ready for using with the Zephyr Sensing Subsystem. The interface is disabled for default and can be enabled by an application overlay app.overlay (see Application Development).

Sensing Interface on Shield Level

Overlay Content on Application Level

Sensing Interface in waveshare_pico_environment_sensor.overlay
 1/ {
 2    wspes_sensing: wspes-sensing {
 3        compatible = "zephyr,sensing";
 4        status = "disabled";
 5
 6        wspes_accel: wspes-accel {
 7            compatible = "zephyr,sensing-phy-3d-sensor";
 8            status = "disabled";
 9            sensor-types = <SENSING_SENSOR_TYPE_MOTION_ACCELEROMETER_3D
10                    SENSING_SENSOR_TYPE_MOTION_GYROMETER_3D
11                    SENSING_SENSOR_TYPE_MOTION_MOTION_DETECTOR>;
12            friendly-name = "WSP Environment Shield Accelerometer";
13            minimal-interval = <625>;
14            underlying-device = <&wspes_sens_dof>;
15        };
16    };
17};
  • for the interface:

    &wspes_sensing { status = "okay"; };

  • for the accelerometer sensor:

    &wspes_accel { status = "okay"; };

Programming

Set -DSHIELD=waveshare_pico_environment_sensor when you invoke west build or cmake in your Zephyr application. For example:

Using west:

west build -b rpi_pico -p -S usb-console --shield waveshare_pico_environment_sensor -d build/waveshare_pico_environment_sensor-helloshell bridle/samples/helloshell
west flash -r uf2 -d build/waveshare_pico_environment_sensor-helloshell

Using CMake and ninja:

# Use cmake to configure a Ninja-based buildsystem:
cmake -Bbuild/waveshare_pico_environment_sensor-helloshell -GNinja -DBOARD=rpi_pico -DSHIELD="waveshare_pico_environment_sensor" bridle/samples/helloshell

# Now run the build tool on the generated build system:
ninja -Cbuild/waveshare_pico_environment_sensor-helloshell flash

Simple test execution on target

(text in bold is a command input)

uart:~$ hello -h
hello - say hello
uart:~$ hello
Hello from shell.
uart:~$ hwinfo devid
Length: 8
ID: 0x8c998be1de969148

uart:~$ kernel version
Zephyr version 4.1.0

uart:~$ bridle version
Bridle version 4.1.0

uart:~$ bridle version long
Bridle version 4.1.0.0

uart:~$ bridle info
Zephyr: 4.1.0
Bridle: 4.1.0
uart:~$ device list
devices:
- clock-controller@40008000 (READY)
  DT node labels: clocks
- reset-controller@4000c000 (READY)
  DT node labels: reset
- snippet_cdc_acm_console_uart (READY)
  DT node labels: snippet_cdc_acm_console_uart
- uart@40034000 (READY)
  DT node labels: uart0 pico_serial rpipico_serial
- timer@40054000 (READY)
  DT node labels: timer
- gpio@40014000 (READY)
  DT node labels: gpio0
- adc@4004c000 (READY)
  DT node labels: adc
- flash-controller@18000000 (READY)
  DT node labels: ssi
- i2c@40044000 (READY)
  DT node labels: i2c0 pico_i2c pico_i2c0 rpipico_i2c rpipico_i2c0
- vreg@40064000 (READY)
  DT node labels: vreg
- rtc@4005c000 (READY)
  DT node labels: rtc
- leds (READY)
- bme280@76 (READY)
  DT node labels: wspes_sens_thp
- sgp40@59 (READY)
  DT node labels: wspes_sens_voc
- mpu9250@68 (READY)
  DT node labels: wspes_sens_dof
uart:~$ history
[  0] history
[  1] device list
[  2] bridle info
[  3] bridle version long
[  4] bridle version
[  5] kernel version
[  6] hwinfo devid
[  7] hello
[  8] hello -h

More Samples

BME280 Humidity and Pressure Sensor

This sample shows how to use the Sensors API driver for the Bosch BME280 environmental sensor. See also Zephyr sample: BME280 humidity and pressure sensor and BME280 Sensor Sample Tweaks (samples-sensor-bme280-tweaks).

west build -b rpi_pico -p -S usb-console -S samples-sensor-bme280-tweaks --shield waveshare_pico_environment_sensor -d build/waveshare_pico_environment_sensor-bme280 zephyr/samples/sensor/bme280
west flash -r uf2 -d build/waveshare_pico_environment_sensor-bme280

The Default Shield Sample

See also Waveshare Pico Environment Sensor Sample in Bridle.

west build -b rpi_pico -p -S usb-console --shield waveshare_pico_environment_sensor -d build/waveshare_pico_environment_sensor bridle/samples/waveshare_pico_environment_sensor
west flash -r uf2 -d build/waveshare_pico_environment_sensor

References