Arduino Nano 33 BLE analog data collection via edge-impulse-daemon

Question/Issue:
Hi, I would like to know if it is possible to collect analog data via the browser and edge-impulse-daemon to train a model. I need to sample A0 (it has an analog microphone connected to it) in the arduino and train a model based on that or do I need to manually write the data to a file and then upload it?

Hello @letsgo00,

I don’t think we have a default A0 reading in the Edge Impulse default firmware for the Arduino Nano 33 BLE Sense.
You can use the Data Forwarder to do that which should be pretty straight forward. Just print your analog value at a regular time interval on the serial console.

I would do something like that (I have not tested this piece of code though)

#define FREQUENCY_HZ        50
#define INTERVAL_MS         (1000 / (FREQUENCY_HZ + 1))

static unsigned long last_interval_ms = 0;

int sensorPin = A0; 
int sensorValue = 0;

void setup() {
    Serial.begin(115200);
    Serial.println("Started");
}

void loop() {
    
    if (millis() > last_interval_ms + INTERVAL_MS) {
        last_interval_ms = millis();

        sensorValue = analogRead(sensorPin);
        Serial.println(sensorValue);
   
    }
}


Regards,

Louis
1 Like