ble_stream.ino
No Wi-Fi on the Sense ME — the nRF52832 only speaks BLE. This sketch streams X acceleration via notify through ArduinoBLE (working after nicla::begin, confirmed in docs-db); nRF Connect plots it live on the phone.
Hardware
An Arduino Nicla Sense ME (nRF52832, BLE only) with Bosch BHI260AP hub, BMM150, BMP390, BME688 sensors, RGB LED on an I2C driver and LiPo charger. The board alone + a smartphone with nRF Connect (or a Web Bluetooth app). The antenna is internal, ~10 m range.
Wiring
No wiring. LiPo power for mobile measurement; the 3-wire ACH connector takes a 3.7 V cell.
How it works
BHY2 feeds the sensors, BLE.poll runs the radio stack; writeValue on a notify characteristic pushes notifications to subscribers. Encoding in hundredths of g fits an int16.
Running it
Programmed from the Arduino IDE (ArduinoCore-mbed); Arduino_BHY2 and Nicla_System libraries; USB through a serial bridge.
Variants
Add the 9 axes + pressure + IAQ to the service, batch samples for range, or pair the phone as central for a standalone logger.
ble_stream.ino
// Le Sense ME n'a QUE du BLE (pas de Wi-Fi) : la télémétrie
// passe par une caractéristique notify, lue par le téléphone.
// Après nicla::begin, l'ArduinoBLE standard fonctionne (docs-db).
#include "Arduino_BHY2.h"
#include "Nicla_System.h"
#include <ArduinoBLE.h>
SensorAccel accel(0);
BLEService telemetry("F0F0");
BLEShortCharacteristic accX("F0F1", BLENotify);
void setup() {
Serial.begin(115200);
nicla::begin();
BHY2.begin();
accel.begin();
BHY2.update();
BLE.begin();
BLE.setLocalName("SenseME");
BLE.setAdvertisedService(telemetry);
telemetry.addCharacteristic(accX);
BLE.addService(telemetry);
BLE.advertise();
}
void loop() {
BHY2.update();
BLE.poll();
if (accel.checkNewData()) {
// ax en g -> centièmes de g dans un int16
accX.writeValue((int16_t)(accel.x() * 100));
}
delay(20);
}