Add Elecrow ThinkNode M4 variant (nRF52840 + LR1110)#2682
Open
M0JSX wants to merge 11 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds MeshCore companion BLE, repeater, and room server firmware support for the Elecrow ThinkNode M4 — a power bank device with integrated LoRa communication, GPS, and nRF52840 + Semtech LR1110.
Hardware:
MCU: Nordic nRF52840
Radio: Semtech LR1110 (868/915 MHz)
GPS: Quectel L76K
Battery: 2x18650 parallel (~7000mAh)
Bootloader: UF2, SoftDevice S140 v6.1.1
Environments:
ThinkNode_M4_companion_ble — BLE companion radio (PIN: 123456)
ThinkNode_M4_repeater — standalone repeater
ThinkNode_M4_room_server — standalone room server
Features implemented:
BLE advertising, pairing and secure connection
LoRa messaging via LR1110
GPS via L76K (enable/disable via settings)
Battery percentage and voltage via power bank serial chip (UART at 4800 baud, pins RX=30, TX=5)
Battery gauge LEDs — show level on button press for 10 seconds
LoRa TX/RX blue LED flash
Power-on red LED sequence — 3 quick flashes then steady during init
Sleep on 3s long press, wake on button press
Double press sends location advert
Key implementation notes:
LED_BLUE must be set to -1 — without this Bluefruit calls digitalWrite(41) continuously during BLE advertising, causing random hard fault crashes
Serial2 instead of SoftwareSerial — SoftwareSerial interrupt conflicts with the SoftDevice S140 causing random crashes; hardware UART (NRF_UARTE1) on pins 30/5 is stable
SoftDevice v6.1.1 required — must match the factory bootloader; v7 causes RADIOLIB_ERR_CHIP_NOT_FOUND
RadioLib must be pinned to 7.6.0 — v7.7.1 returns RADIOLIB_ERR_SPI_CMD_INVALID (-706) with the LR1110 firmware on this hardware
Power enable pins must be driven before radio SPI init: PIN_POWER_EN (11) HIGH and VEXT_ENABLE (32) LOW
RF switch table uses only DIO5/DIO6 with 2 values, matching Meshtastic's rfswitch.h for this board
PIN_SERIAL2_RX=30 / PIN_SERIAL2_TX=5 must be defined in variant.h to enable hardware Serial2 for the battery management chip
board.loop() is called from ThinkNodeM4SensorManager::loop() since the main loop only calls sensors.loop()
lib/nrf52/s140_nrf52_6.1.1_API must be copied from the PlatformIO framework packages before building:
bash cp -r ~/.platformio/packages/framework-arduinoadafruitnrf52/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API lib/nrf52/
Pin mapping (from Meshtastic variants/nrf52840/ELECROW-ThinkNode-M4/variant.h):
SPI: MISO=8, MOSI=7, SCK=6, NSS=27
LR1110: RESET=40 (P1.08), IRQ=12, BUSY=26
GPS: EN=43 (P1.11, active LOW), RESET=3, STANDBY=28, RX=46 (P1.14), TX=44 (P1.12)
Battery LEDs: 15, 17, 34 (P1.02), 36 (P1.04)
Battery serial: RX=30, TX=5, 4800 baud
Power: PIN_POWER_EN=11 (HIGH=on), VEXT_ENABLE=32/P1.00 (LOW=on)
Button: 4, LED_HEARTBEAT=41 (P1.09, red), LED_PAIRING=13 (blue)
Known limitations:
Battery percentage from serial chip may differ slightly from app-displayed value — the power bank chip reports per-cell voltage; the app uses its own voltage-to-percentage curve
GPS LED breathing/pulse effect not yet implemented
Tested on: Elecrow ThinkNode M4 (LMM14004D1), EU 868MHz — BLE advertising, pairing, LoRa messaging, battery display, LED indicators and sleep/wake all confirmed working.