Skip to content

Add Heltec_v2_sensor env and environment sensors for Heltec V2 - #3747

Open
Roberto-Gomes wants to merge 1 commit into
meshcore-dev:devfrom
Roberto-Gomes:feature/heltec-v2-sensor
Open

Roberto-Gomes wants to merge 1 commit into
meshcore-dev:devfrom
Roberto-Gomes:feature/heltec-v2-sensor

Conversation

@Roberto-Gomes

Copy link
Copy Markdown

What

  • New Heltec_v2_sensor env, building examples/simple_sensor for the Heltec WiFi LoRa 32 V2.
  • The base Heltec_lora32_v2 section now pulls ${sensor_base} flags/lib_deps and
    helpers/sensors, and target.h/.cpp use EnvironmentSensorManager instead of
    SensorManager, the same way heltec_v3 does.
  • ENV_INCLUDE_GPS=0: the V2 has no GPS, so no MicroNMEALocationProvider is built
    (same override as minewsemi_me25ls01 and wio_wm1110).

Why

The V2 had no sensor env, and its SensorManager only reports battery. With
EnvironmentSensorManager, I2C sensors on the OLED bus (SDA=4, SCL=15) are
auto-detected, e.g. an AHT25 at 0x38 next to the OLED at 0x3C.

Testing

  • All Heltec V2 envs build (PlatformIO). Size before (dev 428a95c) and after this change, in bytes:

    env RAM before RAM after Flash before Flash after Flash Δ
    Heltec_v2_repeater 60520 62336 1151941 1203525 +51584 (+4.5%)
    Heltec_v2_repeater_bridge_espnow 62192 64016 1162745 1214241 +51496 (+4.4%)
    Heltec_v2_room_server 64208 66024 1147337 1198901 +51564 (+4.5%)
    Heltec_v2_terminal_chat 61116 62940 530577 587597 +57020 (+10.7%)
    Heltec_v2_companion_radio_usb 66628 68436 608381 660129 +51748 (+8.5%)
    Heltec_v2_companion_radio_ble 104112 105920 1426281 1478769 +52488 (+3.7%)
    Heltec_v2_companion_radio_wifi 109928 111752 1079381 1131293 +51912 (+4.8%)
    Heltec_v2_kiss_modem 25552 27372 505321 566501 +61180 (+12.1%)
    Heltec_v2_sensor (new) – 60384 – 1209789 –

    The cost is about 52 KB of flash and 1.8 KB of RAM per env, from the sensor_base drivers.
    The largest env (companion_radio_ble) uses 44.2% of the 3342336-byte app partition.

  • Hardware test with four Heltec V2 boards, all on the same build: a Heltec_v2_companion_radio_usb
    driven by meshcore-cli, a Heltec_v2_repeater, and two Heltec_v2_sensor, each with an AHT25
    on SDA=4/SCL=15.

    • With -D MESH_DEBUG=1, both sensors log Found AHT10/AHT20 at address: 38 at boot
      (AHT25 picked up by the existing Adafruit_AHTX0 driver, no code change).

    • With the normal build, the companion received the sensors' adverts, and after login,
      req_telemetry returned the AHT25 readings on channel 2 next to the battery voltage on channel 1:

      SensorA: voltage 3.95 V (ch1), temperature 28.6 °C (ch2), humidity 76.5 % (ch2)
      SensorB: voltage 3.95 V (ch1), temperature 29.2 °C (ch2), humidity 74.0 % (ch2)
      

I used Claude Code to help with this change. I reviewed the diff and ran the tests above on my own boards.

Use EnvironmentSensorManager and sensor_base on Heltec V2, as heltec_v3
does, so I2C sensors on the OLED bus are detected. GPS is disabled since
the board has none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cronyx

cronyx commented Nov 1, 2026

Copy link
Copy Markdown

Hello! You can set -D PIN_GPS_RX=12 -D PIN_GPS_TX=13 for use external GPS module and the build will complete successfully

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants