Skip to content

Data-forwarder in CLI Potentially Buggy When Detecting Frequency #41

@floftus-at-csm

Description

@floftus-at-csm

Current set up:
Arduino Uno with Gyroscope and Accelerometer printing to the serial. Baud Rate 115200. Frequency set at 50Hz
Macbook running Big Sur OS

When I run edge-impulse-data-forwarder I get this error:

[SER] Detecting data frequency...
[SER] Failed to get information off device No valid sensor readings received from device. Note that the data forwarder can only auto-detect frequencies >2Hz. You can override the frequency via --frequency

When I run edge-impulse-data-forwarder --frequency 50 I get the same error

When I run edge-impulse-data-forwarder --frequency 1 this runs and I get this message:

[SER] Detected data frequency: 21.6Hz
[SER] Sampling frequency seems to have changed (was 50Hz, but is now 21.6Hz), re-configuring device.

[SER] Detecting data frequency...
[SER] Detected data frequency: 50Hz
? 6 sensor axes detected (example values: [13292,7764,3552,-3216,-72,-113]). Wha
t do you want to call them? Separate the names with ',': a_x,a_y,a_z,g_x,g_y,g_z


[SER] Overriding frequency to 1Hz (via --frequency)

So I can currently only run the program if I override the frequency to 1hz. Is this a limitation with my setup or a problem in the frequency detection of Edge Impulse?

Thanks!

btw my arduino code looks like this

#include <Wire.h>
const int MPU = 0x68;
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;
#define CONVERT_G_TO_MS2 9.80665f
#define FREQUENCY_HZ 50
#define INTERVAL_MS (1000 / (FREQUENCY_HZ + 1))

static unsigned long last_interval_ms = 0;
void setup() {
  Wire.begin();
  Wire.beginTransmission(MPU);
  Wire.write(0x6B);
  Wire.write(0);
  Wire.endTransmission(true);
  Serial.begin(115200);
}
void loop() {
  if (millis() > last_interval_ms + INTERVAL_MS) {
    last_interval_ms = millis();
    Wire.beginTransmission(MPU);
    Wire.write(0x3B);
    Wire.endTransmission(false);
    Wire.requestFrom(MPU, 12, true);
    AcX = Wire.read() << 8 | Wire.read();
    AcY = Wire.read() << 8 | Wire.read();
    AcZ = Wire.read() << 8 | Wire.read();
    GyX = Wire.read() << 8 | Wire.read();
    GyY = Wire.read() << 8 | Wire.read();
    GyZ = Wire.read() << 8 | Wire.read();

    // Accelerometer
    Serial.print(AcX);
    Serial.print(",");
    Serial.print(AcY);
    Serial.print(",");
    Serial.print(AcZ);
    Serial.print(",");
    // Gyroscope
    Serial.print(GyX);
    Serial.print(",");
    Serial.print(GyY);
    Serial.print(",");
    Serial.println(GyZ);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions