Arduino's response returns only raw features from the live classification

Movement classification system using the MPU 6050

All procedures up to development to get the library to arduino were done correctly.

The problem arises when I want to make classifications directly on my arduino, dispensing with the edge (disconnected from the internet). I use the static_buffer code from the test_inferencing example list and paste a raw features according to tutorials I saw on the internet of a live classification, but my system only returns the result of this live classification.

I follow the steps of:
copy raw features here (for example from the ‘Live classification’ page)
see https://docs.edgeimpulse.com/docs/running-your-impulse-arduino

Link project
https://studio.edgeimpulse.com/studio/230997

The figure below shows the problem:

Hello @cnbarros,

When you import your generated Arduino library in your Arduino IDE, we also provide some examples. You can have a look at the nano_ble33_sense.ino example to see how we sample the IMU data:

    // Allocate a buffer here for the values we'll read from the IMU
    float buffer[EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE] = { 0 };

    for (size_t ix = 0; ix < EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE; ix += 3) {
        // Determine the next tick (and then sleep later)
        uint64_t next_tick = micros() + (EI_CLASSIFIER_INTERVAL_MS * 1000);

        IMU.readAcceleration(buffer[ix], buffer[ix + 1], buffer[ix + 2]);

        for (int i = 0; i < 3; i++) {
            if (fabs(buffer[ix + i]) > MAX_ACCEPTED_RANGE) {
                buffer[ix + i] = ei_get_sign(buffer[ix + i]) * MAX_ACCEPTED_RANGE;
            }
        }

        buffer[ix + 0] *= CONVERT_G_TO_MS2;
        buffer[ix + 1] *= CONVERT_G_TO_MS2;
        buffer[ix + 2] *= CONVERT_G_TO_MS2;

        delayMicroseconds(next_tick - micros());
    }

You can replicate and adapt that part with your accelerometer.

Best,

Louis

1 Like

Grateful,
I was simply taking an example that my library generated by edge impulse created.
The correct thing, as you explained, is to read the accelerometer data and invoke the library to classify movements in real time.