Skip to content

RP2350 Full Hardware Integration Example

Note: This is a legacy C reference example. For new development, use the Rust SDK example with the Rust SDK instead.

A field-deployable sensor node example with all real hardware components wired to a Raspberry Pi Pico 2 (RP2350).

Hardware Components

# Component Part Number Interface I2C Addr Description
1 Audio ADC PCM1860QDBTRQ1 I2S + I2C 0x48 2ch 24-bit 96kHz (TI)
2 Microphone WM-61A x2 Analog - Electret condenser (Panasonic)
3 Env Sensor SEN0385 (CHT832X) I2C 0x44 Temp + humidity, weather-proof (DFRobot)
4 Accelerometer ADXL345BCCZ SPI - 3-axis +/-16g (Analog Devices)
5 Battery MOSFET BSS84 GPIO + ADC - P-channel MOSFET (ON Semi)
6 LTE Modem BG770A UART AT - Cat-M1/NB-IoT (TESSOL)

Pin Assignments (RP2350)

PCM1860 (I2S Audio ADC):
  BCK  -> GPIO14 (PIO0 - I2S bit clock)
  LRCK -> GPIO15 (PIO0 - I2S word select)
  DOUT -> GPIO16 (PIO0 - I2S data input)
  SDA  -> GPIO4  (I2C0)
  SCL  -> GPIO5  (I2C0)

CHT832X (Environment Sensor, shared I2C0 bus):
  SDA  -> GPIO4  (I2C0)
  SCL  -> GPIO5  (I2C0)

ADXL345 (Accelerometer, SPI0):
  CS   -> GPIO17
  CLK  -> GPIO18 (SPI0 SCK)
  MOSI -> GPIO19 (SPI0 TX)
  MISO -> GPIO20 (SPI0 RX)

BSS84 (Battery Monitor):
  Gate -> GPIO21 (enable, active LOW for P-channel)
  ADC  -> GPIO26 (ADC0)

BG770A (LTE Modem, UART0):
  TX   -> GPIO0  (UART0 TX)
  RX   -> GPIO1  (UART0 RX)
  PWR  -> GPIO22 (power key)

Wiring Diagram

                            RP2350 (Pico 2)
                     +---------------------------+
                     |                           |
    BG770A TX  <---|  GPIO0  (UART0 TX)        |
    BG770A RX  --->|  GPIO1  (UART0 RX)        |
                     |                           |
    I2C0 SDA  <---->|  GPIO4  (I2C0 SDA)  ------+--> PCM1860 SDA
    I2C0 SCL  <---->|  GPIO5  (I2C0 SCL)  ------+--> PCM1860 SCL
                     |                    |      +--> CHT832X SDA
                     |                    +------+--> CHT832X SCL
                     |                           |
    PCM1860 BCK  <---|  GPIO14 (PIO0)            |
    PCM1860 LRCK <---|  GPIO15 (PIO0)            |
    PCM1860 DOUT --->|  GPIO16 (PIO0)            |
                     |                           |
    ADXL345 CS   <---|  GPIO17                   |
    SPI0 CLK     <---|  GPIO18 (SPI0 SCK)        |
    SPI0 MOSI    <---|  GPIO19 (SPI0 TX)         |
    SPI0 MISO    --->|  GPIO20 (SPI0 RX)         |
                     |                           |
    BSS84 Gate   <---|  GPIO21                   |
    BG770A PWR  <---|  GPIO22                   |
                     |                           |
    Battery ADC  --->|  GPIO26 (ADC0)            |
                     +---------------------------+

Microphone Signal Path

                 2.2kohm            1uF
MICBIAS (pin22) ---/\/\/--- WM-61A(+) ---||--- PCM1860 VINL1 (pin1)
                            WM-61A(-) --- GND
                                          1uF
                            PCM1860 VINL2 (pin2) ---||--- GND
                            (reference ground)

The PCM1860 outputs 2.5V MICBIAS to power the WM-61A electret condenser microphones. The 2.2kohm resistor limits the bias current. The 1uF coupling capacitor blocks DC and passes only the AC audio signal. VINL2 is bypassed to ground through a capacitor to serve as the single-ended input reference.

Battery Monitoring Circuit

VBAT ---[R1 100k]---+---[R2 100k]--- GND
                     |
                BSS84 Drain --> GPIO26 (ADC0)
GPIO21 -------> BSS84 Gate
VBAT ---------> BSS84 Source

The BSS84 P-channel MOSFET acts as a high-side switch. Driving the gate LOW turns on the MOSFET, connecting the voltage divider to the ADC. The MOSFET is turned off after measurement to save power.

Voltage calculation: V_bat = ADC_raw * 3.3 / 4096 * 2.0

Stream Definitions

Stream ID Name Unit Rate Source
0 temperature degC 1 Hz CHT832X
1 humidity %RH 1 Hz CHT832X
2 accel_x g 100 Hz ADXL345
3 accel_y g 100 Hz ADXL345
4 accel_z g 100 Hz ADXL345
5 battery_volt V 0.033 Hz BSS84 + ADC

File Structure

File Description
main.c Full hardware integration example (C reference)

Legacy C Build

# Using Pico SDK CMakeLists.txt
add_executable(rp2350_full_hardware main.c)
target_link_libraries(rp2350_full_hardware
    pico_stdlib
    hardware_i2c
    hardware_spi
    hardware_adc
    hardware_uart
    hardware_dma
    hardware_pio
    hardware_watchdog
)
pico_add_extra_outputs(rp2350_full_hardware)

API Documentation Reference