Arduino Portenta and Nicla Sense ME Acceleration

I just found out the Nicla Sense ME by Bosch SensorTech board from Arduino Pro has motion as well as environmental sensors. One major thing lacking on the PortentaH7 is motion (Accelerometer data). Note: The Nicloa Sense also has the strange (+5V) I2C connector that is found on all the Portenta Series boards. Comes with the I2C cable.

image

When the Portenta Edge Impulse support is ready (They are waiting for Arduino to release new software for arduino_mbed_core releases above version 2.5.2), any chance it could be made to work with the above Nicla Sense ME board with examples?

I will probably work on my own examples, but thought I should post if others are also interested.

@Rocksetta I have done a first board evaluation (in framework of academic research project), reading IMU data (no machine learning applied). One thing I notice is long build time using Arduino IDE, even for a simple program. I am curious about your experience.

Nicla Sense ME is added to PlatformIO, more specific the latest release of nordicnrf52:

1 Like

Hello @Rocksetta,

I tested the board too a few months ago.
Unfortunately, due to the small memory, I had to remove the ble handler and the dfu manager in the Arduino_BHY2.cpp to make it work.
I think Arduino was working on a better declaration where you can choose what to initiate when calling the BHY2.begin();

I haven’t tested it since, maybe it works better now, but yes this board looks promising!

Regards,

Louis

Yeh, it is ridiculously slow, much slower when you do the Machine Learning. It is much faster on a Linux machine, even an old Linux machine is much faster than Windows.

Strange that the super cheap Seeedstudio XIAO board is fairly fast to compile with the Arduino IDE on Windows, but it doesn’t have the power I need.

For my animation class I convinced the school to get me a power windows computer with a couple of nice GPU’s (not a hardware guy but I think they are GeForce GTX 1070 GAMING X 8G). I use this for most of my Arduino Machine Learning stuff although a regular windows computer works fine just is really slow, maybe about 20 minutes per compile. My fast Windows computer just took 14 minutes to compile.

The simplicity of the Arduino method for me outweighs the slow compile time, but I am teaching High School kids so I need it very simple.

By the way @Joeri hope you have seen my draft for a maker100 course here

@louis, that is good to know. I will probably only use the nicla sense me board as a sensor for the Portenta.

Hi, I am interested in using Seeed XIAO BLE SENSE (NRF52840) for sound classification with Edge Impulse. Any sample?

@iarakis
Sound is fairly complex to read, I had troubles trying to do it on un-supported boards. I tired to look at the arduino examples and then replace the relevant code with code that works for the unsupported board but had troubles. good luck.

Hi @louis,

I’m trying to run my first model on the Nicla Sense ME and it doesn’t look like it’s running (I’ve had success with non-ML applications on the Sense).

Are you saying that BLE and an EI model can’t be run at the same time due to memory constraints? My model is < 20 KB flash and < 2 KB RAM in size. I could take the steps that you have mentioned in Arduino_BHY2.cpp, but then it sounds like I can xfer the data over BLE.

thanks,
Justin

OK, I did some more testing and digging. I was able to get a legible error and this is what I got:

++ MbedOS Error Info ++
Error Status: 0x80FF0144 Code: 324 Module: 255
Error Message: Assertion failed: _stack_buffer != NULL
Location: 0x4A489
File: ./mbed-os/connectivity/drivers/ble/FEATURE_BLE/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp+186
Error Value: 0x0
Current Thread: main Id: 0x2000641C Entry: 0x212F3 StackSize: 0xC00 StackMem: 0x200057F8 SP: 0x200062DC
For more info, visit: mbedos-error
– MbedOS Error Info –

I did a quick google search and the error came up on a Bosch message board. It looks like it is indeed a memory issue given the 64 KB RAM limitation. Link here to that message board thread.

I looked into the model parameters and it looks like the array size is 1800 (600 raw samples * 3 samples/frame) for my model. I tried reducing the window size in the model by half to lower the number of samples to 300. I’ll try to keep reducing to see if I can get within the memory envelope to see if that makes a difference without overly sacrificing accuracy. Otherwise, I guess I’ll shift to the Seeed Xiao BLE Sense. :unamused:

Hello @jlutzwpi ,

Indeed the 64KB RAM limit is annoying. Last time I spoke with Bosch people they were speaking about easily turn off the BLE from the init function. I have not played with that board since so I am not sure how things have evolved. I am pretty sure their is enough space to run both BLE and EI models with some optimization but I have not had time to dig more into it (and I was also waiting for the firmware to be officially release to see the future changes :p)
I cannot remember but I think there is another function that is kind of greedy in RAM, maybe you could skip its usage.

Regards,

Louis

@louis if you happen to remember what that function is, please let me know! Thanks! :slight_smile:

Unfortunately, I removed all my old libraries from Arduino IDE a few month ago.
You might be able to search for what is being intialized and then try to remove different parts. Maybe it was the dfu manager? definitely not 100% sure.
It is also possible that the structure of the files changed since I last worked on it (I haven’t worked on that board since september).

Regards,

Louis

@louis I was able to do a workaround and turn the Nicla Sense ME into a sensor shield and mount it to an Arduino MKR Wifi 1010. I was able to run inference on the MKR Wifi (even though it has even less RAM!). Thanks, Justin

1 Like

Great to hear that @jlutzwpi ,

Feel free to share your code here once ready. I am sure it’ll be helpful to other people from the community. I’ve heard that we’ll be also supporting the Nicla Sense ME in the near future (not full support but at least the sketch generation from the studio deployment page). Stay tuned :wink:

Regards,

Louis