Unable to get project to compile with Arduino IDE 1.8.19

Question/Issue:

Project ID:

Project Name: John/FanPredictiveMaintenance

Project ID 145677

Context/Use case:

Created project for FanPredictiveMantenance using DSP (FFT and PSD) with NN Classifier (4 classes) and K-means Anomaly Detection.

BTW, Andrea Codini gave a really helpful hint to get the latest firmware loaded onto my Arduino Nano RP2040 Connect when it has been not letting me download the ei_firmware_rp2040.uf2 bootable file:

I’ve a little trick for you for the firmware.
Connect the board to the computer
go to Arduino IOT Cloud and create a free profile
go to add device and add a new device
then Arduino IOT Cloud will boot a the latest firmware on the board after that the board is fine!

Doing the above actually enabled me to re-download my local build of the firmware:

 ei_rp2040_firmware.uf2

Before trying Andrea’s suggestion I could go into the bootloader mode and see the USB HD:

 /Volumes/RPI-RP2/

However; I could not copy the UF2 file to the USB HD.

After un-plugging and re-plugging my Arduino Nano RP2040 COnnect, I was able to startup the EI CLI tool:
edge-impulse-daemon --clean
Once that CLI was connected to EI logged on am me, I was able to create the new project listed above and start acquiring accelerometer data for training, testing, live verification.
Then I clicked on the Deployment tab and selected the Build Arduino Library button. I then copied the related ZIP archive to my Documents/Arduino/libraries folder and unzipped the ZIP library. Then after openning Arduino IDE 1.8.19 I opened the examples under:

Files > Examples > FanPredictiveMaintenance_inferencing > nano_BLE33_sense_accelerometer_continuous

then replaced the include for the IMU on the Arduino Nano RP2040 Connect:

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

Then selected Compile and got the following error message:

“Invalid model for current sensor”
#error “Invalid model for current sensor”
^~~~~
exit status 1
#error “Invalid model for current sensor”

which is related to the following source code lines:

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

So what is configured wrong with my project???

Thanks,
John Pingel

Louis or others at EI:

I looked at the source code for my downloaded Arduino Library ZIP, in particular model_metadata.h:

#define EI_CLASSIFIER_SENSOR EI_CLASSIFIER_SENSOR_FUSION
#define EI_CLASSIFIER_FUSION_AXES_STRING “accX + accY + accZ + gyrX + gyrY + gyrZ”

I tried replacing the above 2 lines with:

#define EI_CLASSIFIER_SENSOR EI_CLASSIFIER_SENSOR_ACCELEROMETER
#define EI_CLASSIFIER_FUSION_AXES_STRING “accX + accY + accZ”

but my project in Arduino IDE 1.8.19 now fails to compile with the error message:

In file included from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_model_types.h:28:0,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h:26,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h:28,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/FanPredictiveMaintenance_inferencing.h:55,
from /Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:24:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/dsp/numpy.hpp: In static member function ‘static int ei::numpy::welch_max_hold(float*, size_t, float*, size_t, size_t, size_t, bool)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/dsp/numpy.hpp:2374:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while (input_ix < input_size) {
~^~~~
In file included from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/dsp/spectral/spectral.hpp:28:0,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_dsp.h:27,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h:28,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/FanPredictiveMaintenance_inferencing.h:55,
from /Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:24:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/dsp/spectral/feature.hpp: In static member function ‘static int ei::spectral::feature::extract_spectral_analysis_features_v2(ei::matrix_t*, ei::matrix_t*, ei_dsp_config_spectral_analysis_t*, float)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/dsp/spectral/feature.hpp:425:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < data_size; i++) {
^~~~~~~~~
In file included from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/tflite_eon.h:37:0,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h:61,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/FanPredictiveMaintenance_inferencing.h:55,
from /Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:24:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h: In function ‘bool ei_cube_check_overlap(ei_classifier_cube_t*, int, int, int, int, float)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:45:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
bool is_overlapping = !(c->x + c->width < x || c->y + c->height < y || c->x > x + width || c->y > y + height);
^
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:45:69: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
bool is_overlapping = !(c->x + c->width < x || c->y + c->height < y || c->x > x + width || c->y > y + height);
~^
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:45:81: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
bool is_overlapping = !(c->x + c->width < x || c->y + c->height < y || c->x > x + width || c->y > y + height);
~^

/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:45:101: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
bool is_overlapping = !(c->x + c->width < x || c->y + c->height < y || c->x > x + width || c->y > y + height);
~^
~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:49:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (x < c->x) {
^
~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:55:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (y < c->y) {
^
~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:61:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (x + width > c->x + c->width) {
^

/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:66:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (y + height > c->y + c->height) {
~^
~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h: In function ‘void fill_result_struct_from_cubes(ei_impulse_result_t*, std::vector<cube*>, int, uint32_t)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:152:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(added_boxes_count < object_detection_count) {
^~~~~~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h: In function 'void fill_result_struct_f32_fomo(const ei_impulse_t
, ei_impulse_result_t*, float*, int, int)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:172:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t y = 0; y < out_width; y++) {
^~~~~~~~~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:174:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t x = 0; x < out_height; x++) {
^~~~~~~~~~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:177:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t ix = 1; ix < impulse->label_count + 1; ix++) {
~^~~~~~~~~~~~~~~~~~~~~~~~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h: In function ‘void fill_result_struct_i8_fomo(const ei_impulse_t*, ei_impulse_result_t*, int8_t*, float, float, int, int)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:193:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t y = 0; y < out_width; y++) {
^~~~~~~~~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:195:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t x = 0; x < out_height; x++) {
^~~~~~~~~~
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_fill_result_struct.h:198:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t ix = 1; ix < impulse->label_count + 1; ix++) {
~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/FanPredictiveMaintenance_inferencing.h:55:0,
from /Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:24:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h: In function ‘EI_IMPULSE_ERROR {anonymous}::run_impulse(ei_impulse_result_t*, mbed::Callback<void(float*, unsigned int)>, bool)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h:779:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < impulse.dsp_input_frame_size; i += impulse.raw_samples_per_frame) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino: In function ‘void run_inference_background()’:
fan_PM_nano_rp2040_accelerometer_continuous:103:5: error: ‘ei_classifier_smooth_t’ was not declared in this scope
ei_classifier_smooth_t smooth;
^~~~~~~~~~~~~~~~~~~~~~
/Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:103:5: note: suggested alternative: ‘ei_classifier_cube_t’
ei_classifier_smooth_t smooth;
^~~~~~~~~~~~~~~~~~~~~~
ei_classifier_cube_t
fan_PM_nano_rp2040_accelerometer_continuous:104:32: error: ‘smooth’ was not declared in this scope
ei_classifier_smooth_init(&smooth, 10 /* no. of readings /, 7 / min. readings the same /, 0.8 / min. confidence /, 0.3 / max anomaly */);
^~~~~~
/Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:104:32: note: suggested alternative: ‘short’
ei_classifier_smooth_init(&smooth, 10 /* no. of readings /, 7 / min. readings the same /, 0.8 / min. confidence /, 0.3 / max anomaly */);
^~~~~~
short
fan_PM_nano_rp2040_accelerometer_continuous:104:5: error: ‘ei_classifier_smooth_init’ was not declared in this scope
ei_classifier_smooth_init(&smooth, 10 /* no. of readings /, 7 / min. readings the same /, 0.8 / min. confidence /, 0.3 / max anomaly */);
^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:104:5: note: suggested alternative: ‘ei_classifier_cube_t’
ei_classifier_smooth_init(&smooth, 10 /* no. of readings /, 7 / min. readings the same /, 0.8 / min. confidence /, 0.3 / max anomaly */);
^~~~~~~~~~~~~~~~~~~~~~~~~
ei_classifier_cube_t
fan_PM_nano_rp2040_accelerometer_continuous:134:34: error: ‘ei_classifier_smooth_update’ was not declared in this scope
const char *prediction = ei_classifier_smooth_update(&smooth, &result);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:134:34: note: suggested alternative: ‘ei_classifier_anom_scale’
const char *prediction = ei_classifier_smooth_update(&smooth, &result);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
ei_classifier_anom_scale
fan_PM_nano_rp2040_accelerometer_continuous:152:5: error: ‘ei_classifier_smooth_free’ was not declared in this scope
ei_classifier_smooth_free(&smooth);
^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:152:5: note: suggested alternative: ‘ei_classifier_anom_mean’
ei_classifier_smooth_free(&smooth);
^~~~~~~~~~~~~~~~~~~~~~~~~
ei_classifier_anom_mean
In file included from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/ei_run_classifier.h:61:0,
from /Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/FanPredictiveMaintenance_inferencing.h:55,
from /Users/jpingel/Documents/Arduino/fan_PM_nano_rp2040_accelerometer_continuous/fan_PM_nano_rp2040_accelerometer_continuous.ino:24:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/tflite_eon.h: In function ‘EI_IMPULSE_ERROR run_nn_inference(const ei_impulse_t*, ei::matrix_t*, ei_impulse_result_t*, bool)’:
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/tflite_eon.h:257:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
}
^
/Users/jpingel/Documents/Arduino/libraries/FanPredictiveMaintenance_inferencing/src/edge-impulse-sdk/classifier/inferencing_engines/tflite_eon.h:259:9: note: here
default: {
^~~~~~~
exit status 1
‘ei_classifier_smooth_t’ was not declared in this scope

So, … what project settings do I need to correct/change to make this project successfully compile, download and run on my Arduino Nano RP2040 Connect device?

Thanks,
John Pingel

My compile error looks similar to the following Report Bugs topic:

Arduino BLE Sense libraries "invalid model for current sensor"

Where my project example code has in its meta_data.h include file the following defined:

#define EI_CLASSIFIER_SENSOR EI_CLASSIFIER_SENSOR_FUSION
#define EI_CLASSIFIER_FUSION_AXES_STRING “accX + accY + accZ + gyrX + gyrY + gyrZ”

which thinks that both accelerometer XYZ AND gyro XYZ sensor data is to be used, whereas on the DSP block I selected only to use accelerometerXYZ sensor data. How are both accelerometer AND gyro sensor data chosen for this project? Is this bug? Are there detailed configuration pages that allow one to edit these type of settings?

Thanks,
John Pingel

Hello @JakeOldBoy,

Unfortunately, I cannot reproduce your issue yet.
I just ordered a Arduino Nano RP2040 Connect, I should receive it in a couple of days.

Best,

Louis

Louis:

Thank you for responding. The hackathon that I’m trying to use EI with an Arduino Nano RP2040 Connect is during the 3 next days. Any idea how I can recreate the project and it properly use the EI_SENSOR_ACCELEROMOTER with just accelerometer X,Y and Z but no gyro sensor values?

I did try to comment out the defines related to the EI_SENSOR_FUSION related values… see my earlier posts on this topic. but I started getting other compile errors relating to:

‘ei_classifier_smooth_t’ was not declared in this scope

…again see the earlier posts on this topic.

Let me know if you have any ideas for potential solutions to these compile errors.

Thanks again!
John Pingel