Simultaneous Data recording on Nano 33 BLE Sense

I was wondering can I record both accelerometer and microphone data at the same time on Nano 33 BLE Sense with the same time signatures and send it to Edge Impulse. One at a time can be done but the invocation of both can it be done via some programming technique or is it not possible and I should look at using 2 separate boards to achieve this.

you'll probably have more trouble synchronising two boards data output than dealing with everything on the same board. Also I'm unsure how you'll flag specific times (µs or even ms precision) to samples or accelerometer data.

The accelerometer and sound recording can be working in the background. The key question is what resolution do you need to match audio samples to accelerometer reading.

Acquiring accelerometer data from the LSM9DS1 is not instantaneous. The builtin library sets then acceleration range to 4G and 119 Hz --> so you get at max 119 samples per second with this line of code:

writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0x70); // 119 Hz, 4G

This means that when you get that data, you don't know how fresh it is, it might have been there for 8ms possibly (119 Hz means one data point every 8.4ms roughly) or might have just arrived. This is your granularity and the next sample will be 8.4ms later. If you sample sound at 16kHz you'll have acquired more than 130 samples in the mean time. --> the accelerometer sampling rate is kinda dictating your resolution.

If you want to get data at a higher frequency you can change the 0x70 in the command above --> See page 51/52 in the datasheet for the CTRL_REG6_XL register


for exemple

writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0xD0);

would be 952 Hz (at 4G).

there is also Femme Verbeek's library that could be an alternative.


Regarding the audio, I assume you want to use the PDM library and Arduino Sound library?

are you using PDM.onReceive() to get your data ? ==> if so you get samples in bulk but since you know the sampling frequency, you have some idea of when each sample was acquired.

The insight you gave on the different sample rate mismatch was something I had overlooked. I might have to re-think my approach to the simultaneous collection of data.

Thank you. I will update this thread if I find any method to solve my issue.

If you want to get data at a higher frequency you can change the 0x70 in the command above --> See page 51/52 in the datasheet for the CTRL_REG6_XL register

This gave me the feeling that you are a wizard from Harry Potter and Chamber of Arduinos.

This gave me the feeling that you are a wizard from Harry Potter and Chamber of Arduinos.

;D

I'd look at the problem the other way: what resolution do you need? ie is that OK if you can attach an accelerometer sample to a range of audio samples with some level of certainty? and how many audio samples can you afford to have in this "window"?

if you read for example the accelerometer at 50 Hz and sample audio at 16 KHz, then you'd have 320 audio samples in your window, representing 20ms. is that good enough?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.