BMA180 - sensitivity to vibration?

Post Reply
zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

BMA180 - sensitivity to vibration?

Post by zviratko »

Hi,
for the past few days I've been fighting what I think is a vibration propagating to my BMA180 sensor - I'm using allinone board from CSG (works like charm... apart from this :)

What I see is that once the motors are armed and spinning, accelerometer values start to jump like crazy.

I tried various combinations of vibration dampening, at the moment, the whole sensor board is wrapped in a two side tape and sitting on the center shield, and I removed all rubber pads from under the motors as that was probably foolish thing to do in the first place. There was no change whatsoever, no matter what I do.

I looked into the code and into BMA180 datasheet and there are various options for filtering the output - multiwii changes that (according to code) to 10Hz filter, but even if I change that (comment it out, put in a different value) the behaviour is exactly the same.

Is the 10Hz setting working with all BMA180s? What are other settings to try? It doesn't look like 10Hz updates to me (it really jumps like crazy, +-50 on all axis). Or is this not a problem and all?
I'm not sure how the 10Hz filter is implemented, but from what I read it should average values internally and put the average into the readout.... doesn't look like this is actually happening?

The original line reads:

control = control & 0x0F; // register: bw_tcs reg: bits 4-7 to set bw -- value: set low pass filter to 10Hz (bits value = 0000xxxx)


Also, datasheet says one should not write to EEPROM more than 1000 times - is this just a one-time registry setting or is it getting written to eeprom every time? I guess that would be bad...

Gyro (IDG3200 on the board) is fine, once motors are armed there is a +-2 variation, I thought gyroscope was the element most affected by vibrations?

Any tips?

I do not balance props, for now I'm just assembling/disassembling/assembling the whole thing and just a noob when it comes to flying....

Thanks

zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

Re: BMA180 - sensitivity to vibration?

Post by zviratko »

I just got to this:

viewtopic.php?f=8&t=741&p=4817&hilit=bma180#p4817

patching the code did the trick for ACC (eh?) but magnetometer is all messed up now... heading is inverted when motors are armed, I thought it was "hearing" my ESCs, but RAW data (if I consider MAG ROLL+PITCH+YAW as RAW values) look the same armed/disarmed, so what's happening there?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: BMA180 - sensitivity to vibration?

Post by PatrikE »

Do this check.
http://www.multiwii.com/faq#How_should_be_the_sensor_axis_directions
Mag and Acc should move in same directions.

zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

Re: BMA180 - sensitivity to vibration?

Post by zviratko »

did this a million times, orientation is correct


looks like this part:
control = i2c_readReg(BMA180_ADDRESS, 0x30);
control = control & 0xFC; // Save calibration values but mask out the Mode's 2-bits.
control = control | 0x02; // Select Mode 2.
i2c_writeReg(BMA180_ADDRESS, 0x30, control);


did the whole trick... so it was vibrations after all? Anyway, happy camper now (for now, haven't flown it yet :-))


Another problem which I hit is with the MAG - once motors are armed, heading overflows into negative numbers... somebody not doing 8bit math right? :-)

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: BMA180 - sensitivity to vibration?

Post by mr.rc-cam »

patching the code did the trick for ACC (eh?) but magnetometer is all messed up now... heading is inverted when motors are armed,

The BMA180 code patch should not affect the mag sensor, so that is strange. Are you sure the mag sensor works correctly with the stock code?

Couple things: (1) Make sure the mag sensor is not close to high current (motor, ESC, etc.) wiring, buzzers, magnets, and such. (2) Do the "3D" MAG calibration again. This calibration is important and so pay close attention to the published procedure.

I do not balance props ...

Prop balancing is not an optional task, you must do this if you want your model to fly well with useful PID's. Also, clean the props off every few flights with window cleaner to remove grass stains and bug guts.

zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

Re: BMA180 - sensitivity to vibration?

Post by zviratko »

BMA code patch didn't affect MAG, it looks like something is overflowing now for some reason (I moved, so maybe there is interference somewhere?). This is a separate problem though and maybe a GUI-only error. It also looks like even after calibrating, my MAG is 90 degrees off (indicates east where north is, no matter how many times I calibrate). And it _does_ have good orientation, the problem is only in "heading" and not the RAW values...

I know I should balance props, but it seems to work without it for the moment... I switched to brand new 3-blade props and visible vibrations are gone, I want to solve the software sensor mysteries before I break it...


EDIT: the HEADING error is not in 1.8p2, I was using the latest dev version (201101117).
EDIT2: actually, looks like my MAG sensor doesn't like the interference from my ESCs, so I disregard the "flip" scenario - but the orientation at idle is still wrong in latest dev. This is a separate issue anyways and I do not know how I can solve this reliably - battery is usually below the center of gravity, and all sensors should be put as near to the center as possible... How am I going to do that, I don't know...

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: BMA180 - sensitivity to vibration?

Post by mr.rc-cam »

It also looks like even after calibrating, my MAG is 90 degrees off (indicates east where north is, no matter how many times I calibrate).

I believe that the compass heading issue may have been fixed in one of the new dev releases, but it's not something I care about. This problem does NOT affect the mag feature so don't be concerned at this point. In other words, for mag assisted stability there is no need for GUI North to be the same as Earth North. On the other hand, if you have a dev release that has the fix, and your GUI's compass is wrong, then perhaps your mag orientation is incorrect.

For now, ignore the 90 degree offset you see. If the GUI's 3-D figure and compass follows your relative movements then the mag feature is working. If it is still messed up, and you have correctly performed the 3D mag calibration, then carefully review the sensor's location in the model to ensure it is not affected by nearby offensive items (as described in my previous post).

Just to make sure we are talking about the same thing, please describe the MAG cal procedure you use to calibrate the compass.

BTW, If the mag feature works with arming disabled, but is bad after arming AND motors running, then the mag sensor is probably too close to high current wiring. You don't need much distance to solve such things, just move the heavy wires away from the sensor. If you cannot achieve success then perhaps it is time to post some clear detailed photos of your model so we can see what you've built.

zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

Re: BMA180 - sensitivity to vibration?

Post by zviratko »

I just did a quick-fix, I put a block of heavy plastic foam beneath the sensor (about 4cms) and it doesn't "hear" ESCs now - cool. But it's another 4cms off the center of gravity... Let's see how that works ;-)

I don't fully understand the MAG values, so I thought they were OK, but it looks like even a minor fluctuation makes the calculations go way off and flip the copter 180 degs in the opposite direction.

1.8b2 seems to indicate true north, dev version indicates east... no biggie, just confusing considering the rest of errors I made ;-)


So the only issue is that BMA180 didn't work out of box for me, too much noise in mode 0. I tried mode 1 and it was not much better, mode 2 made it all go away (that's what the patch does originally), and just tried mode 3 and it also looks good (mode 3 is undocumented I think). Part of the confusion was also in assuming that all the mode changes were temporary and will be gone after uploading new multiwii code, but apparently they survive arduino reset until you unplug everything... That made me assume disabling MAG fixed my ACC (because I just reverted the patch and commented MAG out...).

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: BMA180 - sensitivity to vibration?

Post by mr.rc-cam »

So the only issue is that BMA180 didn't work out of box for me, too much noise in mode 0.

Excess roll and pitch ACC noise with mode 0 probably was a hint that the props are not balanced. Or perhaps you tested it while the model was still on the floor instead of held tightly in your hand. Or perhaps a little of both.

but it looks like even a minor fluctuation makes the calculations go way off and flip the copter 180 degs in the opposite direction.

What is your procedure for calibrating the mag sensor?

zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

Re: BMA180 - sensitivity to vibration?

Post by zviratko »

mr.rc-cam wrote:
So the only issue is that BMA180 didn't work out of box for me, too much noise in mode 0.

Excess roll and pitch ACC noise with mode 0 probably was a hint that the props are not balanced. Or perhaps you tested it while the model was still on the floor instead of held tightly in your hand. Or perhaps a little of both.


I tested both on the floor and in hand, and I also tried hovering it... very erratic behaviour to say the least, that's why I asked if this was "expected" (I thought there might be an averaging filter or something..). Most people deal with gyro noise, not ACC noise, am I right? There will always be some noise anyways. I'm not going to make steadyshots from the quad, I just want it to fly and hold - that's what filtering is for ;)

mr.rc-cam wrote:
but it looks like even a minor fluctuation makes the calculations go way off and flip the copter 180 degs in the opposite direction.

What is your procedure for calibrating the mag sensor?


I rotate it around all 3 axis and then draw 888888 in the air just like in-phone mag is calibrated. It works very well now. But it was all just ESC noise after start - it made consistent, but errorneous readouts in my case, and they have shown just as a minor noise on the graphs in GUI so I didn't take it too seriously (and I yet have to take propeller vibratiouns seriously :-))

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: BMA180 - sensitivity to vibration?

Post by mr.rc-cam »

I rotate it around all 3 axis and then draw 888888 in the air just like in-phone mag is calibrated. It works very well now.

Ok, sounds good. You had me worried when you said that minor fluctuations made the calculations go way off and flip the copter 180 degs in the opposite direction. That is why I asked about the calibration method being used.

zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

Re: BMA180 - sensitivity to vibration?

Post by zviratko »

Thank you :-)

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: BMA180 - sensitivity to vibration?

Post by jevermeister »

Hi, are you using the 1.7 stability mode in the dev version?

This code also affects the mag.

I had true north with the mag in 1.8 and 1.8p2 but with the stability mode imported into 1.8p2 my mag is showing east when it is heading north.
I believe this is a mistake in the old 1.7 code (the mag code was very new by that time)
Maybe Alexinparis can say something?

BTW.: My mag is going crazy too when I throttle up, can you post a pic of your solution?
#

Nils

zviratko
Posts: 50
Joined: Sat Oct 15, 2011 4:49 pm

Re: BMA180 - sensitivity to vibration?

Post by zviratko »

I tried the newest (yesterdays :-) -dev version and magnetometer heading is fixed.

I was able to fly without major problems with my 3-blade rotors. Then switched to 2blade rotors and they just produced to much vibration...

I had to take the sensors from the foam block and disabled magnetometer altogether to make it work.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: BMA180 - sensitivity to vibration?

Post by Alexinparis »

Hi,
I don't know exactly what is the problem, but one thing for sure:
- the MAG function can only interfere with the yaw correction. It has nothing to do with PITCH/ROLL correction.

MAG & ACC share only the same function for calculation, but not for attitude correction

Post Reply