Arduino nano 33 ble sense rev2 not working without serial monitor

I am making a device that can sense abnormal lung sounds through EdgeImpule ML, currently it is working ok when the serial monitor is on. My main concern is that it doesnt work without it and doesnt proceed with the program.

Ive seen some topics about it saying that this code below is whats causing it:

image

I would love to hear insights on how this can be fixed, the arduino nano is also working with an ESP32, and is getting powered by a powerbank.

Did you try what the comment suggests and comment out the wait?

1 Like

void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
//unsigned int to = 1000;
//while (!Serial && --to) {
delay(1);
//}
//while (!Serial);
Serial1.begin(9600);
//while (!Serial1);

// comment out the below line to cancel the wait for USB connection (needed for native USB)
//while (!Serial);
Serial.println("Edge Impulse Inferencing Demo");

lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("SOUND SENSE");
delay(2000);

// summary of inferencing settings (from model_metadata.h)
ei_printf("Inferencing settings:\n");
ei_printf("\tInterval: %.2f ms.\n", (float)EI_CLASSIFIER_INTERVAL_MS);
ei_printf("\tFrame size: %d\n", EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE);
ei_printf("\tSample length: %d ms.\n", EI_CLASSIFIER_RAW_SAMPLE_COUNT / 16);
ei_printf("\tNo. of classes: %d\n", sizeof(ei_classifier_inferencing_categories) /
sizeof(ei_classifier_inferencing_categories[0]));

run_classifier_init();
if (microphone_inference_start(EI_CLASSIFIER_SLICE_SIZE) == false) {
ei_printf("ERR: Could not allocate audio buffer (size %d), this could be due to the window length of your model\r\n", EI_CLASSIFIER_RAW_SAMPLE_COUNT);
return;
}

for (int ix = 0; ix < MAX_SOUNDS; ix++) {
pinMode(NEW_PIN[ix], OUTPUT);
}
}

Currently I commented the thing it suggested but after uploading it there was a problem it said that the PDM failed to start.

image

There was a change though since when I use an External Power Source it would not display anything, this time when I comment out the wait it displayed "SOUND SENSE" but it only reached to that point and as the photo above shows it doesnt give me the classifications anymore

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