Skip to main content

MeshCore Sensor CLI Reference

Overview

All sensor-specific settings are accessed through the MeshCore CLI over a USB/serial connection (115200 baud) or via BLE using the MeshCore mobile app. Commands are case-insensitive. Changes take effect immediately and persist across reboots.

Setting the Sensor Type

set sensor type <type>

Valid types:

ValueSensorMeasurements
bme280Bosch BME280Temperature, humidity, pressure
bme680Bosch BME680Temperature, humidity, pressure, gas/VOC
ina219TI INA219Bus voltage, shunt voltage, current, power

Example: set sensor type bme280

Setting the I2C Address

set sensor addr <hex address>

Default addresses:

  • BME280: 0x76 (SDO/CSB tied low) or 0x77 (SDO/CSB tied high)
  • BME680: same as BME280 — 0x76 default
  • INA219: 0x40 default, configurable up to 0x4F via A0/A1 pins

Example: set sensor addr 0x76

Setting the Broadcast Interval

set sensor interval <seconds>

Controls how often a sensor reading is taken and advertised on the mesh. Lower values increase power consumption significantly.

IntervalReadings/dayApprox. daily consumption (nRF52840)
60 s1 440~20 mAh
300 s288~7 mAh
600 s144~5 mAh
1800 s48~3 mAh

Example: set sensor interval 600

Enabling and Disabling the Sensor

set sensor enabled true
set sensor enabled false

Disabling the sensor stops readings and broadcasts while keeping all other sensor settings intact.

Reading the Current Sensor Value

sensor read

Triggers an immediate sensor reading and prints the result to the console:

BME280 @ 0x76
  Temperature : 21.4 °C
  Humidity    : 58.3 %
  Pressure    : 1013.2 hPa

This is useful for verifying wiring and sensor function during installation without waiting for the next scheduled broadcast.

Viewing Sensor Status

sensor status

Prints the full sensor configuration and runtime state:

Sensor status
  Type        : BME280
  I2C address : 0x76
  Interval    : 600 s
  Enabled     : true
  Last reading: 21.4 °C / 58.3 % / 1013.2 hPa (42 s ago)
  Error count : 0

A non-zero error count indicates I2C communication failures — check wiring and address setting. An I2C bus scan (i2c scan) can help identify the device address if unknown.

Temperature Calibration Offset

set sensor temp_offset <degrees C>

Applies a fixed offset to compensate for self-heating from the MCU or enclosure. Common values are -1.0 to -3.0 for sensors mounted close to a running MCU.

Example: set sensor temp_offset -1.5

To determine the correct offset, place the sensor alongside a calibrated reference thermometer for 30 minutes in still air. The offset is: reference_temp − reported_temp.

Wiring Reference: BME280 / BME680 to RAK4631 (WisBlock)

For the cleanest integration, use the RAK1906 WisBlock Environment Sensor module. It plugs directly into a WisBlock Base Board sensor slot (Slot A, B, C, or D) with no soldering and no I2C wiring — the base board routes power and I2C automatically.

RAK1906 connectionBase Board pinNotes
VDD3.3 V (slot rail)Supplied by base board
GNDGND (slot rail)
SDI (SDA)I2C_SDA (slot rail)Shared with other I2C devices
SCK (SCL)I2C_SCL (slot rail)
SDOGND via slot railSets I2C address to 0x76
CSB3.3 V via slot railSelects I2C mode

If wiring a bare BME280 breakout module to the RAK4631 GPIO header instead:

BME280 pinRAK4631 pin
VCC3V3
GNDGND
SDAI2C1_SDA (WB_I2C1_SDA)
SCLI2C1_SCL (WB_I2C1_SCL)
SDOGND (for address 0x76)
CSB3V3 (I2C mode)

Keep I2C wires short (under 20 cm on the GPIO header) and use 4.7 kΩ pull-up resistors on SDA and SCL if running the sensor on an extended cable.