BMP085

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

BMP085

Post by PatrikE »

I´we done some experiments on
Altitudehold with the BMP085 Barometer

It´s not easy to Get it to work perfekt.
In the MWiiGui it´s pssible to se that it´s drifting in height +/- 1 meter while standing on the table.
Is mine faulty or isn´t the presition better?

I´we modified the code so it´s working as god as one can expect.
The Althold works pretty god when it´s free from the groundeffect.

The areas i´we changed is clearly marked.
The configuation varibles is placed in the
/****CONFIGURABLE PARAMETERS****/

If diffZ is to high it will bounce up & down. To low will make it lame.
limitTH Will limit the throttlerange the baro is allowed to work in.

When Baromode is enabled
It creates a "dead" span on the trottlestick To let the Baro work undisturbed.
Move throttlestick outside the span and the MWii will ove up or down.
Move stick within the span and it will return to Altitudehold.

/PatrikE
Attachments
MultiWiiV1_7_althold.rar
(21.47 KiB) Downloaded 278 times

JussiH
Posts: 39
Joined: Thu Jan 20, 2011 1:16 am

Re: BMP085

Post by JussiH »

Good work...

I have been playing with althold on my Mikro quad and the 50cm quad and 1.7

On the mikro it stays inside a window of about 1-2 meters. On the larger quad the window is 4-6 meters....

I will try this out one of the coming days!

In a future version, can we make the Althold MK-style:

Althold is tied to throttle stick when activated. Midstick is hold. Down the stick to descend, up the stick to ascend.

Thanks

Jussi

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

I have also mad some changes.

If you change this paramter you can change the sensibliyty of the barometer:

I do not test your code because I have no time.

But I have changed the origianl Code
http://www.rcgroups.com/forums/showpost ... ount=13813

I geht sometimes good results, and sometimes I get bad results (resonance frequency), but I don´t know why.

JussiH
Posts: 39
Joined: Thu Jan 20, 2011 1:16 am

Re: BMP085

Post by JussiH »

Hi Patrik and Druckgott..

Thanks for these additions. Sadly none of these mods work with the latest dev version.

Is there anyway this can integrated into the Dev version? I really like the magneto calibration and the new angle calc in the dev version....

I am seeing the same as you having having tested a ridiculous amount of BMP sensors now. It seems that there is more drift at lower temperatures, though...So maybe something in the temp -> pressure calculations is causing this! But I think that we should not expect more than about 1 meter accuracy with this sensor and the current code....(even though Bosch states it should be accurate to 14CM with oversampling)

To me 1 meter is absolutely fine, though. The key is to get to get the response smoothened out, so we dont get the up and down oscillations....
Thanks

Jussi

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

I think another problem is that the barometer works at 400 MHZ, but if you read the values, there are 2- 6 values which are all the same.
Example: you get an altitude: (copter standing on the table without running motors)
1
1
1
1
-3
-3
6
6
6
6
7
0
0
.
.
.
so if you use a PID actuator you have the problem what you have 3 times the same value then the pid actuator don´t work perfekt

I think we should use not all the values. We should you every third value or so.
Or we should build some arithmetic average over 20 values but there is the same problem.

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

i tried your mod druckgott, but it doesn't work for me...only one time at high altitude it worked for a while...
what i have to change? what do your values if changed?

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

Re: BMP085

Post by PatrikE »

The big problem is the difference in the values.
-3
-3
6
6
6
6
7

Between -3 an 7 is a difference of 1 meter!. :(

Jussi....
I have added my Hack i integrated into the Dev version.
I´m at work so i can´t test it, but feel free to test it on your own risk... ;)

I will test it to morrow.

/Patrik

*Edit Removed old link.*

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

PatrikE wrote:The big problem is the difference in the values.
-3
-3
6
6
6
6
7

Between -3 an 7 is a difference of 1 meter!. :(


It´s only an example that you see there are comming 2 ore three times the same number

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

arnaldo wrote:i tried your mod druckgott, but it doesn't work for me...only one time at high altitude it worked for a while...
what i have to change? what do your values if changed?


By me it also do not work eavry time. Somtimes it work somtimes I gad bad results, I don´t know why

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

Re: BMP085

Post by PatrikE »

druckgott. Your Example was realistic.Thats the problem... :(


I have tested the code and made som adjustments in it.

It´s now flyable.
I can fly eights & Squares at 2meters height within +/- 0,5m (Hands off ThrottleStick)
But there is some "dips" probably caused by the baro where it looses 1m.
It recovers without assistace.

I´we tried to do it the MK-Way but can´t get a god resault with it.
Concentrating on getting the hold function to work first.

/Patrik
Attachments
MultiWii_dev_110504.rar
(26.72 KiB) Downloaded 262 times

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

Could be where any posibility to combine this this this an acceleromtert, so the copter nows if it is going down. So this will help the barometer to get besser relults.

Whis NK or motion plus?

What do you mean to combine this.

I have also make some changes in the code and implement a average value and an pid actuator, but I can´t test it now. I will test it on the weekend.

druckgott

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

Hello patrick...i tried your mod(first post) and it works with default parameter....i have a 0,5m of amplitude and sometimes 1meter...
can i try to change the first parameter??? i have to improve of 1 unit or much? how this parameter works?

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

Re: BMP085

Post by PatrikE »

Hi arnaldo,
Glad it works for you.. :D

The first parameter is an amplifier and increases the correction.
Increase by 1 unit at a time. (I started testing at 1.05 )
I tried 5 and 10 also.
At 10 it was overshooting... I think maximum 6-7 is ok.

But try the Dev version it became better i think.
Made some more adjustments to it.

The 1 meter deviations depends on the baro.
If you look in the MultiWiiGUIf it´s possible to se that the altitude changes when the MultiWii sits on the table.
The GUI presents the altitude in dm.

/Patrik

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

ok...i will try it soon as possible....i see parameter 3 and 600?!?!?!?! woow....

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

Re: BMP085

Post by PatrikE »

Open MultiWii_dev.pde with Arduino.
It will open all the PDE-files and h-file.
Change the settinngs in config.h.
Upload the sketch. All files will be loaded in the board.

You can use the MultiWii_dev-gui from SVN
http://code.google.com/p/multiwii/source/browse/trunk/dev_version/MultiWii_dev20110504.zip

/Patrik

User avatar
BlueAngel
Posts: 30
Joined: Sun Feb 27, 2011 11:35 am

Re: BMP085

Post by BlueAngel »

The Plejad Celaeno Copter does use the BMP085 too.
I haven't tested it, but i hope i can do it at the weekend.

One important thing, which is in the manual of the Celaneo Copter is, that the sensor should be mounted with some foam material and dark heatshrink.
1. to reduce wind effects of props.
2. to block light

that should help to get better values.

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

mine is uder arduint that is in a capsule :D no wind...no light

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

arnaldo wrote:mine is uder arduint that is in a capsule :D no wind...no light

same as my ;-)

JussiH
Posts: 39
Joined: Thu Jan 20, 2011 1:16 am

Re: BMP085

Post by JussiH »

Guys, I can see you are making headway with this...I am setting up to try the dev version now! I know Alex is working a Z-accel integration to the height hold function....

I stumbled on this over on Youtube - Kalman filtering for BMP O85. It looks interesting, but I am clueless as to whether or not we can afford to use more cycle time for additional filtering:

http://www.youtube.com/watch?v=_LfHF2D5 ... re=related

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

hi patrick...why with your dev version baro and magneto work....with original dev...they work in gui...but not in flight... :shock:

however magneto also in your dev works badly....when i pitch or roll the arrov in gui turn...

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

Hallo PatrikE, today I testet the dev version with your inclution.

But if I switch on the altitude mod, the copter falls down like a stone.

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

Hi,

today I have tested the first version from here and the second dev version.
The first one works preaty good i only have an ampitude abound 1 meter.

the dev version don´t work If I switch to altitude mod, the copter falls downl like a stone because the motors are going down with the rpm.

My version I will test the nex days

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

i tried the first and the last dev....
they work...
i don't know why in the original dev(alex dev) in the gui baro and compass work...but in flight when i switch them they don't work :shock:

i think the best value is 2.... and when you switch baro you have to be stationary in altitude otherwise the quad start to rising and falling in resonance

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

Re: BMP085

Post by PatrikE »

Althold-mod works best if it´s activated from a stationaty altitude.

The position of throttlestick and altitude is memorised and creates a dead span around that position.
If throttle is moved outside the span it will rise or decsend.
When moved back in the dead span it will try to recover the height where althold was activated.

If throttle is riced to much it will rice rapidly at MAXTHROTTLE.
If throttle is lowered to much it will go to MINTHROTTLE and fall like a stone.( Unwanted Behavior)

I havn´t done anything with the Mag as far as i now.
Hope my mod dont affect it.

/Patrik

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: BMP085

Post by IceWind »

Currently my FTDI device is acting weird so I can't program the arduino and test this.

But one of the things I wanted to try was to prevent the temperature to be read on each cycle.
Some of the comments I've read is that it's readings aren't smooth and it has noise causing/inflating the results
when combined with pressure values.

So basically the idea was to read it once on init and use the same constant value from there on. As here the idea is not
to determine the exact altitute this doesn't seem to be of any problem.

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

PatrikE wrote:If throttle is riced to much it will rice rapidly at MAXTHROTTLE.
If throttle is lowered to much it will go to MINTHROTTLE and fall like a stone.( Unwanted Behavior)


Ok but I have the stick on a postion witch on the baro and then the copter falls down.

Not after moving the stick

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

druck....have you tried original DEV? baro and magneto work in flight? mine work in gui but not in flight...

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

Re: BMP085

Post by Alexinparis »

arnaldo wrote:druck....have you tried original DEV? baro and magneto work in flight? mine work in gui but not in flight...

It's a small bug in the last dev: baro and mag switch have no effect.
I will correct it in a next dev (maybe today)

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

Re: BMP085

Post by PatrikE »

Druck...
This is the DEV version i made the mod in.
http://wbb.multiwii.com/download/file.php?id=142
It´s build from orginal DEV from Alex.
That version works for me and arnoldo.
Make shure thats the one you test.

I have not tried the last dev from svn yet.

/Patrik

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

Hi,

yesterday I have crashed my Quadcopter at to much loopings ;-) so one motor is dead.

But I have orderd a new one yesterday. I hope I will have it for next weekend. Then I will test this dev version.

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

Re: BMP085

Post by PatrikE »

druckgott wrote:Hi,

yesterday I have crashed my Quadcopter at to much loopings ;-) so one motor is dead.


Hey. You still have 3 motors... :mrgreen:
Rebuild it to a tricopter... :idea:

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

with the last dev...5008...baro seems to work badly...it spin up 2 3 times and go into the stratosphere...
also compass works badly on pitch and roll axes....

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

PatrikE wrote:
druckgott wrote:Hi,

yesterday I have crashed my Quadcopter at to much loopings ;-) so one motor is dead.


Hey. You still have 3 motors... :mrgreen:
Rebuild it to a tricopter... :idea:


no thank you I love my quad ;-)

But the middle bar is bent very hard so I can directly build a tricopter :mrgreen:

No I hope the motor will come in some days.

But I have to say that the barometer works very good with the first version from this post here. I only have a Amplitude of 1 meter, sometimes only 50mm.

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

Re: BMP085

Post by PatrikE »

druckgott wrote:
But I have to say that the barometer works very good with the first version from this post here. I only have a Amplitude of 1 meter, sometimes only 50mm.


Nice! :D
Then im on the right track..

Alex.
Is the baro oversampled?
I can't locate it in the code.
If not it could inprove the resolution.

And when i tried to modify the newest dev from 0508.
My NK is not found.?..Only WMP + BMP
Tried on both Mega and an MiniPro with different sensors. with Pullup and without.
But same result :(

/Patrik

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

this is a video test of your dev Patrik!
http://www.youtube.com/watch?v=3dkU1L0vZI8

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

do anybody of you testet the new dev from

MultiWii_dev20110516.zip

there is some new altitude code:

Code: Select all

  #if defined(BMP085)
    if (baroMode) {
      int16_t throttleAltitudeAdjust;
      static int16_t errorAltitudeI;
      static int16_t lastErrorAltitude;

      if (abs(rcCommand[THROTTLE]-initialThrottleHold)>20) {
        baroMode = 0;
        ITerm = 0;
      }
 
      error = altitudeHold - altitudeSmooth; 
      errorAltitudeI += error/3;
      errorAltitudeI = constrain(errorAltitudeI,-14000,14000);
     
      PTerm = P8[PIDALT]*error/10; //2.5
      ITerm = I8[PIDALT]*errorAltitudeI/200; //0.002
      DTerm = D8[PIDALT]*(error-lastErrorAltitude);  // 20
      lastErrorAltitude = error;
     
      throttleAltitudeAdjust = PTerm + ITerm + DTerm;
      rcCommand[THROTTLE] = initialThrottleHold + constrain(throttleAltitudeAdjust,-50,+50);

//      rcCommand[THROTTLE] = rcCommand[THROTTLE] + constrain((acc_1G-accADC[YAW]),-100,+100);
    }
  #endif


druckgott

quadslo
Posts: 16
Joined: Sat Feb 26, 2011 12:39 pm

Re: BMP085

Post by quadslo »

I would like to add BMP085 to my board.
I don't have LCC on my board, everything is powered by 3.3V. So can I just connect all the wires from BMP085 directly to ADLX345?
I was looking this diagram.
Attachments
5 Connection diagram ADXL345 & BMP085 option 1.png

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

Re: BMP085

Post by Alexinparis »

quadslo wrote:I would like to add BMP085 to my board.
I don't have LCC on my board, everything is powered by 3.3V. So can I just connect all the wires from BMP085 directly to ADLX345?
I was looking this diagram.

Hi,
yes, you don't have to connect something more, only 4 wires.

quadslo
Posts: 16
Joined: Sat Feb 26, 2011 12:39 pm

Re: BMP085

Post by quadslo »

OK, tnx. I will try.

arnaldo
Posts: 49
Joined: Sun Mar 06, 2011 4:53 pm

Re: BMP085

Post by arnaldo »

did anyone try last dev? can you have good resutls with baro mode?
i tried with different PID values but i'm not able to have a good alth hold.... at the moment the best Multiwii baro mode is that of Patricke

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

Today I have testet the new dev version.

But the baro don´t work for me.

If I switch it on, the copter falls down.

Best version for me ist this which is here in first post.

Any other tested newest dev?

druckgott
Posts: 32
Joined: Mon May 02, 2011 8:47 pm

Re: BMP085

Post by druckgott »

Today I have testet the new dev version.

But the baro don´t work for me.

If I switch it on, the copter falls down.

Best version for me ist this which is here in first post.

Any other tested newest dev?

User avatar
UndCon
Posts: 293
Joined: Mon Feb 21, 2011 2:10 pm

Re: BMP085

Post by UndCon »

Hello!

What are the current status (running1.8)
Alt hold is implemented and perfected?

I added my BMP085 to a Paris board
(bought long time ago but never got to use it)

I also added AXL345 instead of NK and will see how the outcome is...
(Backup NK is ready for a transplant if necessary)

//UndCon

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

Re: BMP085

Post by mr.rc-cam »

Alt hold is implemented and perfected?

There have been reports of some successes. I've tried (and tried) and alt-hold is very inaccurate/unusable on my big quad. So I'm holding on for a miracle in the next firmware release. But you never know, you may have better luck than me. :)

Post Reply