Hi all,
I have an imu on a pendulum and I am recording the angle with respect of vertical. The frequency and the amplitude is not constant. The sample rate is 10 Hz more. I am noticing that if I record for more time I will see some noise. The sensor is calibrated. Thus, I don't associate this behaviour to a drift, even more because I guess that the drift shall be is one only direction.
Is there some way to have a range of excurcion more constant? I used a moving average filter but with not success (in the image it is the red line and has the same behaviour of the blue line) :
void setup() {
Serial.begin(9600);
}
int const fsize = 50;
int fil[fsize];
int i = 0;
float avg = 90;
void loop() {
int s = analogRead(A0);
fil[i] = s;
if (i < (fsize-1)) i++;
else i = 0;
for (int j = 0; j < fsize; j++) {
avg += (float)fil[j];
}
avg = avg / (float)(fsize+1);
Serial.print(s);Serial.print(",");Serial.println(avg);
delay(10);
}
And what speed is the pendulum going?
I suspect you are not seeing noise, this just looks like the pendulum movement.
If you want to find the maximum excursion then search for a maximum or minimum and reset on the zero crossing point.
This is a project i did with pendulums some time ago.
The speed is 4km/h. The behaviour is that of a pendulum but in the reality, the imu is on the thigh of a person who walks on tapis roulant. The periodicity of oscillation is weird. Anyway I guess that it shall be a method to standardize the maximum and the minimum. What do you think?
this is the imu. For sure it can feel movement artefacts. but the angle is computed in order to have a constant behaviour. Indeed this trend is figuring only when a lot of time is passed (only one minute) and it has a kind of periodicity.
I have had a play with one of these some time ago and couldn't get it to calibrate correctly, and couldn't get much sense out of it. So I can't help with this sorry.
The human thigh is not a good conductor of movement. There is too much flesh that moves in non-determinate ways. Just above the kneecap is probably the best location for mounting an IMU on the thigh. The bone is near the surface so provides fairly good conductance of movement of the thigh.
the serial prints are adding additional delay. print the the samples only when the array index wraps
int const fsize = 50;
int fil[fsize];
int i = 0;
void loop()
{
fil [i++] = analogRead (A0);
if (i >= fsize) {
for (unsigned n = 0; n < fsize; n++)
Serial.println (fil [n]);
Serial.println ();
i = 0;
}
delay(10);
}
void setup() {
Serial.begin(9600);
}
also verify the data without any movement and then with very slow movement
what exactly is you input? angle, distance, acceleration