From c7a1b550201c280fd602a81e8573a1e23c43a6a1 Mon Sep 17 00:00:00 2001 From: Riccardo Date: Wed, 5 Oct 2022 12:35:08 +0200 Subject: [PATCH 1/4] Modified file system for science kit rev 2 Modified the file system of the old library in order to add the support for the new science kit rev 2 --- .github/workflows/compile-examples.yml | 6 +++--- .../Nano33BLESenseFirmware/LowPower.cpp | 0 .../Nano33BLESenseFirmware/LowPower.h | 0 .../Nano33BLESenseFirmware.ino | 0 .../{ => ScienceKit}/PhysicsLabFirmware/.DS_Store | Bin .../ScienceKit/PhysicsLabFirmware}/INA226.cpp | 0 .../ScienceKit/PhysicsLabFirmware}/INA226.h | 0 .../PhysicsLabFirmware/PhysicsLabFirmware.ino | 0 .../RP2040ConnectFirmware/RP2040ConnectFirmware.ino | 0 9 files changed, 3 insertions(+), 3 deletions(-) rename examples/{ => ScienceKit}/Nano33BLESenseFirmware/LowPower.cpp (100%) rename examples/{ => ScienceKit}/Nano33BLESenseFirmware/LowPower.h (100%) rename examples/{ => ScienceKit}/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino (100%) rename examples/{ => ScienceKit}/PhysicsLabFirmware/.DS_Store (100%) rename {src => examples/ScienceKit/PhysicsLabFirmware}/INA226.cpp (100%) rename {src => examples/ScienceKit/PhysicsLabFirmware}/INA226.h (100%) rename examples/{ => ScienceKit}/PhysicsLabFirmware/PhysicsLabFirmware.ino (100%) rename examples/{ => ScienceKit}/RP2040ConnectFirmware/RP2040ConnectFirmware.ino (100%) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index da5a641..7e4251e 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -43,21 +43,21 @@ jobs: - name: Arduino_LSM9DS1 - name: ArduinoBLE - name: Arduino_CMSIS-DSP - sketch-paths: examples/Nano33BLESenseFirmware + sketch-paths: examples/ScienceKit/Nano33BLESenseFirmware - fqbn: arduino:mbed_nano:nanorp2040connect platforms: | - name: arduino:mbed_nano libraries: | - name: Arduino_LSM6DSOX - name: ArduinoBLE - sketch-paths: examples/RP2040ConnectFirmware + sketch-paths: examples/ScienceKit/RP2040ConnectFirmware - fqbn: arduino:samd:mkrwifi1010 platforms: | - name: arduino:samd libraries: | - name: ArduinoBLE - name: Adafruit LSM9DS1 Library - sketch-paths: examples/PhysicsLabFirmware + sketch-paths: examples/ScienceKit/PhysicsLabFirmware steps: - name: Checkout repository diff --git a/examples/Nano33BLESenseFirmware/LowPower.cpp b/examples/ScienceKit/Nano33BLESenseFirmware/LowPower.cpp similarity index 100% rename from examples/Nano33BLESenseFirmware/LowPower.cpp rename to examples/ScienceKit/Nano33BLESenseFirmware/LowPower.cpp diff --git a/examples/Nano33BLESenseFirmware/LowPower.h b/examples/ScienceKit/Nano33BLESenseFirmware/LowPower.h similarity index 100% rename from examples/Nano33BLESenseFirmware/LowPower.h rename to examples/ScienceKit/Nano33BLESenseFirmware/LowPower.h diff --git a/examples/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino b/examples/ScienceKit/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino similarity index 100% rename from examples/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino rename to examples/ScienceKit/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino diff --git a/examples/PhysicsLabFirmware/.DS_Store b/examples/ScienceKit/PhysicsLabFirmware/.DS_Store similarity index 100% rename from examples/PhysicsLabFirmware/.DS_Store rename to examples/ScienceKit/PhysicsLabFirmware/.DS_Store diff --git a/src/INA226.cpp b/examples/ScienceKit/PhysicsLabFirmware/INA226.cpp similarity index 100% rename from src/INA226.cpp rename to examples/ScienceKit/PhysicsLabFirmware/INA226.cpp diff --git a/src/INA226.h b/examples/ScienceKit/PhysicsLabFirmware/INA226.h similarity index 100% rename from src/INA226.h rename to examples/ScienceKit/PhysicsLabFirmware/INA226.h diff --git a/examples/PhysicsLabFirmware/PhysicsLabFirmware.ino b/examples/ScienceKit/PhysicsLabFirmware/PhysicsLabFirmware.ino similarity index 100% rename from examples/PhysicsLabFirmware/PhysicsLabFirmware.ino rename to examples/ScienceKit/PhysicsLabFirmware/PhysicsLabFirmware.ino diff --git a/examples/RP2040ConnectFirmware/RP2040ConnectFirmware.ino b/examples/ScienceKit/RP2040ConnectFirmware/RP2040ConnectFirmware.ino similarity index 100% rename from examples/RP2040ConnectFirmware/RP2040ConnectFirmware.ino rename to examples/ScienceKit/RP2040ConnectFirmware/RP2040ConnectFirmware.ino From cc5ed7adbe136202fcda4e00dc88e8de8a69b83f Mon Sep 17 00:00:00 2001 From: Riccardo Date: Wed, 5 Oct 2022 14:36:44 +0200 Subject: [PATCH 2/4] added Support for ScienceKit rev 2 added Support for rScienceKit rev 2 and modified .github actions --- .github/workflows/compile-examples.yml | 24 ++ .../Nano33BLESenseFirmware/LowPower.cpp | 36 +++ .../Nano33BLESenseFirmware/LowPower.h | 8 + .../Nano33BLESenseFirmware.ino | 198 ++++++++++++++ .../Nano33BLESenseFirmware/config.h | 99 +++++++ .../ScienceKitR2/PhysicsLabFirmware/.DS_Store | Bin 0 -> 6148 bytes .../PhysicsLabFirmware/PhysicsLabFirmware.ino | 245 ++++++++++++++++++ .../ScienceKitR2/PhysicsLabFirmware/config.h | 77 ++++++ library.properties | 2 +- src/ArduinoScienceJournal.h | 65 ++++- src/Object.cpp | 6 + 11 files changed, 758 insertions(+), 2 deletions(-) create mode 100644 examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.cpp create mode 100644 examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.h create mode 100644 examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino create mode 100644 examples/ScienceKitR2/Nano33BLESenseFirmware/config.h create mode 100644 examples/ScienceKitR2/PhysicsLabFirmware/.DS_Store create mode 100644 examples/ScienceKitR2/PhysicsLabFirmware/PhysicsLabFirmware.ino create mode 100644 examples/ScienceKitR2/PhysicsLabFirmware/config.h create mode 100644 src/Object.cpp diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 7e4251e..fa1e6a8 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -58,6 +58,30 @@ jobs: - name: ArduinoBLE - name: Adafruit LSM9DS1 Library sketch-paths: examples/ScienceKit/PhysicsLabFirmware + - fqbn: arduino:mbed_nano:nano33ble + platforms: | + - name: arduino:mbed_nano + libraries: | + - name: Arduino_APDS9960 + - name: Arduino_HTS221 + - name: Arduino_LPS22HB + - name: Arduino_LSM6DSOX + - name: DFRobot_BMM150 + - name: INA2xx + - name: SerialFlash + - name: ArduinoBLE + - name: Arduino_CMSIS-DSP + sketch-paths: examples/ScienceKitR2/Nano33BLESenseFirmware + - fqbn: arduino:samd:mkrwifi1010 + platforms: | + - name: arduino:samd + libraries: | + - name: ArduinoBLE + - name: Arduino_LSM6DSOX + - name: DFRobot_BMM150 + - name: INA2xx + - name: SerialFlash + sketch-paths: examples/ScienceKitR2/PhysicsLabFirmware steps: - name: Checkout repository diff --git a/examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.cpp b/examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.cpp new file mode 100644 index 0000000..a7638f1 --- /dev/null +++ b/examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.cpp @@ -0,0 +1,36 @@ +#include "Arduino.h" +#include "mbed.h" +#include "ArduinoBLE.h" +#include "LowPower.h" + +#include "nrf_power.h" +#include "nrf_uarte.h" +#include "nrf_uart.h" + +void lowPower() +{ + // Disable UARTE0 which is initially enabled by the bootloader + nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STOPRX); + while (!nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_RXTO)) ; + NRF_UARTE0->ENABLE = 0; + NRF_UART0->ENABLE = 0; + + // Enable DCDC + nrf_power_dcdcen_set(true); + + // Turn off LED_BUILTIN + digitalWrite(LED_BUILTIN, LOW); +} + +void lowPowerWait(unsigned long time) +{ + rtos::ThisThread::sleep_for(time); +} + +void lowPowerBleWait(unsigned long time) +{ + unsigned long timeRef = millis(); + while (millis() - timeRef < time) { + BLE.poll(time - (millis() - timeRef)); + } +} diff --git a/examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.h b/examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.h new file mode 100644 index 0000000..1f77f5c --- /dev/null +++ b/examples/ScienceKitR2/Nano33BLESenseFirmware/LowPower.h @@ -0,0 +1,8 @@ +#ifndef _LOWPOWER_H_ +#define _LOWPOWER_H_ + +void lowPower(); +void lowPowerWait(unsigned long time); +void lowPowerBleWait(unsigned long time); + +#endif //_LOWPOWER_H_ \ No newline at end of file diff --git a/examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino b/examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino new file mode 100644 index 0000000..a8c1fe2 --- /dev/null +++ b/examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino @@ -0,0 +1,198 @@ +#include "LowPower.h" +#include + +#include "config.h" +#include + +#include + +const int VERSION = 0x00000001; + +#define SCIENCE_KIT_UUID(val) ("555a0002-" val "-467a-9538-01f0652c74e8") + +//#define DEBUG 0 + +BLEService service (SCIENCE_KIT_UUID("0000")); +BLEUnsignedIntCharacteristic versionCharacteristic (SCIENCE_KIT_UUID("0001"), BLERead); +BLECharacteristic accelerationCharacteristic (SCIENCE_KIT_UUID("0011"), BLENotify, 3 * sizeof(float)); +BLECharacteristic gyroscopeCharacteristic (SCIENCE_KIT_UUID("0012"), BLENotify, 3 * sizeof(float)); +BLECharacteristic magneticFieldCharacteristic(SCIENCE_KIT_UUID("0013"), BLENotify, 3 * sizeof(float)); +BLEFloatCharacteristic temperatureCharacteristic (SCIENCE_KIT_UUID("0014"), BLENotify); +BLEFloatCharacteristic pressureCharacteristic (SCIENCE_KIT_UUID("0015"), BLENotify); +BLEFloatCharacteristic humidityCharacteristic (SCIENCE_KIT_UUID("0016"), BLENotify); +BLEUnsignedIntCharacteristic proximityCharacteristic (SCIENCE_KIT_UUID("0017"), BLENotify); +BLECharacteristic colorCharacteristic (SCIENCE_KIT_UUID("0018"), BLENotify, 4 * sizeof(int)); +BLEUnsignedShortCharacteristic soundPressureCharacteristic(SCIENCE_KIT_UUID("0019"), BLENotify); +BLEFloatCharacteristic resistanceCharacteristic (SCIENCE_KIT_UUID("0020"), BLENotify); + +byte voltageBufferIndex = 0; +bool voltageBufferFilled = false; +short soundSampleBuffer[256]; + +void updateSubscribedCharacteristics(); + +void onPDMdata() { + // query the number of bytes available + int bytesAvailable = PDM.available(); + + // read into the sample buffer + PDM.read(soundSampleBuffer, bytesAvailable); +} + +uint16_t getSoundAverage() { + uint32_t avg = 0; + for (int i = 0; i < sizeof(soundSampleBuffer)/sizeof(soundSampleBuffer[0]); i++) { + avg += soundSampleBuffer[i]*soundSampleBuffer[i]; + } + return sqrt(avg); +} + +// String to calculate the local and device name +String name; +unsigned long lastNotify = 0; + +void printSerialMsg(const char * msg) { + #ifdef DEBUG + if (Serial) { + Serial.println(msg); + } + #endif +} + +void setup() { + #ifdef DEBUG + Serial.begin(9600); + while (!Serial); + Serial.println("Started"); + #endif + + delay(2000); + sensorsInit(); + + PDM.onReceive(onPDMdata); + if (!PDM.begin(1, 16000)) { + printSerialMsg("Failed to start PDM!"); + blinkLoop(); + } + + if (!BLE.begin()) { + printSerialMsg("Failed to initialized BLE!"); + blinkLoop(); + } + + String address = BLE.address(); + #ifdef DEBUG + if (Serial) { + Serial.print("address = "); + Serial.println(address); + } + #endif + address.toUpperCase(); + + name = "BLE Sense - "; + name += address[address.length() - 5]; + name += address[address.length() - 4]; + name += address[address.length() - 2]; + name += address[address.length() - 1]; + + #ifdef DEBUG + if (Serial) { + Serial.print("name = "); + Serial.println(name); + } + #endif + + BLE.setLocalName(name.c_str()); + BLE.setDeviceName(name.c_str()); + BLE.setAdvertisedService(service); + + service.addCharacteristic(versionCharacteristic); + service.addCharacteristic(accelerationCharacteristic); + service.addCharacteristic(gyroscopeCharacteristic); + service.addCharacteristic(magneticFieldCharacteristic); + service.addCharacteristic(temperatureCharacteristic); + service.addCharacteristic(pressureCharacteristic); + service.addCharacteristic(humidityCharacteristic); + service.addCharacteristic(proximityCharacteristic); + service.addCharacteristic(colorCharacteristic); + service.addCharacteristic(soundPressureCharacteristic); + service.addCharacteristic(resistanceCharacteristic); + + versionCharacteristic.setValue(VERSION); + + BLE.addService(service); + BLE.advertise(); + + lowPower(); +} + +void loop() { + BLE.poll(1000); + while (BLE.connected()) { + lowPowerBleWait(100); + updateSubscribedCharacteristics(); + } +} + +void updateSubscribedCharacteristics() { + if (accelerationCharacteristic.subscribed()) { + if (IMU.accelerationAvailable()) { + float x, y, z; + IMU.readAcceleration(x, y, z); + float acceleration[3]; + + acceleration[0] = x; + acceleration[1] = y; + acceleration[2] = z; + accelerationCharacteristic.writeValue((byte*)acceleration, sizeof(acceleration)); + } + } + if (gyroscopeCharacteristic.subscribed()) { + if (IMU.gyroscopeAvailable()) { + float x, y, z; + IMU.readGyroscope(x, y, z); + float gyroscope[3]; + + gyroscope[0] = x; + gyroscope[1] =y; + gyroscope[2] = z; + gyroscopeCharacteristic.writeValue((byte*)gyroscope, sizeof(gyroscope)); + } + } + + if (magneticFieldCharacteristic.subscribed()) {// CHECK + sBmm150MagData_t m = bmm150.getGeomagneticData(); + float magneticField[3]; + magneticField[0] = m.x; + magneticField[1] = m.y; + magneticField[2] = m.z; + magneticFieldCharacteristic.writeValue((byte*)magneticField, sizeof(magneticField)); + } + + if (temperatureCharacteristic.subscribed()) { + float temperature = TempSens.getTemperature(); + temperatureCharacteristic.writeValue(temperature); + } + + + if(resistanceCharacteristic.subscribed()){ + float resistanceAvg = INFINITY; + resistanceAvg = ResSens.getResistorValue(); + resistanceCharacteristic.writeValue(resistanceAvg); + } + + if (proximityCharacteristic.subscribed() && APDS.proximityAvailable()) { + uint32_t proximity = APDS.readProximity(); + proximityCharacteristic.writeValue(proximity); + } + if (colorCharacteristic.subscribed() && APDS.colorAvailable()) { + int color[4]; + APDS.readColor(color[0], color[1], color[2], color[3]); + colorCharacteristic.writeValue((byte*)color, sizeof(color)); + } + + if (pressureCharacteristic.subscribed()) { + float pressure = BARO.readPressure(); + pressureCharacteristic.writeValue(pressure); + } +} diff --git a/examples/ScienceKitR2/Nano33BLESenseFirmware/config.h b/examples/ScienceKitR2/Nano33BLESenseFirmware/config.h new file mode 100644 index 0000000..e8e733b --- /dev/null +++ b/examples/ScienceKitR2/Nano33BLESenseFirmware/config.h @@ -0,0 +1,99 @@ +#include "ArduinoScienceJournal.h" + +// Flash memory +#include "SerialFlash.h" +#include + +const int FlashChipSelect = 2; + +#include +#include +#include + +// IMU +#include +// 3 axis magnetometer +#include "DFRobot_BMM150.h" +// INA +#include +#include + + +DFRobot_BMM150_I2C bmm150(&Wire, I2C_ADDRESS_1); + +const uint32_t SHUNT_MICRO_OHM{100000}; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm +const uint16_t MAXIMUM_AMPS{1}; ///< Max expected amps, clamped from 1A to a max of 1022A + +INA_Class INA; + +SerialFlashFile file; + +void blinkLoop() { + while (1) { + digitalWrite(LED_BUILTIN, HIGH); + delay(500); + digitalWrite(LED_BUILTIN, LOW); + delay(500); + } +} + +void sensorsInit() { + // INA Init + if (!INA.begin(MAXIMUM_AMPS, SHUNT_MICRO_OHM)) { + Serial.println(F("No INA device found, retrying in 10 seconds...")); + while(1); + } // while no devices detected + Serial.println("INA init success!"); + INA.setBusConversion(8500); // Maximum conversion time 8.244ms + INA.setShuntConversion(8500); // Maximum conversion time 8.244ms + INA.setAveraging(128); // Average each reading n-times + INA.setMode(INA_MODE_CONTINUOUS_BOTH); // Bus/shunt measured continuously + INA.alertOnBusOverVoltage(true, 5000); // Trigger alert if over 5V on bus + + // bmm150 + while(bmm150.begin()){ + Serial.println("bmm150 init failed, Please try again!"); + delay(1000); + } Serial.println("bmm150 init success!"); + Serial.println("bmm150 init success!"); + + // BMM150 init + // Set sensor operation mode + bmm150.setOperationMode(BMM150_POWERMODE_NORMAL); + //Set preset mode + bmm150.setPresetMode(BMM150_PRESETMODE_HIGHACCURACY); + // Set the rate of obtaining geomagnetic data, the higher, the faster (without delay function) + bmm150.setRate(BMM150_DATA_RATE_10HZ); + // Enable the measurement at x-axis, y-axis and z-axis, + bmm150.setMeasurementXYZ(); + + // LSM6DSOX init + if (!IMU.begin()) { + Serial.println("Failed to initialize IMU!"); + while (1); + } + Serial.println("IMU Initialized"); + + // Flash Init + if (!SerialFlash.begin(FlashChipSelect)) { + Serial.println(F("Failed to initialize Flash!")); + while (1); + } + + Serial.println("Flash Initialized"); + + if (!APDS.begin()) { + Serial.println("Failed to initialized APDS!"); + blinkLoop(); + } + + if (!HTS.begin()) { + Serial.println("Failed to initialized HTS!"); + blinkLoop(); + } + + if (!BARO.begin()) { + Serial.println("Failed to initialized BARO!"); + blinkLoop(); + } +} diff --git a/examples/ScienceKitR2/PhysicsLabFirmware/.DS_Store b/examples/ScienceKitR2/PhysicsLabFirmware/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 // click here to install the library: http://librarymanager#ArduinoBLE +#include "config.h" + + +#define SCIENCE_KIT_UUID(val) ("555a0001-" val "-467a-9538-01f0652c74e8") + +BLEService service (SCIENCE_KIT_UUID("0000")); +BLEUnsignedIntCharacteristic versionCharacteristic (SCIENCE_KIT_UUID("0001"), BLERead); +BLEByteCharacteristic ledCharacteristic (SCIENCE_KIT_UUID("1001"), BLERead | BLEWrite); +BLEUnsignedShortCharacteristic input1Characteristic (SCIENCE_KIT_UUID("2001"), BLENotify); +BLEUnsignedShortCharacteristic input2Characteristic (SCIENCE_KIT_UUID("2002"), BLENotify); +BLEUnsignedShortCharacteristic input3Characteristic (SCIENCE_KIT_UUID("2003"), BLENotify); +BLEByteCharacteristic ouput1Characteristic (SCIENCE_KIT_UUID("3001"), BLERead | BLEWrite); +BLEByteCharacteristic ouput2Characteristic (SCIENCE_KIT_UUID("3002"), BLERead | BLEWrite); +BLEFloatCharacteristic voltageCharacteristic (SCIENCE_KIT_UUID("4001"), BLENotify); +BLEFloatCharacteristic currentCharacteristic (SCIENCE_KIT_UUID("4002"), BLENotify); +BLEFloatCharacteristic resistanceCharacteristic (SCIENCE_KIT_UUID("4003"), BLENotify); +BLECharacteristic accelerationCharacteristic (SCIENCE_KIT_UUID("5001"), BLENotify, 3 * sizeof(float)); +BLECharacteristic gyroscopeCharacteristic (SCIENCE_KIT_UUID("5002"), BLENotify, 3 * sizeof(float)); +BLECharacteristic magneticFieldCharacteristic(SCIENCE_KIT_UUID("5003"), BLENotify, 3 * sizeof(float)); +BLECharacteristic lightCharacteristic (SCIENCE_KIT_UUID("6001"), BLENotify, 3 * sizeof(float)); +BLEFloatCharacteristic TemperatureCharacteristic (SCIENCE_KIT_UUID("6002"), BLENotify); + +// check +const int LED_PIN = 0; // check +const int INPUT1_PIN = A3; +const int INPUT2_PIN = A1; +const int INPUT3_PIN = A0; +const int OUTPUT1_PIN = 5; +const int OUTPUT2_PIN = 1; +const int RESISTANCE_PIN = A2; + +String name; +unsigned long lastNotify = 0; + +unsigned long imuTime; + +#define RESISTOR_AUX_LOW 47000.0 +#define RESISTOR_AUX_HIGH 979.16 // 47k in parallel with 1k = 979.16 Ohm + +#define IMU_UPDATE_TIME 50 + +//#define DEBUG //uncomment to debug the code :) + +void setup() { + Serial.begin(9600); +#ifdef DEBUG + while (!Serial); + Serial.println("Started"); +#endif + + pinMode(LED_PIN, OUTPUT); + pinMode(INPUT1_PIN, INPUT); + pinMode(INPUT2_PIN, INPUT); + pinMode(INPUT3_PIN, INPUT); + pinMode(OUTPUT1_PIN, OUTPUT); + pinMode(OUTPUT2_PIN, OUTPUT); + + sensorsInit(); + + if (!BLE.begin()) { + Serial.println("Failed to initialized BLE!"); + + while (1); + } + + String address = BLE.address(); + + address.toUpperCase(); + + name = "MKRSci"; + name += address[address.length() - 5]; + name += address[address.length() - 4]; + name += address[address.length() - 2]; + name += address[address.length() - 1]; + + BLE.setLocalName(name.c_str()); + BLE.setDeviceName(name.c_str()); + BLE.setAdvertisedService(service); + + service.addCharacteristic(versionCharacteristic); + service.addCharacteristic(ledCharacteristic); + service.addCharacteristic(input1Characteristic); + service.addCharacteristic(input2Characteristic); + service.addCharacteristic(input3Characteristic); + service.addCharacteristic(ouput1Characteristic); + service.addCharacteristic(ouput2Characteristic); + service.addCharacteristic(voltageCharacteristic); + service.addCharacteristic(currentCharacteristic); + service.addCharacteristic(resistanceCharacteristic); + service.addCharacteristic(accelerationCharacteristic); + service.addCharacteristic(gyroscopeCharacteristic); + service.addCharacteristic(magneticFieldCharacteristic); + service.addCharacteristic(lightCharacteristic); + service.addCharacteristic(TemperatureCharacteristic); + BLE.addService(service); + + BLE.advertise(); + imuTime = millis(); +} + +void loop() { + lastNotify = 0; + + while (BLE.connected()) { + if (ledCharacteristic.written()) { // si usa? + analogWrite(LED_PIN, ledCharacteristic.value()); + } + + if (ouput1Characteristic.written()) { + analogWrite(OUTPUT1_PIN, ouput1Characteristic.value()); + } + + if (ouput2Characteristic.written()) { + analogWrite(OUTPUT2_PIN, ouput2Characteristic.value()); + } + + unsigned long now = millis(); + + if (abs((long)now - (long)lastNotify) >= 100) { + lastNotify = now; + + // every 100ms update subscribed characteristics + updateSubscribedCharacteristics(); + } + + updateSubscribedIMUCharacteristics(); + } +} + +void updateSubscribedCharacteristics() { + if (input1Characteristic.subscribed()) { + input1Characteristic.writeValue(analogReadAverage(INPUT1_PIN, 30)); + } + + if (input2Characteristic.subscribed()) { + input2Characteristic.writeValue(analogReadAverage(INPUT2_PIN, 30)); + } + + if (input3Characteristic.subscribed()) { + input3Characteristic.writeValue(analogReadAverage(INPUT3_PIN, 30)); + } + + if (voltageCharacteristic.subscribed()) { + //dtostrf(, 7, 4, busChar); + float voltage = INA.getBusMilliVolts(0) / 1000.0; +#ifdef DEBUG + Serial.print("Voltage: "); + Serial.print(voltage); + Serial.println("V"); +#endif + voltageCharacteristic.writeValue(voltage); + } + + if (currentCharacteristic.subscribed()) { + float current = (INA.getBusMicroAmps(0))/1000.0F; +#ifdef DEBUG + Serial.print("Current: "); + Serial.print(current); + Serial.println("mA"); +#endif + currentCharacteristic.writeValue(current/1000.0F); + } + + if (resistanceCharacteristic.subscribed()) { + float resistanceAvg = INFINITY; //open circuit as default + resistanceAvg = ResSens.getResistorValue(); +#ifdef DEBUG + Serial.print("Resistance: "); + Serial.print(resistanceAvg); + Serial.println(" Ohm"); +#endif + resistanceCharacteristic.writeValue(resistanceAvg); + } +} + + +int analogReadAverage(int pin, int numberOfSamples) { + int averageValue = 0; + for (int i = 0; i < numberOfSamples; i++) { + averageValue += analogRead(pin); + } + + return (averageValue / numberOfSamples); +} + +void updateSubscribedIMUCharacteristics() { + if (millis() - imuTime > IMU_UPDATE_TIME) { + imuTime = millis(); + if (accelerationCharacteristic.subscribed()) { + if (IMU.accelerationAvailable()) { + float x, y, z; + IMU.readAcceleration(x, y, z); + float acceleration[3]; + + acceleration[0] = x; + acceleration[1] = y; + acceleration[2] = z; + accelerationCharacteristic.writeValue((byte*)acceleration, sizeof(acceleration)); + } + } + + if (gyroscopeCharacteristic.subscribed()) { + if (IMU.gyroscopeAvailable()) { + float x, y, z; + IMU.readGyroscope(x, y, z); + float gyroscope[3]; + + gyroscope[0] = x; + gyroscope[1] =y; + gyroscope[2] = z; + gyroscopeCharacteristic.writeValue((byte*)gyroscope, sizeof(gyroscope)); + } + } + + + if (magneticFieldCharacteristic.subscribed()) { + sBmm150MagData_t m = bmm150.getGeomagneticData(); + float magneticField[3]; + magneticField[0] = m.x; + magneticField[1] = m.y; + magneticField[2] = m.z; + magneticFieldCharacteristic.writeValue((byte*)magneticField, sizeof(magneticField)); + } + } +} \ No newline at end of file diff --git a/examples/ScienceKitR2/PhysicsLabFirmware/config.h b/examples/ScienceKitR2/PhysicsLabFirmware/config.h new file mode 100644 index 0000000..7849884 --- /dev/null +++ b/examples/ScienceKitR2/PhysicsLabFirmware/config.h @@ -0,0 +1,77 @@ +#include "ArduinoScienceJournal.h" + +#ifndef ARDUINO_ARCH_SAMD +#include +#endif + +// Flash memory +#include "SerialFlash.h" +#include + +// IMU +#include + +// BMM150 +#include "DFRobot_BMM150.h" + +// INA +#include +#include + +DFRobot_BMM150_I2C bmm150(&Wire, I2C_ADDRESS_1); + +const int FlashChipSelect = 2; + +const uint32_t SHUNT_MICRO_OHM{100000}; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm +const uint16_t MAXIMUM_AMPS{1}; ///< Max expected amps, clamped from 1A to a max of 1022A + +INA_Class INA; + +SerialFlashFile file; + +//ResistanceSensorClass ResSens; + +void sensorsInit() { + // INA Init + if (!INA.begin(MAXIMUM_AMPS, SHUNT_MICRO_OHM)) { + Serial.println(F("No INA device found, retrying in 10 seconds...")); + while(1); + } // while no devices detected + Serial.println("INA init success!"); + INA.setBusConversion(8500); // Maximum conversion time 8.244ms + INA.setShuntConversion(8500); // Maximum conversion time 8.244ms + INA.setAveraging(128); // Average each reading n-times + INA.setMode(INA_MODE_CONTINUOUS_BOTH); // Bus/shunt measured continuously + INA.alertOnBusOverVoltage(true, 5000); // Trigger alert if over 5V on bus + + // bmm150 + while(bmm150.begin()){ + Serial.println("bmm150 init failed, Please try again!"); + delay(1000); + } Serial.println("bmm150 init success!"); + Serial.println("bmm150 init success!"); + + // BMM150 init + // Set sensor operation mode + bmm150.setOperationMode(BMM150_POWERMODE_NORMAL); + //Set preset mode + bmm150.setPresetMode(BMM150_PRESETMODE_HIGHACCURACY); + // Set the rate of obtaining geomagnetic data, the higher, the faster (without delay function) + bmm150.setRate(BMM150_DATA_RATE_10HZ); + // Enable the measurement at x-axis, y-axis and z-axis, + bmm150.setMeasurementXYZ(); + + // LSM6DSOX init + if (!IMU.begin()) { + Serial.println("Failed to initialize IMU!"); + while (1); + } + Serial.println("IMU Initialized"); + + // Flash Init + if (!SerialFlash.begin(FlashChipSelect)) { + Serial.println(F("Failed to initialize Flash!")); + while (1); + } + Serial.println("Flash Initialized"); +} \ No newline at end of file diff --git a/library.properties b/library.properties index 564cad5..eb30800 100644 --- a/library.properties +++ b/library.properties @@ -8,4 +8,4 @@ category=Communication url=https://github.com/arduino-libraries/Arduino_ScienceJournal architectures=samd,nrf52,mbed,mbed_nano includes=ArduinoScienceJournal.h -depends=Adafruit LSM9DS0 Library,Adafruit Zero PDM Library,Arduino_APDS9960,Arduino_HTS221,Arduino_LPS22HB,Arduino_LSM9DS1,ArduinoBLE,Arduino_CMSIS-DSP,Arduino_LSM6DSOX +depends=Adafruit LSM9DS0 Library,Adafruit Zero PDM Library,Arduino_APDS9960,Arduino_HTS221,Arduino_LPS22HB,Arduino_LSM9DS1,ArduinoBLE,Arduino_CMSIS-DSP,Arduino_LSM6DSOX,SerialFlash,WiFiNINA,DFRobot_BMM150,INA2xx diff --git a/src/ArduinoScienceJournal.h b/src/ArduinoScienceJournal.h index de24ed0..7f455db 100644 --- a/src/ArduinoScienceJournal.h +++ b/src/ArduinoScienceJournal.h @@ -20,6 +20,69 @@ #ifndef _ARDUINO_SCIENCE_JOURNAL_H_ #define _ARDUINO_SCIENCE_JOURNAL_H_ -// Nothing here. Everything is in the example sketches! +#include "Arduino.h" + +#ifdef ARDUINO_ARCH_MBED + #include "mbed.h" +#endif + + +#ifdef ARDUINO_ARCH_SAMD + #define IMU_ADDRESS 0x00; + #define VOLTAGE_REF_LEVEL 3300 + #define LIGHT_SENSOR_PIN A5 + #define TEMP_SENSOR_PIN A4 +#else + #define IMU_ADDRESS 0x00; + #define VOLTAGE_REF_LEVEL 1100 + #define LIGHT_SENSOR_PIN A7 + #define TEMP_SENSOR_PIN 6 +#endif + +class ResistorSensorClass { +public: + int getResistorValue() { + int raw_voltage = analogRead(A2); + int voltage_in = (raw_voltage * VOLTAGE_REF_LEVEL / 1024); + int res = ((3300 * 1000) / voltage_in) - 1000; + return res; + } + + int getResistor1KValue() { + digitalWrite(6, HIGH); + int raw_voltage = analogRead(A2); + int voltage_in = (raw_voltage * VOLTAGE_REF_LEVEL / 1024); + int res = ((3300 * (47000*1000/48000)) / voltage_in) - (47000*1000/48000); + digitalWrite(6, LOW); + return res; + } +}; + +extern ResistorSensorClass ResSens; + +class TemperatureSensorClass { +public: + int getTemperature(){ + int raw_voltage = analogRead(TEMP_SENSOR_PIN); + int voltage_in = (raw_voltage * VOLTAGE_REF_LEVEL / 1024); + float temperature = ((voltage_in) - 500.0F) / 10.0F; + return temperature; + } +}; + +extern TemperatureSensorClass TempSens; + + +class LightSensorClass { +public: + int getLux(){ + int raw_voltage = analogRead( LIGHT_SENSOR_PIN); + int voltage_in = (raw_voltage * VOLTAGE_REF_LEVEL / 1024); + float lux = (voltage_in * 0.5F) + 0.5; + return lux; + } +}; + +extern LightSensorClass LightSens; #endif diff --git a/src/Object.cpp b/src/Object.cpp new file mode 100644 index 0000000..e388ca7 --- /dev/null +++ b/src/Object.cpp @@ -0,0 +1,6 @@ +#include "ArduinoScienceJournal.h" + + +ResistorSensorClass ResSens; +TemperatureSensorClass TempSens; +LightSensorClass LightSens; From e9d297915226681e3e9870138ac3ea287d7a1fad Mon Sep 17 00:00:00 2001 From: Riccardo Date: Thu, 6 Oct 2022 16:51:08 +0200 Subject: [PATCH 3/4] added new BMM150 library added the new library for BMM150 NOTE: actually is not public i'm refering in the code to it as BoschSensorClass.h --- .github/workflows/compile-examples.yml | 4 +-- .../Nano33BLESenseFirmware.ino | 27 +++++++++-------- .../Nano33BLESenseFirmware/config.h | 26 +++++------------ .../PhysicsLabFirmware/PhysicsLabFirmware.ino | 23 ++++++++------- .../ScienceKitR2/PhysicsLabFirmware/config.h | 29 ++++++------------- library.properties | 2 +- 6 files changed, 48 insertions(+), 63 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index fa1e6a8..a4f7834 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -66,7 +66,7 @@ jobs: - name: Arduino_HTS221 - name: Arduino_LPS22HB - name: Arduino_LSM6DSOX - - name: DFRobot_BMM150 + #- name: Arduino_BMI270_BMM150 - name: INA2xx - name: SerialFlash - name: ArduinoBLE @@ -78,7 +78,7 @@ jobs: libraries: | - name: ArduinoBLE - name: Arduino_LSM6DSOX - - name: DFRobot_BMM150 + #- name: Arduino_BMI270_BMM150 - name: INA2xx - name: SerialFlash sketch-paths: examples/ScienceKitR2/PhysicsLabFirmware diff --git a/examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino b/examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino index a8c1fe2..a9d96a0 100644 --- a/examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino +++ b/examples/ScienceKitR2/Nano33BLESenseFirmware/Nano33BLESenseFirmware.ino @@ -136,9 +136,9 @@ void loop() { void updateSubscribedCharacteristics() { if (accelerationCharacteristic.subscribed()) { - if (IMU.accelerationAvailable()) { + if (IMU_SK.accelerationAvailable()) { float x, y, z; - IMU.readAcceleration(x, y, z); + IMU_SK.readAcceleration(x, y, z); float acceleration[3]; acceleration[0] = x; @@ -148,9 +148,9 @@ void updateSubscribedCharacteristics() { } } if (gyroscopeCharacteristic.subscribed()) { - if (IMU.gyroscopeAvailable()) { + if (IMU_SK.gyroscopeAvailable()) { float x, y, z; - IMU.readGyroscope(x, y, z); + IMU_SK.readGyroscope(x, y, z); float gyroscope[3]; gyroscope[0] = x; @@ -160,14 +160,17 @@ void updateSubscribedCharacteristics() { } } - if (magneticFieldCharacteristic.subscribed()) {// CHECK - sBmm150MagData_t m = bmm150.getGeomagneticData(); - float magneticField[3]; - magneticField[0] = m.x; - magneticField[1] = m.y; - magneticField[2] = m.z; - magneticFieldCharacteristic.writeValue((byte*)magneticField, sizeof(magneticField)); - } + if (magneticFieldCharacteristic.subscribed()) { + float x, y, z; + if (BME.magneticFieldAvailable()) { + BME.readMagneticField(x, y, z); + float magneticField[3]; + magneticField[0] = x; + magneticField[1] = y; + magneticField[2] = z; + magneticFieldCharacteristic.writeValue((byte*)magneticField, sizeof(magneticField)); + } + } if (temperatureCharacteristic.subscribed()) { float temperature = TempSens.getTemperature(); diff --git a/examples/ScienceKitR2/Nano33BLESenseFirmware/config.h b/examples/ScienceKitR2/Nano33BLESenseFirmware/config.h index e8e733b..9784db1 100644 --- a/examples/ScienceKitR2/Nano33BLESenseFirmware/config.h +++ b/examples/ScienceKitR2/Nano33BLESenseFirmware/config.h @@ -13,13 +13,14 @@ const int FlashChipSelect = 2; // IMU #include // 3 axis magnetometer -#include "DFRobot_BMM150.h" +#include // INA #include #include -DFRobot_BMM150_I2C bmm150(&Wire, I2C_ADDRESS_1); +LSM6DSOXClass IMU_SK = LSM6DSOXClass(Wire,0x6A); +BoschSensorClass BME = BoschSensorClass(Wire); const uint32_t SHUNT_MICRO_OHM{100000}; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm const uint16_t MAXIMUM_AMPS{1}; ///< Max expected amps, clamped from 1A to a max of 1022A @@ -51,24 +52,13 @@ void sensorsInit() { INA.alertOnBusOverVoltage(true, 5000); // Trigger alert if over 5V on bus // bmm150 - while(bmm150.begin()){ - Serial.println("bmm150 init failed, Please try again!"); - delay(1000); - } Serial.println("bmm150 init success!"); - Serial.println("bmm150 init success!"); - - // BMM150 init - // Set sensor operation mode - bmm150.setOperationMode(BMM150_POWERMODE_NORMAL); - //Set preset mode - bmm150.setPresetMode(BMM150_PRESETMODE_HIGHACCURACY); - // Set the rate of obtaining geomagnetic data, the higher, the faster (without delay function) - bmm150.setRate(BMM150_DATA_RATE_10HZ); - // Enable the measurement at x-axis, y-axis and z-axis, - bmm150.setMeasurementXYZ(); + if (!BME.begin()) { + Serial.println("Failed to initialize IMU!"); + while (1); + } // LSM6DSOX init - if (!IMU.begin()) { + if (!IMU_SK.begin()) { Serial.println("Failed to initialize IMU!"); while (1); } diff --git a/examples/ScienceKitR2/PhysicsLabFirmware/PhysicsLabFirmware.ino b/examples/ScienceKitR2/PhysicsLabFirmware/PhysicsLabFirmware.ino index e9e04f4..7806af4 100644 --- a/examples/ScienceKitR2/PhysicsLabFirmware/PhysicsLabFirmware.ino +++ b/examples/ScienceKitR2/PhysicsLabFirmware/PhysicsLabFirmware.ino @@ -207,9 +207,9 @@ void updateSubscribedIMUCharacteristics() { if (millis() - imuTime > IMU_UPDATE_TIME) { imuTime = millis(); if (accelerationCharacteristic.subscribed()) { - if (IMU.accelerationAvailable()) { + if (IMU_SK.accelerationAvailable()) { float x, y, z; - IMU.readAcceleration(x, y, z); + IMU_SK.readAcceleration(x, y, z); float acceleration[3]; acceleration[0] = x; @@ -220,9 +220,9 @@ void updateSubscribedIMUCharacteristics() { } if (gyroscopeCharacteristic.subscribed()) { - if (IMU.gyroscopeAvailable()) { + if (IMU_SK.gyroscopeAvailable()) { float x, y, z; - IMU.readGyroscope(x, y, z); + IMU_SK.readGyroscope(x, y, z); float gyroscope[3]; gyroscope[0] = x; @@ -234,12 +234,15 @@ void updateSubscribedIMUCharacteristics() { if (magneticFieldCharacteristic.subscribed()) { - sBmm150MagData_t m = bmm150.getGeomagneticData(); - float magneticField[3]; - magneticField[0] = m.x; - magneticField[1] = m.y; - magneticField[2] = m.z; - magneticFieldCharacteristic.writeValue((byte*)magneticField, sizeof(magneticField)); + float x, y, z; + if (BME.magneticFieldAvailable()) { + BME.readMagneticField(x, y, z); + float magneticField[3]; + magneticField[0] = x; + magneticField[1] = y; + magneticField[2] = z; + magneticFieldCharacteristic.writeValue((byte*)magneticField, sizeof(magneticField)); + } } } } \ No newline at end of file diff --git a/examples/ScienceKitR2/PhysicsLabFirmware/config.h b/examples/ScienceKitR2/PhysicsLabFirmware/config.h index 7849884..774cf21 100644 --- a/examples/ScienceKitR2/PhysicsLabFirmware/config.h +++ b/examples/ScienceKitR2/PhysicsLabFirmware/config.h @@ -7,19 +7,19 @@ // Flash memory #include "SerialFlash.h" #include - +#include // IMU #include // BMM150 -#include "DFRobot_BMM150.h" +#include // INA #include #include -DFRobot_BMM150_I2C bmm150(&Wire, I2C_ADDRESS_1); - +LSM6DSOXClass IMU_SK = LSM6DSOXClass(Wire,0x6A); +BoschSensorClass BME = BoschSensorClass(Wire); const int FlashChipSelect = 2; const uint32_t SHUNT_MICRO_OHM{100000}; ///< Shunt resistance in Micro-Ohm, e.g. 100000 is 0.1 Ohm @@ -45,24 +45,13 @@ void sensorsInit() { INA.alertOnBusOverVoltage(true, 5000); // Trigger alert if over 5V on bus // bmm150 - while(bmm150.begin()){ - Serial.println("bmm150 init failed, Please try again!"); - delay(1000); - } Serial.println("bmm150 init success!"); - Serial.println("bmm150 init success!"); - - // BMM150 init - // Set sensor operation mode - bmm150.setOperationMode(BMM150_POWERMODE_NORMAL); - //Set preset mode - bmm150.setPresetMode(BMM150_PRESETMODE_HIGHACCURACY); - // Set the rate of obtaining geomagnetic data, the higher, the faster (without delay function) - bmm150.setRate(BMM150_DATA_RATE_10HZ); - // Enable the measurement at x-axis, y-axis and z-axis, - bmm150.setMeasurementXYZ(); + if (!BME.begin()) { + Serial.println("Failed to initialize IMU!"); + while (1); + } // LSM6DSOX init - if (!IMU.begin()) { + if (!IMU_SK.begin()) { Serial.println("Failed to initialize IMU!"); while (1); } diff --git a/library.properties b/library.properties index eb30800..39f1c0f 100644 --- a/library.properties +++ b/library.properties @@ -8,4 +8,4 @@ category=Communication url=https://github.com/arduino-libraries/Arduino_ScienceJournal architectures=samd,nrf52,mbed,mbed_nano includes=ArduinoScienceJournal.h -depends=Adafruit LSM9DS0 Library,Adafruit Zero PDM Library,Arduino_APDS9960,Arduino_HTS221,Arduino_LPS22HB,Arduino_LSM9DS1,ArduinoBLE,Arduino_CMSIS-DSP,Arduino_LSM6DSOX,SerialFlash,WiFiNINA,DFRobot_BMM150,INA2xx +depends=Adafruit LSM9DS0 Library,Adafruit Zero PDM Library,Arduino_APDS9960,Arduino_HTS221,Arduino_LPS22HB,Arduino_LSM9DS1,ArduinoBLE,Arduino_CMSIS-DSP,Arduino_LSM6DSOX,SerialFlash,WiFiNINA,INA2xx From 6d277b3b1cccd3a88367d25b86966bcfa4f03e9b Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 7 Oct 2022 13:18:32 +0200 Subject: [PATCH 4/4] Restore Arduino_BMI270_BMM150 as dependency --- .github/workflows/compile-examples.yml | 4 ++-- library.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index a4f7834..c0a7b56 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -66,7 +66,7 @@ jobs: - name: Arduino_HTS221 - name: Arduino_LPS22HB - name: Arduino_LSM6DSOX - #- name: Arduino_BMI270_BMM150 + - name: Arduino_BMI270_BMM150 - name: INA2xx - name: SerialFlash - name: ArduinoBLE @@ -78,7 +78,7 @@ jobs: libraries: | - name: ArduinoBLE - name: Arduino_LSM6DSOX - #- name: Arduino_BMI270_BMM150 + - name: Arduino_BMI270_BMM150 - name: INA2xx - name: SerialFlash sketch-paths: examples/ScienceKitR2/PhysicsLabFirmware diff --git a/library.properties b/library.properties index 39f1c0f..10ee616 100644 --- a/library.properties +++ b/library.properties @@ -8,4 +8,4 @@ category=Communication url=https://github.com/arduino-libraries/Arduino_ScienceJournal architectures=samd,nrf52,mbed,mbed_nano includes=ArduinoScienceJournal.h -depends=Adafruit LSM9DS0 Library,Adafruit Zero PDM Library,Arduino_APDS9960,Arduino_HTS221,Arduino_LPS22HB,Arduino_LSM9DS1,ArduinoBLE,Arduino_CMSIS-DSP,Arduino_LSM6DSOX,SerialFlash,WiFiNINA,INA2xx +depends=Adafruit LSM9DS0 Library,Adafruit Zero PDM Library,Arduino_APDS9960,Arduino_HTS221,Arduino_LPS22HB,Arduino_LSM9DS1,ArduinoBLE,Arduino_CMSIS-DSP,Arduino_LSM6DSOX,SerialFlash,WiFiNINA,INA2xx,Arduino_BMI270_BMM150