LibrePilot Forum

Users => Vehicles - Fixed Wing => Topic started by: karla on December 01, 2019, 08:41:01 am

Title: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on December 01, 2019, 08:41:01 am
Hello  :)

Following advise and hope to have PH, RTL, PP flight modes working better for my fixed wings I want to install an airspeed sensor to my Revo board with LP 16.09 r782. Reading up on articles it seems most suggested that digital airspeed sensors have superior range and precision to analog ones that has a lot of noise issues. Since I saw there seem to be support for a well known digital airspeed sensor from pixhawk, I got some units and installed them but the System Heath show I2C as black and AIRSPD as black red crossed over.

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8357;image)

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8355;image)

I have been reading up on another user, way back that tried to get that sensor to work with a Sparky board.
https://forum.librepilot.org/index.php?topic=3483.0
I am not sure but seems he got it to work after resolving some issues with 5V respectively 3.3V from the sensor?

Anyone already got this sensor working with a LP on a Revo board?

I have followed the wiki
. configured the FlexiPort as I2C
. HWsettings OptionalModules Airspeed Enabled
. Set AirSpeedSensorType to PixHawkAirspeedMS4525D0
. Connected the unit to Flexi port according wiki for pins SCL, SDA, GRD, 5V and the unit.
(I have no other i2c sensors on the system, use internal mag and a GPS on the main port)

Any ideas how to move forward?
Should I just move on and get an analog sensor that user JDL since he apparently got it to work nicely?

Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: ufoDziner on December 01, 2019, 09:43:56 pm
Hello,
  FWIW, I'm using the EagleTree V3 sensor for dynamic PID tuning.  It's working great for that, but I can't get it do display any value on the GCS when testing.  Maybe it's an arming dependency or something?  Either way, I can confirm that it actually does change the PIDs, so it might be worth trying.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: TheOtherCliff on December 01, 2019, 10:36:03 pm
@ufoDziner:
Hmmm... you should at least be able to set up and watch airspeed on the Scope page.  You will have to set up AirSpeedSensor in the Tools drop down -> Options -> Scope and then set it up on the Scope page.

@karla:
JDL and I discussed the MPXV7002 airspeed sensor and both of us got it working.  In that thread, I just changed the link to buy it to a valid link.  It sounds like you should be able to get the one you have working though.
https://forum.librepilot.org/index.php?topic=3518.0

This is the sensor.
https://www.xt-xinte.com/Ardupilot-Arduplane-Airspeed-Meter-Sensor-Kit-With-Pilot-Tube-for-APM2-5-2-6-2-8-Flight-Controller-p138778.html
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on December 02, 2019, 02:48:55 am
Thank you @cliff, that is a fine plan b.
I will try a bit more to use this higher quality sensor.
I think user @wondersea and @f5soh already solved this in another thread:
https://forum.librepilot.org/index.php?topic=2907.msg20342#msg20342

It seems indeed be about 3.3 vs. 5 volt signal mismatch between sensor and the I2C port.
I will see if I can get mine to work and write up how to do it and where to buy things if succeed.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: ufoDziner on December 02, 2019, 05:43:49 am
Thanks @TheOtherCliff.  I will test.  The only place I was looking was at the airspeed indicator on the "Flight data" tab.  It makes sense to me that it would be displayed there.  While that never displayed the info, the "AIRSPD" indicator was green, and I could see the controls scale down when blowing into the tube.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: f5soh on December 02, 2019, 06:11:19 pm
Quote
Anyone already got this sensor working with a LP on a Revo board?

Yes, works perfectly and pretty accurate without calibration.

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8360)

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8362)
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on December 03, 2019, 03:34:11 am
Thanks! Very useful.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on December 15, 2019, 08:59:59 am
Success!

I am pretty confident to get the MS4525D0 unit to work if arranging stepdown to 3.3v for the signal.

However, what I tried was something different. I got interested in this combo unit from jDrones that in addition to the MS4525D0 has a 3.3/5V pad to just solder a blob which one you prefer and has an external compass on it. Both connected to i2c bus.
Elegant! http://store.jdrones.com/digital_airspeed_sensor_with_compass_p/senairmag03kit.htm

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8379)

I soldered the blob from 5 to 3.3V and now the airspeed is working :)

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8381)

Now then, happy so far and just want to see if we can get the mag to work as well.
No big deal if not, since I can likely use the onboard one just as well or like @f5soh suggest, no mag needed at all. Just think it would be cool to have this two units working on same i2c bus and deliver good undisturbed data the FC.

So, the magnetometer page in the GCS, complains the 'external mag can not be found'.
The Red I2C error message in system health say:

I2C: Critical
i2c port is working but there are
acknowledgement errors.


This setup picture was published way before, with the airspeed sensor connected
to i2c in addition to an external mag unit also connected to i2c bus.
Should whis setup still be working?
Any ideas?

(https://forum.librepilot.org/index.php?action=dlattach;topic=2907.0;attach=5021)

Thanks a lot!
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: f5soh on December 15, 2019, 10:45:38 am
Look if you see activity into Data > AuxMagSensor UAVO ?
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on December 16, 2019, 01:31:54 am
No data for x, y and z under the AuxMagSensor, they all remain at 0.

b t w
I read up on the documentation again and noticed the Flexi port should be set to I2C in Hardware, but the Mag type under Attitude Magnetometer settings should not be set to i2c but to Flexi (can be set to i2c but that's related to sparky board).
Anyway, that did not change anything.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: TheOtherCliff on December 16, 2019, 05:36:19 am
That unit says it has "HMC5983 compass"

5 minutes of Googling yields conflicting answers, some saying the I2C address is the same and it works (various firmwares) and some saying that even the address is different than the 5883 that LP is coded to work with.

For chips known to work, sometimes stiffer I2C pullups (say 2.2K from both SDA and SCL to 3.3V) will often make I2C work better.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on December 16, 2019, 06:25:48 am
Thanks a lot Cliff,
I have asked the store for what I2C address this compass uses
(pretending I understand any of this address stuff).
Awaiting their answer now, but I have asked them before and they need a lot of encouragement to answer any questions :)
Of course I should have checked this before buying it  ::)
I think I will not tamper with adding resistors since the 3.3v onboard soldering setting made the airspeed sensor work fine.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: TheOtherCliff on December 16, 2019, 07:48:59 am
One other thing I recall is the issue between the original HMC5883 and the newish clone QMC5883.  I understand that different revisions of the QMC, ending in like A or B act differently, and read a post that one of those versions acts like the HMC5983.

There is a pull request (code already written and dev tested) to make the QMC5883 work in next, and that same code might make your HMC5983 work.

@f5soh linked to that pull request.  If you are feeling particularly interested, you could pull the whole code base associated with that pull request, and try that.  :)
https://bitbucket.org/librepilot/librepilot/pull-requests/496
Or at least look at the code and see what the addresses are to compare to whatever the seller tells you the addresses are; if you even trust the seller information.

My guess is the seller will not want to tell you anything because:
- seller got the boards cheap from some place that doesn't know what chip is used or why it doesn't work
- incompatibility (especially HMC vs QMC) is a hot topic and they don't want to admit anything

If I really wanted to know, I would find an Arduino test program and try different libs to work with that program for the various mag chip flavors till I found a lib that worked.  That is probably easier than using a logic analyzer.   :P
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on December 17, 2019, 06:23:45 am
 :P Little too deep waters for me at the moment.

Very interesting some code readily exists though.
It was written, tested and approved by two people, but still did not make it to next r782 - How come?
What is lacking to get it included? Testing?
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: TheOtherCliff on December 17, 2019, 07:40:04 am
I think I recall that procedures require 3 approvals for it to be merged into next, and you shouldn't just say "Yea that is a useful piece of code"  You should read and understand the code to know that it is correct, is well written, follows our standards, doesn't conflict with the general project direction, etc.  If only one person does this, they could be wrong.
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: TheOtherCliff on December 17, 2019, 10:44:33 pm
Airspeed Sensors I Just Bought

MS4525D Pixhawk PX4 Airspeed Sensor with big fancy pitot and tubing, on eBay for $47 shipped, took 15 days shipping arriving Dec 17. Here is a direct link to the PX4 (MS4525D) version.  Beware that this page also sells the cheaper MPXV7002, apparently also with the big heavy pitot for $25.
https://www.ebay.com/itm/JMT-PT60-APM-PX4-Airspeed-Tube-Pipe-Digital-Airspeed-Meter-For-DIY-Fixed-Wing/283185821007?var=583596360248

White sensor chip/module says 4525D.  Black board says PX4AIRSPEEDV1.1 and 5V SCL SDA GND, so that at least votes for 5V.  Reading several threads on various sites, it looks like everyone should be using a 3.3V part, but the initial design was wrong in that it used a 5V part and that is what we are stuck with now.  The datasheet says 2.7V to 5.5V so I take that to mean the 3.3V part can run at 0.6V below that.  If I have I2C errors, I may try to run this 5V part at say about 4.4V rather than messing with a level shifter.

That is the cheapest MS4525D with big pitot I found while taking shipping cost into account.

The packet containing just the metal pitot tube and silicone tubing weighs 30 grams.  Pitot alone is 14.1 grams.   :o  The cheaper pitot that often comes with the MPXV7002 feels a good bit lighter.  Lighter tubing is surely possible too...


Xt-xinte has the MPXV7002 (usually black sensor chip/module?) with lighter weight pitot for $14.  I got free shipping and listing says free shipping, but it is xt-xinte...  Shipping time about 3 weeks (due here in less than a week).
https://www.xt-xinte.com/h-product-detail.html?goods_id=138778
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: jdl on January 07, 2020, 10:25:34 pm
Report:

I've recently got this one MS4525D Pixhawk PX4 on sale from AliExpress, $35.34, Free shipping via AliExpress Standard Shipping (16 days transit). Lighter, all-metal pitot tube, silicone tubing and sensor board with cable.

Option available: Sensor only for $29.49

https://www.aliexpress.com/item/32560997823.html?spm=a2g0o.cart.0.0.21f93c00C3V7HQ&mp=1 (https://www.aliexpress.com/item/32560997823.html?spm=a2g0o.cart.0.0.21f93c00C3V7HQ&mp=1)

Meanwhile the price raised but now I see it again on sale (same lower price) till 10 Jan 2020. :)

This evening I found some time to test it, works really fine. Connected it directly to Flexi Port (5V). No I2C errors, no interrupts. Data coming seems plausible and doesn't drift with temperature, unlike MPVX7002.

Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on January 13, 2020, 09:21:04 am
Testing the MS4525DO unit in air, looking very promising  :)

Mounted it in the pre cut-out compartment in the wing and had to cut down the length of the plastic tubes a lot, to fit it in.

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8429;image)

Its mounted in the left wing and I wanted to calibrate it.
Just using the default settings for the air speed sensor as posted before here by f5soh and me.

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8433;image)

This maiden flight is 5 min at the beach. The wind is coming from the sea at just below 6 m/s, very stable not gusty. I am flying close figure eights turning in to the wind, then land. I don't trust myself to fly in manual mode so this is in attitude, attitude, manual, manual in Basic AttEstAlgo.

https://www.youtube.com/watch?v=8qV9KB_CEhc

This is the log from the 5 min flight showing airspeed and gps reported groundspeed.
I think the average airspeed and the average groundspeed align just fine at around 15.5 m/s.

(https://forum.librepilot.org/index.php?action=dlattach;topic=4819.0;attach=8431;image)

Over at ArduPilot its suggested for the zero calibration of wind speed:
( https://ardupilot.org/plane/docs/calibrating-an-airspeed-sensor.html#manual-calibration )
The airspeed varies with the square root of the pressure, so for differential pressures near zero it varies quite a bit with very small pressure changes, while at flying speeds it takes much greater pressure changes to produce a similar change in speed. If you see mostly 0, 1, 2, with an occasional bounce to 3 or 4, consider it normal. You will not see that sort of variability at flying speeds.

I think that's exactly what can be seen in the picture after landing with no wind - yellow circle.

Think the windspeed sensor is okay and ready to go.

Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: TheOtherCliff on January 13, 2020, 02:06:37 pm
After you have tweaked PIDs beware that you may / will find that PID I term windup before flight is a problem.  If tilted left in your hand, you will get more and more right aileron.  That left tilt will cause it to go hard right at takeoff.  Elevator affected as well.  Higher PIDs makes this worse.

I have seen this when switching from Manual mode to Atti mode in flight.  I presume that you get the same problem from just holding it in your hand, in Atti mode, with the motor running.

Of course you really need Stabilization->ZeroTheIntegral enabled (you probably already have this) so that as long as throttle is zero it will not wind up.  Then it is just between throttle up and launch that it can wind up.  JDL does bungee launch at zero throttle, then adds throttle when in the air.

One other factor about this is that you can reduce the I term windup by reducing the ILimit in StabilizationSettingsBank1(or which ever bank) ->
  RollRatePID
  PitchRatePID
  RollPI (not needed for default settings where I term is zero)
  PitchPI (not needed for default settings where I term is zero)

(Other readers should note that we don't usually stabilize fixed wing yaw so it isn't mentioned here.)
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: karla on January 14, 2020, 02:09:01 am
I thought that windup problem could be solved with the "jdl-method"?

https://forum.librepilot.org/index.php?topic=3558.msg29816#msg29816

We talking about the same thing right?
(PIDs windup on takeoff in Attitude, after arming, switching from manual to attitude and applying throttle).
Title: Re: MS4525DO (pixhawk) Digital airspeed sensor connection I2C
Post by: TheOtherCliff on January 14, 2020, 06:09:12 am
If I recall correctly, the @JDL method allows you to fly in the air something that is effectively Manual mode, and in air switch to Attitude mode without it going crazy; where if you use real Manual mode and switch to Attitude, the windup is a problem.

What I am talking about is like an Attitude mode quad taking off tilted from the side of a hill.  The longer you wait, the more it winds up.  When it finally gets in the air the downhill side has much more thrust and it tends to flip "up the hill" like rolling a ball up the hill.