Having problems getting Arduino Nano RP2040 Connect to work with EI

Question/Issue:

Having problems trying to get Arduino Nano RP2040 Connect to work with EI

Project ID:

141382

John / [John / JakeOldBoy-project-2]

Context/Use case:

I’m trying to implement a EI project for Predictive Maintenance for machinery using an Arduino RP2040 Connect like the blog article:

Santagostino’s predictive maintenance for HVAC uses Nano RP2040 Connect

I am now using Arduino IDE 1.8.19, and I have successfully been able to compile, upload and run some of the basic Arduino sketches from Arduino IDE 1.8.19 onto my Arduino Nano RP2040 (after slightly modifying the source code to make it obvious that I compiled, uploaded, and run my modified sketch):

Where my Arduino Nano RP2040 Connect is connected via USB on port:

By USB /dev/cu.usbmodem14201
9600 baud

After data acquisition, training, live verification, and then building my EI project ID: 141382 as an Arduino Library zip archive file and have downloaded it to my Mac Laptop.

I then opened the Library for my project above and selected the example program nano_ble33_sense_accelerometer and modified the example source code so that it includes:

/* Includes ---------------------------------------------------------------- */
#include <John_JakeOldBoy-project-2_inferencing.h>
//#include <Arduino_LSM9DS1.h> //Click here to get the library: http://librarymanager/All#Arduino_LSM9DS1
#include <Arduino_LSM6DSOX.h>

When I try to compile this example in Arduino IDE 1.8.19 it takes a really long time, When I upload it to my Arduino Nano RP2040 Connect device I get the following error:

/Users/jpingel/Documents/Arduino/nano_ble33_sense_accelerometer_copy_20221006191321/nano_ble33_sense_accelerometer_copy_20221006191321.ino:151:2: error: #error “Invalid model for current sensor”
#error “Invalid model for current sensor”
^~~~~

which is related to the example source code statements:

#if !defined(EI_CLASSIFIER_SENSOR) || EI_CLASSIFIER_SENSOR != EI_CLASSIFIER_SENSOR_ACCELEROMETER
#error “Invalid model for current sensor”
#endif

What am I needing to do to get this example project to compile, upload and run the inference model? After I am able to get this first project working on my Arduino Nano RP2040 Connect, I want to add an Anomaly block to determine whether the current accelerometer data can be classified as ON, OFF, or an anomaly.

Let me know what other information you need to help troubleshoot this problem!

Thanks,
John Pingel

Louis:

If it’s not obvious what I’m doing wrong, it would help for me an any other developers with Arduino Nano RP2040 Connect devices if you had:

  1. a public EI project that was created for and with an actual Arduino Nano RP2040 Connect that uses a DSP block and at least a NN Classifier block that takes accelerometer sensor data and classifies it
    2 a list of prerequisites like:
    Arduino IDE 1.8.x
    Mbed OS version 3.x.x
    A specific example sketch that is generate from the above public project
    Instructions how to install the above project library zip
    Instructions on exactly which lines of the source code need to be modified from the nano_ble33_sense_accelerometer example (e.g. the include for the RP2040’s IMU
    Any other configurations like loading certain libraries for the RP2040’s IMU, etc

Anyway, I look forward to your recommendations!

Thanks,
John Pingel

Hello @JakeOldBoy,

I do not have an Arduino RP2040 so I cannot reproduce.
I noticed in your impulse that when you collected data, you also registered the gyrX, gyrY, gyrZ.
This should not create an issue as you actually don’t use it but if that’s the case, I’ll file an issue.

Could you to compile this project on the board to see if it runs?

This project comes from a workshop where I used a custom board (still nRF52840 based though):

Best,

Louis

Hello @JakeOldBoy,

I tested your project on my Arduino Nano 33 BLE Sense and I have the same error:

#error “Invalid model for current sensor”

Investigating…

Ok so the project I gave you (the fitness classifier works).

So I am suspecting that the issue comes from the 6 axis used to collect your data.

Can you try to recollect some data using only 3 axis (or remove them by downloading your dataset and parse your data), you can use a simple python code to do that but consider your small dataset size, it will probably be quicker to recollect the data samples.

In the meantime, I will open an internal issue to see how we can fix this.

Best,

Louis

Louis:

Thanks for looking into this issue for me. I’ll try your suggestions later after work tonight.

Thanks,
John Pingel

Louis:

Can you get Jan or others to get several Arduino Nano RP2040 Connects for you and other engineers at EI. Without any discount I purchased mine for US $32. However, I’m sure Arduino reps would make a discount for EI, especially since EI make the RP2040 much more useful!

Thanks,
John Pingel

Louis:

I was able to clone your fitness classifier project, keep your existing training/testing data, regenerate features, retrain your model, and then build it as an Arduino Library ZIP archive.

After unzipping the downloaded Arduino Library ZIP in my arduino/libraries directory, I then opened the example sketch from
Examples >
Clone_of_Louis_-_Fitness_classifier_inferencing >
nano_ble33_sense_accelerometer

Then replaced the include with the one for the Arduino Nano RP2040 Connect’s IMU:

//#include <Arduino_LSM9DS1.h> //Click here to get the library: 
http://librarymanager/All#Arduino_LSM9DS1
#include <Arduino_LSM6DSOX.h>

Then compiled and uploaded the sketch (the compile in Arduio IDE 1.8.19 takes about 3-4 minutes)
Then opened the Tools > Serial Monitor, which seems to show that the project code is running (see the attached screenshot).

1 Like

Louis:

The compile and upload seems to take a long time 3-4 minutes or more. This might be one of my stumbling blocks besides your point about just using AccX, AccY, and AccZ. I
ll try to recreate my project for classifying motion gestures with just the three Acclerometer sensor values.

Later on I think I will try adding a few lines of code that changes the color of the LED light based on the classification:
Classification: LED Color:
upanddown. GREEN
side2side. RED
Anomaly. BLUE
That way the device can indicate how its classifying its current motion without having to view the Serial Monitor. I would like to notify dashboard widgets in the Arduino IOT Cloud about what the device and uploaded program classifies the current motion or anomaly. Ultimately, I would like the program to call REST API to post the device’s current classification/anomaly status.

Let me know if there are good examples of calling a REST API on Arduino Nano RP2040 Connect. I’ll keep you posted on whether I can re-create my project compile and upload it to my device.

Thanks,
John Pingel