Adding MAVLINK support

erskyTx runs on many radios and upgrade boards
ersky9x was a port of er9x for use on the sky9x board.
Post Reply
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

did you 'save' the setting after you set it up initially? I 'think' you need to save the model 1st then modify the tuning then save it. I have noticed it does that to me too on other settings. What i just said is what I am going to try today.

edit:
Mike: Currently my quad has a voltage divider to D8R a2 and getting voltage from it.
To use/test the Mavlink voltage and current, should I remove that? or there is a telemetry setting I can use for mavlink reading separating from A2 reading? (this would be good to compare reading from two different sources)

ps: power module is in ;)

User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

The Arduino gets the battery voltage from the APM and sends it on as the Vfas value. This is separate from A1 or A2. The Teensy looks to use A2 over SPort.
I think the current is working, but just won't measure the first couple of Amps. I injected a voltage (via a resistor) on the current measuring signal and then got a reading. By increasing the load to 2.5A I got a reading of 0.5A. So the configuration seems to be correct, just the actual measurement leaves something to be desired!
I'm running from a bench power supply and using resistors to give the load. At 2.5A they get hot rather quickly!

I think most of this is now working.
I still can't get the on board compass to calibrate, I can only get a few samples to register. I do get a sensible reading on the HUD for the compass direction. I did just try a long USB extension so I could get the board in the middle of the room, but still no better.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

I did come acrosss something about the A below 3A is not very accurate, that is why the person who did the vid saying need to get the A up to 10A to calibrate the current sensor.
I am working on mine to test it. That guy come out with a good idea of reverse the blade and rotate them so the quad will be pushed down while calibrating the A without the quad flying away. ;)
Here is the vid says <3A it is not very accurate: https://www.youtube.com/watch?v=tEA0Or-1n18
I am going to test mine just like in the vid with a power meter.

I can use the last posted test code to do this right?
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

Mike:
just got my power module setup in MP (took me a while to figure out how to do it - it's been a while since Last time I set up MP) ;) Now I have the data from Mavlink radio.
A quick test with power meter attached to lipo, on voltage (VFas), that seems to be pretty good, only 0.1 volt lower from my power meter after entering the measured voltage. (while the FrSky A2 is 0.1V higher than power meter)
The Amp is showing rather low about 1-2A lower (like you had), but I only 'calibrated' under 3A. And only able to get it up to 3.2 A without the blades on. May be it will make a difference if calibrated with 10A or above. need to put the prop on to do that.
the 'measured' voltage and current in calibration screen does change, I am working on it how to save them. But it seems after the 'measured voltage' is put in there, although when you go back in the scree it has been changed but the mav data is in the correct state. weird.
User avatar
LTMNO
Posts: 1049
Joined: Fri Nov 30, 2012 9:31 pm
Country: Canada
Location: Toronto, Canada

Re: Adding MAVLINK support

Post by LTMNO »

MikeB wrote:There is some sort of configuration I need to get correct for the current measurement. I'm using a couple of power resistors to provide a current load. At one point I did have a current measurement that was just over double the actual current. I added a load of 1.9A and it changed to 4.3A, returning to 0 when I removed the load. I had the current scaling set to 100A per volt. When I changed this to a more correct figure, it stopped measuring the current!
I'm not convinced that mission planner is writing changes to some settings (like the battery monitor) when they change so I don't know exactly what settings I had when it sort of worked!

Mike.
In order to get the correct current/voltage, follow these instructions....
http://copter.ardupilot.com/wiki/common ... nt-sensor/
Custom 9x with M64/Telemetry Mod

User avatar
LTMNO
Posts: 1049
Joined: Fri Nov 30, 2012 9:31 pm
Country: Canada
Location: Toronto, Canada

Re: Adding MAVLINK support

Post by LTMNO »

Wow, you gents have been busy over the weekend and family day ;-)

Mike, I have tested the Teensy with the latest ROM...some data comes in... some of it does not...
Whats Working...
GPS
Sat
Hdop
RSSi
Alt
gAl
Compass
AccX - seems to working

Whats not
Arm/Disarm
Mode
Curr
Batt %
Battery Meter
Fuel - doesn't work anymore

I will try the Arduino as that seems to have most of what everyone is talking about.... I will try to download the version of compiler you are all using... at this point... 1.06 or 1.6.3 doesn't seem to work...

Edit, 1.5.8 downloaded... able to compile...
Testing Arduino now...
Last edited by LTMNO on Tue Feb 16, 2016 12:25 pm, edited 1 time in total.
Custom 9x with M64/Telemetry Mod
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

Who says it is not working! ;)

Mike:
it is working, figured out how to save the calibration of voltage and current.
once entered the actual measurement (in my case, I read it off my watt meter) in the initial set up, obviously there is no place to 'save'. but go to 'configuration/tuning' -> full parameter list -> 'write parameters'
I have tried several times connect and disconnect the quad and restart, the V and A are correct (within 0.1~ o.2 V or A) without further calibration.

I have not put the blades on yet, but without blade I was able to get it up to 3.6 A and the voltage and amp draw match my watt meter very well, within 0.1 to 0.2 A or V. ;) Actually, my Mavlink radio read out on MP is not as good as the Tx mavlink data. But Tx mavlink V/A match my watt meter better than what is shown on MP. (Don't ask me why ;) , may be radio link lag with 433MHz?? )

edit: the amperage actually after entering the 'measured current', there is a amp/volt calculated, put that number in the 'full parameter list' then 'write parameter' then the calibration of amp will be save. by entering in the initial set up only the volt/volt is saved.
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

It may be the firmware on the Teensy isn't the same as the source files I've downloaded.
I'll see if I can do some more investigation as to what is in it.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
LTMNO
Posts: 1049
Joined: Fri Nov 30, 2012 9:31 pm
Country: Canada
Location: Toronto, Canada

Re: Adding MAVLINK support

Post by LTMNO »

No worries, I will be back in a few days to test some more when I have some more dedicated time... I will post versions, screenshots....etc...

Thanks.
Custom 9x with M64/Telemetry Mod
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

Mike:
I ran the reverse blade test. the current scaling is just about perfect. I ran it all the way up to 20.8 A, every stage/bit matched my watt meter reading. :)
There is something funny about the voltage. At static or low power the voltage reading is good, but with higher output (high rpm, high current),the voltage could be as much as 1+V lower than A2 or my watt meter. A2 is within 0.1 V to my watt meter.
My new laptop just had the MP installed yesterday (before this I was using my pc MP and radio link) somehow is not connecting with the radio link. I can't check the voltage calibration live.
But the calibration in amp as I described yesterday works. I did not touch the calibration at all today, just ran the quad with reverse blade (and that works great for testing ;) )
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Have had another quick looksee at the Voltage and Amperage telemetry - Voltage on mine is VERY close indeed to what is showing on my FrSky FLVSS and Fluke 117, both with and without motor running. Excellent.

The 'battery' icon and %age next to it are also functioning. Excellent x 2!

However, I am not getting Amps to show. (apart from what I set in MP - in fact, whatever I set 'experimentally' in there showed fine, so it is working in theory!) Pretty sure it is something I am missing somewhere. Motor may not be pulling enough Amps to register maybe. Been a long day and will get to grips with it in the morning.

Mike - which entry on the debug screen relates to the Amps telemetry readout? Can check to see if it moves at all.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

Mike:
Got my laptop mavlink radio working after driver fix.
There is nothing wrong with your voltage data. It is the control board (MPNG/MP). The Mavlink radio to MP is reporting the same thing as your data as far as the Voltage. When high current draw the voltage is different from my watt meter but your data matched the mavlink reported data shown on MP transmitted by radio link.
So I think this is a bug in MPNG/MP. Not your program. Your program just take the data and convert it to FrSky hub format (at least that is what i am using).
This evening I ran the current as high as 36A (shy of full throttle because the quad started became unstable because of the back wash and it is right at my feet ;) )and your current reporting is spot on (after yesterday's calibration). But with higher current the voltage is up to 2.1V higher than A2 or watt meter but it matches perfectly with the mavlink radio reporting.

This voltage difference starts around 2.6~2.8A then getting bigger and bigger when current draw is higher and higher.
I will start setting up a new 450 quad with another FC board (the HK AIOP V2 ~ Crius AIOP v1. I know all my stuff is kind old from 1 1/2 to 2 yrs ago :P). I will use the last MPNG to check if they corrected the issue when it is ready.
The current board I am using is the HK red AIOP board as RCHH's illustration pic for connection of power module wire. In there I have a MPNG older version from 1 1/2 to 2 yrs ago, not the latest or last version of MPNG for 8bit processor. (But I know everything in there is calibrated so I did not update)
May be the real APM FC will report actual voltage correctly.
Just like RCHH reported the battery symbol and % are right on.
Last edited by kaos on Wed Feb 17, 2016 3:51 pm, edited 1 time in total.
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

RCHH wrote:Mike - which entry on the debug screen relates to the Amps telemetry readout? Can check to see if it moves at all.
Top row, one in from the left.
I'm finding I need a couple of Amps before I get a reading, and my bench PSU is only 2.5A.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Welllll ..... Mike it all WORKS!

I have nailed the Voltage and Amp readings to 0.1 maximum discrepancy. Close enough for a job in the street ...

One thing that happens though is once the Amp reading rises into the 20+ range, the 'Cur' heading on the display impinges on the '2+' of the Amps reading. Not sure what can be done about that as there is precious little room available I suspect.

But, Genius man, other than that tiny issue, this is a truly brilliant addition!


Just need to work out now where to tap in for my MinimOSD and job done! Edit: DONE!

Next addition ... lol!!!
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
duststorm
Posts: 43
Joined: Thu Oct 29, 2015 5:46 pm
Country: Belgium
Location: Leuven

Re: Adding MAVLINK support

Post by duststorm »

When this is in a stable enough state, this "MAVLINK over FrSky" bridge could probably be integrated into APM directly.
Currently, you can already configure your serial port to output FrSky serial data for a pixhawk, it's probably possible to add a "MAVLINK over FrSky" option.
That would mean that no arduino is needed.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Adding MAVLINK support

Post by jhsa »

RCHH wrote:
Next addition ... lol!!!
I have a few ideas, but I better keep them for myself before I get bashed again :mrgreen:
Not that I really care :mrgreen: :mrgreen:

Excellent work Mike.. even if I don't use this.. It's one more great feature..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

RCHH wrote: Just need to work out now where to tap in for my MinimOSD and job done! Edit: DONE!
Next addition ... lol!!!
Are you saying putting the whole screen on Minim OSD?
I guess putting that compass/direction figure on there would be good.
I remember my minim has most of the data but no directional figure. I will put it on today to check. Can't remember clearly now. :P
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Adding MAVLINK support

Post by Kilrah »

duststorm wrote:When this is in a stable enough state, this "MAVLINK over FrSky" bridge could probably be integrated into APM directly.
Currently, you can already configure your serial port to output FrSky serial data for a pixhawk, it's probably possible to add a "MAVLINK over FrSky" option.
That would mean that no arduino is needed.
S-Port output for values supported in the existing FrSky protocol is already coded in to some extent in APM, I believe it's actually pretty much finished by now.
Should still change with additions for other values though.
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

kaos wrote:
RCHH wrote: Just need to work out now where to tap in for my MinimOSD and job done! Edit: DONE!
Next addition ... lol!!!
Are you saying putting the whole screen on Minim OSD?
I guess putting that compass/direction figure on there would be good.
I remember my minim has most of the data but no directional figure. I will put it on today to check. Can't remember clearly now. :P
No not the screen as on the radio, but actually a 'version' of it would be good I think.
As far as direction stuff goes, I think (ages since I fired that up as well!) my minim using KV Team 2.3 OSD only has figures for compass direction, home direction and a scale at the top for general compass pointer. Can't recall what else as it has so many things to add or remove from its display.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

I think is would be good to incoporate the code into part of APM. but keep the pro mini version, there are boards not running APM instead running Multiwii or MPNG, openpilot...... since this is a direct conversion of mavlink serial data, just about any FC has a serial out can use this.
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

RCHH wrote:One thing that happens though is once the Amp reading rises into the 20+ range, the 'Cur' heading on the display impinges on the '2+' of the Amps reading.
Options:
1. Remove the 'A' an just display the value.
2. When the current exceeds 9.9A, stop displaying the decimal part.
3. Change 'Cur' to something shorter.
4. Make the big square with the direction line in it a bit smaller.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Brodziek
Posts: 15
Joined: Thu Mar 20, 2014 5:55 pm
Country: Poland

Re: Adding MAVLINK support

Post by Brodziek »

That may change, "Cur" to "I =", or option 4 - reduce the size of graphics.
Using Tapatalk
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

I think I have a solution.
1. Condense the 'A', makes it 1 pixel narrower (CONDENSE is a text option, used normally for HEX characters (A-F)).
2. Reduce the size of the square by 2 pixels.
3. Position everything very carefully.
4. Draw the "Cur" first, then the number, if necessary, overwrites the "Cur", but I think it fits unless you are drawing 100+ Amps.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Adding MAVLINK support

Post by jhsa »

I think over 100 amps the decimal doesn't make any sense? ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

jhsa wrote:I think over 100 amps the decimal doesn't make any sense? ;)

João
I will agree with that.

Shrinking the compass pointer box would be the way forward, as it would still be easily seen at a glance.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Adding MAVLINK support

Post by Kilrah »

kaos wrote:I think is would be good to incoporate the code into part of APM. but keep the pro mini version, there are boards not running APM instead running Multiwii or MPNG, openpilot...... since this is a direct conversion of mavlink serial data, just about any FC has a serial out can use this.
Multiwii and Openpilot don't use mavlink.
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Kilrah wrote:
kaos wrote:I think is would be good to incoporate the code into part of APM. but keep the pro mini version, there are boards not running APM instead running Multiwii or MPNG, openpilot...... since this is a direct conversion of mavlink serial data, just about any FC has a serial out can use this.
Multiwii and Openpilot don't use mavlink.
In that case, I must be doing something wrong - I have run MAVLink on MultiWii for ages with MegaPirateNG. I do believe kaos is actually testing this addition on a MultiWii Pro board ...

I have yet to connect up the relevant bits to my HK MultiWii Pro Hex, but will be doing tomorrow and hopefully, if the rain buggers off, will be taking it to the skies.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Adding MAVLINK support

Post by Kilrah »

MegaPirateNG does (given it's based on APM), which is why I didn't copy it from his examples... But the actual MultiWii firmware uses its own protocol.
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH »

Ah of course! My error.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Adding MAVLINK support

Post by kaos »

I started the error, should be any FC (multiwii board or others) using MPNG/APM can use it. ;)
I read Multiwii new version also has map function similar to MP, what does it uses Now? A couple yrs ago, Multiwii does not have the capability that is why I switched to MPNG.

Post Reply

Return to “erskyTx (was ersky9x)”