MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

Go to page 1Go to page 012Go to page 2Go to page 2
Avatar
crazypilot_uk
Posts: 30
Hi,
I have made most of my flight instruments using Mobiflight but I would also like to build a VOR and ADF indicator for my cockpit, does anyone know away to let the MobiFlight software know the postion of the motor or any other way the software can read/detect the postion of the OBS Bezel ?

any help would be much appreciated :)
2017-12-10 09:18
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi.

I normaly not work with analog instruments.... so i not understand why you need to detect a motor position here....
Can you explane me short what exact you need.... Or link me a Video that show the situation.

Basicly.... a Motor turn in case of a Offset Input.... So you have already a Value that can be used to calculate the motor position.

Pretty shure we can help you.... just give me more information pls.
Good Luck !
2017-12-10 15:46
Avatar
crazypilot_uk
Posts: 30
Hi,
In the case of the ADF indicator I was thinking of using two stepper motors, one for the outer OBS bezel and the second for the ADF pointer and then using an encoder which will rotate the outer OBS bezel, simaler etup would be used for the VOR's witht he additon of a couple of servos for the tracking needles.

So last night I set up a stepper motor and assigned an offset 0C6A (set the calculation *360/65536) to track the ADF needle, this works perfect apart from when the needle reached 180 degree's it swings the opposite direction to get to 181 degrees and the same for the opposite direction, any ideas on how to get round this problem ?
2017-12-11 09:41
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Ok now i think i understand.....

Basicly you not need to "readout" a Position of a Motor here i think.....
The 2 Systems are indipended..... So The Needle not need a Info of position from the OBS Course Scale..... Otherwise the Course not need information where the Pointer is shown at the moment.... BOTH Data is available in own offsets.

Finaly your right.... For the ADF Gaug you need a "Shaft in shaft" System. One Stepper controll the Course Backlabel .... the Other must have a shaft through this Label ( No touching so the turning is no problem) and on it the needle is mounted that show the ADF Direction.
The NAV1 System needs a stepper for the Label and 2 Servos/Stepper for the Locater and glidescope Needle
The Nav2 got normaly no glidescope.... here you just need the locater needle and again another stepper for the turning.

About the Systems itself.....
For the Label (Compas) and maby for the ADF Needle you "maby" need to use "Compass Mode" in stepper setting to prevent a reverse turning when you override the 359/000 border.
The Servos also need to have a clear range.... You have to find out the offset values and set the servo for a good functionality.

LAST THING:
The reported problem with 180-181 "can" be a Signed/Unsigned problem.... I not try out but it sounds so....
Please observe the Value in the Mobiflight Window at this config when you go from 180 to 181.
If my suggestion is correct then it change to -179 instead of 181 (Negative Value)
To solve this simply use a Compare.... IF Value less then Zero <0 THEN $+360 ELSE $
THAT should solve the problem !
Good Luck !
2017-12-11 12:18
Avatar
crazypilot_uk
Posts: 30
Hi Pizmn82,
Thank you for your help, I tried using your calculation : IF Value less then Zero <0 THEN $+360 ELSE $ and it works great, however I now have the opposite problem, when the needle rotates through 360 degree it goes all the way round to get to 001 so I set the compass mode and my stepper motor just keeps turning :confused:

Any ideas ?

Brgds
2017-12-12 22:21
Avatar
StephanHo
From: EDDG, Germany
Posts: 1867
Supporter
Hi,

try this:

if($<0,$+360,if($>360,0,$))
Grüße,
Stephan (Time: UTC+2)
2017-12-13 13:20
Avatar
crazypilot_uk
Posts: 30
Hi Stephan,
Thank you for yo ur help, I will try this tonight. just so I understand I have 3 boxes : FORMULA IN THE TOP ONE AND NOTHING IN THE BOTTOM 2 ?

IF CURRENT VALUE IS : IF $<0,$+360,if($>360,0,$
SET TO EMPTY
ELSE SET TO EMPTY

Is this correct ?
2017-12-13 13:59
Avatar
StephanHo
From: EDDG, Germany
Posts: 1867
Supporter
it's a nested condition:

If the value is smaller than 0 then add 360 ELSE if $ is larger than 360 then set to 0 ELSE set to $

so if both conditions are not true ( $<0 , $>360) then set to $

Always if your value is between 0 and 360 you will got $ otherwise if <0,+360, if >360,0

My formula is based on the information that pizman has made:

iconpizman82:

LAST THING:
The reported problem with 180-181 "can" be a Signed/Unsigned problem.... I not try out but it sounds so....
Please observe the Value in the Mobiflight Window at this config when you go from 180 to 181.
If my suggestion is correct then it change to -179 instead of 181 (Negative Value)
To solve this simply use a Compare.... IF Value less then Zero <0 THEN $+360 ELSE $
THAT should solve the problem !



I just extended this formula to cover both the problem <0 and >360
Grüße,
Stephan (Time: UTC+2)
2017-12-13 15:08
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi Guys....

I think you mix up 2 Problems here.... So i think Stephans suggestion not helps (whatever it not broke something.... its just unnecessary )

Problem 1: Signed/Unsigned Bug
As explaned the Value you get from Sim should be "000 to 359" But it is "-181 to +180"
HERE my hint with "IF Value less then Zero THEN $+360 ELSE $"should work ! ( This can be done in the COMPARE Tab of Mobiflight OR with a Entry in the TRANSFORM.
Just for info : In Transform the correct syntax is .... if($<0,$+360,$) .... But i recommend here to use "compare" Tab... Much mor easy !

Problem 2: The missing Overflow of the Stepper when you reach 359-000
Thats another problem..... The Stepper use the Value to set the motor to a Position.... You say.... a Full Circle is a value from 360.... So 0 Is Top Position.... 180 is a half circle.... 360 is a full turn !
But now when the value is get back to 0 for example then the Stepper not know it should make a overflow.... For the Stepper 0 means it should turn reverse to 0 !
To protect this Sebastian include the "COMPAS MODE" .... Here a "internal" Logic create a not vissible Value that is used for stepper.... If you make a overflow 359-000 then the stepper means the value is 360 ! If you go to 75 now the stepper means it should show 435 for example..... Same in other direction... here the stepper means it should show for example a negative value. ( This is not endless but we can do that for hundrets of turns.... So we will never see the end !)

****
FINALY.... I recommend to use the COMPARE to protect the Signed Problem AND you should use "COMPASS MODE" enable to solve the overflow problem.
Please reportif that work finaly!
Good Luck !
2017-12-13 20:12
Avatar
crazypilot_uk
Posts: 30
Hi Guys,
Ok I could not get Stephans formula to work, so I tried Pizman way and the stepper motor just keeps on spinning with COMPASS MODE set even when I close Mobiflight down, when I restart Mobiflight the stepper has lost its calibration 0 position. I found the issue is in the display tap / stepper revolutions are set to -2044 this is because setting the revolutions without - turns the motor the wrong way, so leaving out the - and leaving the setting to 2044 with compass mode ON and no compare option the ADF works great going through both 180 and 360 degree but in completely the wrong direction :w00t: Any idea how to fix this without mechanically reversing the motor position ?
2017-12-13 22:59
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
OK... Another Problem :-) Nice Project... You got a Value that is wrong labled signed, that need compas mode AND now that need to be reversed ! :blink:

First about the spinning and missing Zero Calibration.

Please Note that a Stepper got a REAL Zero Point.... that menas NOT the Direction of your needle (for example North 0° Position) This means a EXACT Point that include Turns more then 360° ..... For Example if you use the Stepper for a Altimeter and a Full Circle is 1000ft ..... if you Climb to 5000 Ft the main needle looks like it´s on zero Point (12o Clock) again.... BUT Thats Wrong... It´s 5 full Turns away from zero Point! ... So when you stop here the Mobiflight (while flying) the Stepper MUST now turn 5times full circle counterclockwise to reach the REAL Zero Point !

In a Compas i think its the same ( Not shure how sebastians logic work but i think 99%im right here) .... If you Start and Compas in in 0 Position North .... And now you fly for example 10 full 360° Turns to the Left and you land again.....Now the Needle is already NORTH .... BUT When you stop Mobiflight then the stepper must turn 10 times backwards again before he reach the Zero Point!

If you here Cut powerto prevent the rotating then the Zeropoint is killed and you have to calibrate the motor again !

*****

Now Solution for your situation:

I´m not 100% Shure if this work with Compas Mode enable but normaly it should....
Please enable INTERPOLATION by checkbox..... Then make 2 Lines....
A) 1=359
B ) 359=1

And as you said... Please NOT use Negative value in the Stepper input field of Display Tab ! ... Here you normaly need Value 2048

EDIT: But another way.... If you already need to make double shafts and difficult technics for the other Gauges....i would simply think about a Cogwheel if this interpolation not work fine.... Use a 1:1 System here.... Then its reversed automaticly !
[Last edited by pizman82, 2017-12-13 23:58]
Good Luck !
2017-12-13 23:51
Avatar
albeagle
Posts: 142
Interpolation works great. The only problem is (at least by me) that interpolation checkbox remains unchecked next time I start mobiflight. I had to use interpolation for the compass and for flaps servo to get different flaps values. So every time i open up mobiflight, before starting it I have to check interpolation checkbox for both compass and flaps, which somehow it won't save the settings. As i said I don't know if it is only me or is that a mobiflight bug/feature.
Regards
AlbEagle

https://flyingforfun.weebly.com/
2017-12-15 10:19
Avatar
crazypilot_uk
Posts: 30
I think I'm going have to go the mechanical route, I can reverse the direction using Interpolation but cant get it to work with compass mode so the direction is correct but has the problem when it gets to 360 goes all the way back round to get to 001, if I use compass mode but not interpolation then the operation is correct but in reverse direction :confused:

I can t seem to get them both working together, any more ideas on how to reverse the direction via software ?

Albeagle : did you have compass mode on when using interpolation ? and if so did the compass operate correctly through 360 degree ?
2017-12-15 14:39
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Oh... Maby my Mistake.....
Please try Interpolation
0=360
360=0
Maby the leading 0 was the problem !


EDIT:
@ Albeagle

Problem is a BUG.... Please look here... https://www.mobiflight.com/forum/message/3261.html
If possible send me your MCC File next week so i can check it .... maby i can then reproduce the issue in the code.
((Write in Email please the exact Name of Configs that NOT working correct and lost interpolation enable checkbox. ))
.... pizman@freenet.de

THKS
Good Luck !
2017-12-15 15:11
Avatar
albeagle
Posts: 142
@crazypilot_uk

Everything works fine with the compass and interpolation as long as you set the zero point correct.
As pizman said use
0=360
360=0

@Piezman

Ok I will check again and let you know. Maybe i didn't run the program as Administrator. I haven't been usig the simulator for a while now, didn't have enough time but I will try to reproduce the problem.

I have been working on the pcb version of the radio, planing to do a PCB for the Gps too.
Here a picture of the com1/nav1 radio
I didn't have 3d 5 digit 7 segment displays so I just used 4 digit ones for Illustration Purposes.

Regards
AlbEagle

https://flyingforfun.weebly.com/
2017-12-15 21:25
Go to page 1Go to page 012Go to page 2Go to page 2