Arduino Nano RP2040 help

Can anyone give any points on what you needed modify the Raspberry Pi Firmware (assuming you both modified the Rpi firmware form Edge Impulse) to make this work? How do you compile the source code to uf2? Thanks gents

  1. Git clone the repo to your machine, https://github.com/edgeimpulse/firmware-pi-rp2040
  2. Go to firmware-pi-rp2040/ThirdParty/Wire/src/Wire.h and change the SDA & SCL pin, as remark by RickorDD above.
  3. If you read the readme in the firmware repo, it says you need to install the PICO_SDK in your machine, so git clone that repo in your machine, GitHub - raspberrypi/pico-sdk & set the path variable as where you put this pico sdk folder.
  4. Back to your firmware folder, run the lines as in the readme. The output uf2 file will be located in the firmware-pi-rp2040/build folder.

FYI, my machine is windows10, and i ran the above in WSL Ubuntu 18.04.

After done the dataset collection, training, validation & compiling the arduino library in edge impulse studio, i was trying to run the inference example with my nano rp2040, the static buffer example sketch works well, serial report the classifier correctly. The problem i face now is, i can’t get any respond in serial when i run the ‘nano_ble33_sense_accelerometer_continuous’ sketch, which i’d modified
line#25, replace

#include <Arduino_LSM6DSOX.h> //#include <Arduino_LSM9DS1.h>

& line#191, EI_CLASSIFIER_SENSOR_ACCELEROMETER to EL_CLASSIFIER_SENSOR_FUSION.

#if !defined(EI_CLASSIFIER_SENSOR) || EI_CLASSIFIER_SENSOR != EI_CLASSIFIER_SENSOR_FUSION   // EI_CLASSIFIER_SENSOR_ACCELEROMETER
#error "Invalid model for current sensor"
#endif

Any advice from anyone how to run inference with nano rp2040?

I saw that there are the first changes on Github (upgrade to v1.4.17)

LSM6DSOX running
microphone is recording but dont Data in File.

I am working with a Custom RP2040 board and I adapted the new firmware to make it work, also I changed the Inertial sensor code to support mine a (3-axis LIS3DH) and a PDM mic.

1 Like

@mcmchris

what is the right setting for PDM and Microphone Arduino Connect RP2040?
My mic on board running with 20000 Sampling Frequency and 512 SampleBuffer at a Sketch Example.

Is not the same value with BLE33 Board

We now have a full support for Arduino RP2040 connect as well - just follow the instruction in Edge Impulse RP2040 firmware documentation article.

3 Likes

i tested today after my vacation.
Mic is not running :frowning:

I tested again with this Arduino Sketch. My MIC needs 20000Hz not 16000Hz
then is working with SerialPlotter.

Can you check again?

Erm. An official example for using microphone on RP2040 Connect suggests using 16000 Hz frequency. Therefore RP2040 Connect microphone should support this frequency.
If the mic on your board does not support 16000 Hz recording, it means that you likely have a different board.

I found the Bug.
Decimation could be 128 not 64
There is a Codesnippet in PDM.cpp thats set to 64. Why?
I disable then MIC Data send to Edge Impulse.
But only set 16000Hz not 8000Hz the Record is ok.

But there is also a Spike Bug

Is this the Bug?

I will open a Github Issue by Arduino

The PDM library is taken from Arduino mbed core for RP2040. As your rightly pointed, the switch to 64 decimation factor was added by this PR https://github.com/arduino/ArduinoCore-mbed/issues/289
If left at 128 for 16000 Hz sampling rate, the clock frequency would be too high for RP2040 Connect mic.
I have tested the microphone ingestion just now and it works perfectly.


this is for quiet room at 16000 Hz

this is for quiet room at 8000 Hz
Would you like to send pictures of your board to see if it the same revision?
Regardless, if even Arduino Mic Plotter example sketch does not work for you, it is likely an issue on hardware side, that needs to be addressed by Arduino.

i set only decimation = 64 (remove 128 in PDM.cpp) and tested with 8000Hz
Thats running fine!!!

BLE33 MIC running fine with 16000Hz but there are no Filter Setting.

Whats the Problem with the Arduino Connect RP2040 with 16000Hz and 128???

is there any experience of whether 16kHz for audio training is better than 8kHz? I think it depends on the use case

To reiterate - if you look at the code, you’ll see that if you set frequency to 16000 Hz, the decimation rate will be set to 64. If frequency is 8000 Hz, then decimation rate is 128.
The microphone on Connect RP2040 will not support 16000Hz and 128 decimation rate - it exceeds the microphone sampling frequency limit, calculated as sampleRate * decimation * 2.
The problem you’re having is likely hardware one - again, I suggest take it to Arduino team. The best I can do here is to record which hardware do you have exactly.

I found this which also describes my problem.

Maybe the Arduino team’s decision to use the same microphone hardware as the BLE33 Sense wasn’t too good after all. Because the BLE33 works well with 16000Hz, only that unfortunately it does not have a Wifi module. There seems to be boards where it works and which ones where it doesn’t. The Nicla has the MP34DT06J not the MP34DT05 but the same library.

Hello Sir,
Thanks for your previous comment regarding the procedure to make firmware for Nano RP2040. I tried it and I was successful in it. Thanks to you. I have started training the model. However, I am facing one problem. When model training was done, I build library for the model. In that library, I only found nano_ble33_accelerometer. I didn’t found nano_ble33_accelerometer_continuous. Kindly guide me through this.
In addition, could you please tell me why did you change line #191 to EI_CLASSIFIER_SENSOR_FUSION. Kindly reply. Thanks in Advance

Hello @Jatin,

Also adding this reply here: Edge impulse is not providing arduino accerlerometer continious code on build - #4 by louis

nano_ble33_accelerometer_continuous examples will be soon added again. It was a bug on our side.

Best,

Louis

Hi @Jatin, thanks for your message. You can see my write-up in hackster here. The reason I change line #191 to EI_CLASSIFIER_SENSOR_FUSION is because I want to use both accelerometer & gyro data.
As for the continuous example, I had just downloaded the library from my project and there is no continuous example anymore, not sure why EI remove that. But if I recall correctly, I remember that example didn’t work well for my project (forgot whether is run out of memory or just didn’t work). Hopefully EI will reach out to you to answer your question.

Hi - I’m sorry to be confused here. I believe you developed and now support the Arduino RP2040 Connect, and refer to the documentation. The documentation also states full support, but in the same documentation refers support for Arduino Connect to “Raspberry Pi RP2040 - Edge Impulse Documentation”, where it says ‘no support for mic’, for example. The official Pi 2040 firmware does not appear to recognize the Arduino Connect, thinks it’s a Pi board.
I have both boards, but would like to use the Arduino Connect. Do you recommend I continue with the Pi board, or is there a separate build for the Arduino Connect?
Thank you very much!

Hey folks I am a newbie on this and kinda losing my mind trying to get my Adafruit LSM6DSOX ST work on edge impulse. I would really appreciate if you could help me. I am trying to read accelerometer and gyroscope values from Adafruit LSM6DSOX which is connected to Adafruit Feather RP2040. When I make the changes above mentioned in Wire.h, after flashing I get this error -
[SER] Could not find any devices connected over serial port

[SER] Retrying in 5 seconds

Any help would be truly appreciated!

Hi @dataexplorer007,

Did you load the pre-compiled RP2040 firmware from Edge Impulse onto your board? Raspberry Pi RP2040 | Edge Impulse Documentation You need this running on your RP2040 board prior to connect with the Edge Impulse CLI daemon.

Also, note that the firmware listed above only works with the sensors listed here: Raspberry Pi RP2040 | Edge Impulse Documentation. It will not work with the LSM9DSOX. So, you will need to either use an LSM6DS3 or write your own firmware to capture and store samples or switch to an LSM6DS3.

If you write your own firmware, note that you can use the Data forwarder to capture data from the serial and send it to your Edge Impulse project.