Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the Waveshare Pico Environment Sensor #179

Merged
merged 6 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/qa-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ jobs:
--enable-size-report --platform-reports \
--testsuite-root bridle/samples/button \
--testsuite-root bridle/samples/buzzer \
--testsuite-root bridle/samples/helloshell
--testsuite-root bridle/samples/helloshell \
--testsuite-root bridle/samples/waveshare_pico_environment_sensor

- name: Upload integration test results
uses: actions/upload-artifact@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config SHIELD_WAVESHARE_PICO_ENVIRONMENT_SENSOR
def_bool $(shields_list_contains,waveshare_pico_environment_sensor)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "rpipico_r3-pinctrl.dtsi"
#include "rpipico_r3-tweaks.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "rpipico_r3-pinctrl.dtsi"
#include "rpipico_r3-tweaks.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_P20>, <I2C0_SCL_P21>;
bias-pull-up;
};
};
i2c1_default: i2c1_default {
group1 {
bias-pull-up;
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&rpipico_i2c0 {
compatible = "gpio-i2c"; /* I2C0_SDA_P20 and I2C0_SCL_P21 */
sda-gpios = <&rpipico_header 20 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>;
scl-gpios = <&rpipico_header 21 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>;
/delete-property/ resets;
/delete-property/ clocks;
/delete-property/ interrupts;
/delete-property/ interrupt-names;
/delete-property/ pinctrl-0;
/delete-property/ pinctrl-names;
};

&gpio0 {
status = "okay";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
i2c0_pico_default: i2c0_pico_default {
group45_i2c {
pinmux = <I2C0_SDA_P20>, <I2C0_SCL_P21>;
bias-pull-up;
};
};
i2c1_pico_default: i2c1_pico_default {
group1415_i2c {
bias-pull-up;
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "waveshare_rp2040-pinctrl.dtsi"
#include "rpipico_r3-tweaks.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "waveshare_rp2040-pinctrl.dtsi"
#include "rpipico_r3-tweaks.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
The `Waveshare Pico Environment Sensor`_ is a :bbk:`pico sized` sensor shield.

.. list-table::
:align: center
:width: 100%
:widths: 66, 33

* - .. rubric:: Features and Resources
- .. rubric:: Printed Circuit Board

* - :hwftlbl-vdd:`5V/~8.5㎃`
:hwftlbl-vdd:`3.3V/~10㎃`
:hwftlbl-vdd:`1.8V/~5㎃`

:hwftlbl-mtr:`THP` :
:hwftlbl-tmp:`T`
:hwftlbl-hty:`H`
:hwftlbl-prs:`P`
:hwftlbl-voc:`VOC`
:hwftlbl-lgt:`ALS`
:hwftlbl-lgt:`UVS`
:hwftlbl-cps:`9-DOF`

:hwftlbl-i2c:`1`

.. rst-class:: rst-columns

- :bbl:`THP`: temperature, humidity and air pressure
- :bbl:`VOC`: air quality, Volatile Organic Compounds
- :bbl:`ALS`: ambient IR and visible light
- :bbl:`UVS`: ambient ultraviolet (UV) light
- :bbl:`9-DOF`: motion and acceleration
- :bbk:`1 I2C` controller for sensors

.. rubric:: Design Data
.. rst-class:: rst-columns

- `Schematic <Waveshare Pico Environment Sensor Schematic_>`_

- .. image:: /boards/shields/waveshare_pico_environment_sensor/doc/img/hardware.jpg
:align: center
:alt: Waveshare Pico Environment Sensor
152 changes: 152 additions & 0 deletions boards/shields/waveshare_pico_environment_sensor/doc/helloshell.rsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
.. rubric:: Simple test execution on target

.. tabs::

.. group-tab:: Basics

.. code-block:: console

uart:~$ hello -h
hello - say hello
uart:~$ hello
Hello from shell.

uart:~$ hwinfo devid
Length: 8
ID: 0x8c998be1de969148

uart:~$ kernel version
Zephyr version 3.5.99

uart:~$ bridle version
Bridle version 3.5.99

uart:~$ bridle version long
Bridle version 3.5.99.0

uart:~$ bridle info
Zephyr: 3.5.99
Bridle: 3.5.99

uart:~$ device list
devices:
- clock-controller@40008000 (READY)
- reset-controller@4000c000 (READY)
- snippet_cdc_acm_console_uart (READY)
- uart@40034000 (READY)
- timer@40054000 (READY)
- gpio@40014000 (READY)
- adc@4004c000 (READY)
- flash-controller@18000000 (READY)
- i2c@40044000 (READY)
- vreg@40064000 (READY)
- leds (READY)
- bme280@76 (READY)
- mpu9250@68 (READY)
- sgp40@59 (READY)

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

.. group-tab:: I2C

The |Waveshare Pico Environment Sensor| provides four on-shield sensors
connected on I2C0.

.. code-block:: console

uart:~$ i2c scan i2c@40044000
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- 53 -- -- -- -- -- 59 -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --
5 devices found on i2c@40044000

- The I2C address ``0x29`` is the ASM `TSL25911`_, an
ambient IR and visible light sensor (ALS).
- The I2C address ``0x53`` is the LITEON `LTR-390UV-01`_, an
ambient ultraviolet (UV) light sensor (UVS).
- The I2C address ``0x59`` is the Sensirion `SGP40`_, an
air quality sensor, Volatile Organic Compounds (VOC).
- The I2C address ``0x68`` is the InvenSense `ICM-20948`_ with `AK09916`_
or in old hardware releases the `MPU-9250`_ with `AK8963`_, an
motion and acceleration sensor (9-DOF) with 3-axis accelerometer,
3-axis gyroscope and 3-axis magnetometer (compass).
- The I2C address ``0x76`` is the Bosch `BME280`_, an
temperature, humidity and air pressure sensor (THP).

The Chip-ID of the Bosch BME280 environmental sensor can read from
register ``0xd0`` and must be ``0x60``:

uart:~$ i2c read_byte i2c@40044000 76 d0
Output: 0x60

.. group-tab:: Sensors

.. code-block:: console

uart:~$ sensor info
device name: bme280@76, vendor: Bosch Sensortec GmbH, model: bme280, friendly name: (null)
device name: mpu9250@68, vendor: InvenSense Inc., model: mpu9250, friendly name: (null)
device name: sgp40@59, vendor: Sensirion AG, model: sgp40, friendly name: (null)

.. rubric:: BME280 (THP)

.. code-block:: console

uart:~$ sensor get bme280@76
channel idx=13 ambient_temp shift=7 num_samples=1 value=40464800000ns (28.069999)
channel idx=14 press shift=7 num_samples=1 value=40464800000ns (100.944643)
channel idx=16 humidity shift=7 num_samples=1 value=40464800000ns (37.618163)
uart:~$ sensor get bme280@76
channel idx=13 ambient_temp shift=7 num_samples=1 value=44841400000ns (28.079999)
channel idx=14 press shift=7 num_samples=1 value=44841400000ns (100.945768)
channel idx=16 humidity shift=7 num_samples=1 value=44841400000ns (37.618163)
uart:~$ sensor get bme280@76
channel idx=13 ambient_temp shift=7 num_samples=1 value=45757900000ns (28.079999)
channel idx=14 press shift=7 num_samples=1 value=45757900000ns (100.945596)
channel idx=16 humidity shift=7 num_samples=1 value=45757900000ns (37.604491)

.. rubric:: SGP40 (VOC)

.. code-block:: console

uart:~$ sensor get sgp40@59
channel idx=29 gas_resistance shift=2 num_samples=1 value=7499000000ns (1.999999)
uart:~$ sensor get sgp40@59
channel idx=29 gas_resistance shift=15 num_samples=1 value=8509500000ns (3553.196197)
uart:~$ sensor get sgp40@59
channel idx=29 gas_resistance shift=15 num_samples=1 value=9527500000ns (4021.196197)

.. rubric:: MPU-9250 (9-DOF)

.. code-block:: console

uart:~$ sensor get mpu9250@68
channel idx=3 accel_xyz shift=5 num_samples=1 value=133465500000ns, (-0.152630, -0.034118, -9.957485)
channel idx=7 gyro_xyz shift=5 num_samples=1 value=133465500000ns, (0.010923, -0.001465, 0.018784)
channel idx=11 magn_xyz shift=5 num_samples=1 value=133465500000ns, (0.021287, 0.918931, -0.960458)
channel idx=12 die_temp shift=5 num_samples=1 value=133465500000ns (30.772454)
uart:~$ sensor get mpu9250@68
channel idx=3 accel_xyz shift=5 num_samples=1 value=134743500000ns, (-0.150237, -0.036512, -9.961675)
channel idx=7 gyro_xyz shift=5 num_samples=1 value=134743500000ns, (0.010790, -0.001732, 0.019184)
channel idx=11 magn_xyz shift=5 num_samples=1 value=134743500000ns, (0.010643, 0.940219, -0.957040)
channel idx=12 die_temp shift=5 num_samples=1 value=134743500000ns (30.769460)
uart:~$ sensor get mpu9250@68
channel idx=3 accel_xyz shift=5 num_samples=1 value=135771400000ns, (-0.148441, -0.035315, -9.968858)
channel idx=7 gyro_xyz shift=5 num_samples=1 value=135771400000ns, (0.011723, -0.001732, 0.019450)
channel idx=11 magn_xyz shift=5 num_samples=1 value=135771400000ns, (0.015965, 0.938445, -0.938241)
channel idx=12 die_temp shift=5 num_samples=1 value=135771400000ns (30.781436)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading