- Sat Jul 04, 2015 1:54 pm
#183148
I have the Redbot kit and I'm trying to use the accelerometer. It seems like vibrations make the readings almost meaningless. Below are my code and some outputs in various configurations. For all of these runs, I had the Redbot standing upright so the wheels are spinning in the air. For the 'isolated' case, I took the accelerometer off the board, connected it with wires and held it with a 'third hand'.
I can get good readings (+- 0.003g) with the motors turned off, but with the motors running full blast, there are huge fluctuations (+-1g). Isolated is better but still not usable (+-0.3g).
I'd love to have a low pass filter to smooth the data. The data sheet provides a number of settings for a high pass filter. There is mention of a low pass filter for motion detection, but I think this mode provides only minimal info about the motion, like which axis triggered. I thought maybe changing the 'output data rate' would do averaging, but it didn't help.
So am I doing something wrong? Are accelerometers at all useful for autonomous vehicles? Are there better devices out there with smoothing features?
My code:
I can get good readings (+- 0.003g) with the motors turned off, but with the motors running full blast, there are huge fluctuations (+-1g). Isolated is better but still not usable (+-0.3g).
I'd love to have a low pass filter to smooth the data. The data sheet provides a number of settings for a high pass filter. There is mention of a low pass filter for motion detection, but I think this mode provides only minimal info about the motion, like which axis triggered. I thought maybe changing the 'output data rate' would do averaging, but it didn't help.
So am I doing something wrong? Are accelerometers at all useful for autonomous vehicles? Are there better devices out there with smoothing features?
My code:
Code: Select all
Some output:
#include <RedBot.h>
RedBotMotors motors;
RedBotAccel accelerometer;
void setup(void)
{
Serial.begin(9600);
motors.drive(255);
}
void loop(void)
{
accelerometer.read();
int x = accelerometer.x;
Serial.println(x);
delay(2000);
}
Code: Select all
Motors off, accelerometer on redbot
16416
16400
16336
16416
16432
16384
16368
16432
Motors on 100, accelerometer on redbot
17248
12640
15808
18992
15072
19232
17136
11856
18528
13968
14352
15600
17008
Motors on 255, accelerometer on redbot
6848
23424
19440
4272
16176
23952
1280
25936
23136
29408
5072
32752
Motors on 255, accelerometer isolated
18304
15120
18848
16304
18272
14800
16544
20304
15904
14400
16240
17088
13440
17888
10800