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! 

icon
Avatar
Pietrogramma
Posts: 15
Hi everybody, I builded the hardware for replace the elevator trim of the cessna C172. I'm usign an encoder for set the trim and a servo motore (the SG90 or MG90 or MG995, what is the best?) for the trim indicator.
In mobiflght I used the Event ID "Elev_TRIM_DN" and "ELEV_TRIM_UP" for the encoder and the offset 0BC2 value type int, size in bytes 2, mask value with 0xFFFF BCD and More options not use for the servo.
If the encoder work fine, the servo motor is totally crazy in the movement.
Can you suggest me the exactly values that I must use for the servo motor?
Thanks and ciao
[Last edited by Pietrogramma, 2018-10-01 16:47]
2018-10-01 14:34
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2921
Supporter
Hi

I can not give you the values..... Cause this values must be calculated for YOUR System.
-Different Aircrafts (AddOns) have different Values....
-Your Gauge.... If your Gauge is using full 180° it need a other value as a gauge that is build with a for example 150° Movement.
- Different Servos have different Movements .... so they also need there "own" Value logic

**************

About your Problem.

You must do 3 things...

1. Find out the complete Logic of your Aircraft and the Offset.
Read the offset (Without Device like servo cause while testing this is maby destroy the motor !! ) So make a Output config with that offset but without device
Open Sim and your Aircraft and Trim to the lowest Position that is possible.
Check the Value at this moment.
Then Trim to the highest Position and check the Value again.
Now you know.... The Range of the Offset.... From 0% to 100%
You also know if the offset is Positiv (for example 0-500 ) or if its Negativ and Positiv ( For Example -2000 to +6000 )

2. Check your Gauge.
Is it Linear ? Or is it non Linear ? ( Normaly a trim indicator is linear) If Not you also need interpolation !
And also check how far the servo turns from Zero Point to Highest Point.... You must know the Degrees or the Percent of Moving here on YOUR Indicator Print label !

3. If needed you must recalculate the value. ( Mostly if it is negative/positiv ) I not work with servo motors but i think i remember that Servos have problems with negative values.
So if your Offset have a range from for example -2000 (Lowest point) and +6000 (Highest Point) THEN you need to enable transform field with entry "$+2000"
So the Value is NOW from 0-8000 ( and never can include negative values)

At last you must define this Range in the Servo Setting tab. MIN value and MAX Value ( the observed and maby recalculated values from point 1) AND in the Max Duration field you define the range of Servo ( Mostly 100% means 180° )

I hope this awnser your Question ! If not tell me your detailed Problem.... I will try to help !
Good Luck !
2018-10-02 05:07
Avatar
Pietrogramma
Posts: 15
Thank you very much Pizman82, as usual you are always kind and very well prepared. I have perfectly understood the way you act explained, now I must work with youru indication :-)
I do not understand (for my limits) how read the offset value?
Thanks always and ciao
2018-10-02 12:20
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2921
Supporter
iconPietrogramma:


I do not understand (for my limits) how read the offset value?



Thats easy.

Professional users work with the logging tool of the registred payware FSUIPC here.... BUt it is also possible with Mobiflight.

1. Open a new config or use a existing one (no matter)
2. Create a OUTPUT Config Line.
3. Use the Offsetadress, Typ, Size , Bitmask etc of the Offset you like to explore.
4. Use NO DEVICE in this config .... so NO LED, Motor or something Else.
5. Enable this Config and RUN Mobiflight (and Sim also)

NOW Get sure you see the Simulator and also the mobiflight Window on your screen ( Use Window Mode for the Sim or work like me with 2 or more monitors. )

In the OUTPUT Tab of Mobiflight Connector Window you see RIGHT of this config 2 Collums.... One is called FSUIPC Value the other is called OUTPUT Value.
The FSUIPC Value is the Raw original Value of the Offset you read out supported by FSUIPC.....
The OUTPUT Value is the final Value this config export to the device .... If you use for example Compare, Transform interpolation and so on then the Output Value is different to the raw value.

****
Summary.... With this system you can "Readout" a Value to find out how it work !

Note also: This is not limmited to one Config. If i got a situation and i´m not sure what offset is correct and i got 5 possible adresses i simply make 5 configs and read all this things same time..... If you change something in the sim you can see exactly what offset is changing.... How does it change and so on.

THIS is the first step for cockpitbuilding .... Before you think about Mobiflight Configs and devices... You must first understand the Offset 100% !
Good Luck !
2018-10-02 22:09
Avatar
eapc.piloto
Posts: 11
Hi everyone:
This forum topic maybe is resolved and virtually close but I want to make this entry to provide a possible solution and report a possible bug.

POSSIBLE SOLUTION: To use offset 0X2EA0 (elevator trim offset) to be use with a encoder as indicator is need to convert from decimal to integral number and I´ve use this formula;

($+R)*1000, where R is the biggest positive number in offset range. In carenado Cessna 182 elevator trim offset range is from -0.034 to +0.034. With this formula you have values from 0 to 69 to put on servo range values, because I found that you can´t input negative or decimal values with 7.7 version. But I suppose due to residual decimal values, servo keeps energized and buzzing instead moves and keep quite and stil. This is a possible bug that I want to report,

Thanks a lot for your help with this possible bug, or any suggestion to avoid this problem with servo.
2019-11-11 18:57
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2921
Supporter
Hi eapc.piloto

At first Thank you for your Reply.

Whatever this looks like a BUG...... I will say this is a long known "bad fact" from Mobiflight.....
I Already wrote in the topic below .....

iconpizman82:


3. If needed you must recalculate the value. ( Mostly if it is negative/positiv ) I not work with servo motors but i think i remember that Servos have problems with negative values.
So if your Offset have a range from for example -2000 (Lowest point) and +6000 (Highest Point) THEN you need to enable transform field with entry "$+2000"
So the Value is NOW from 0-8000 ( and never can include negative values)



Same with the "decimal" Problematic. I not wrote this in that Topic here and cause most users in Mobiflight know that a Config can never show "decimals" on Output side.

You can see it verry easy.... Read a FLOAT Value of your Choice .... And check the 2 Collums.... "FSUIPC Value" and "Output Value" .....
You will see. The Left Side is the "raw Value including the decimal..... The Right is the Output Value that is send to a Display or controll a Motor.
For example a Value of 1,0001 result in 1 ..... A Value of 1,99999 also result in 1
As you said the recommend technic is simply to show the decimals by Multiply the Value..... 1,999 * 1000 occure in 1999.... So you can work with.

This is also need for Displays..... If your Float Raw Value is 1,67 and you like to show it on a Display then you only get "1" in that case. To Show it you must Multiply it by 100.... Then 1,67 goint into 167 ...... That is what you show on a 7Seg Display..... The Decimal on that Display is finaly just a manual activate LED on the position of our choice. Its not possible to show a Decimal Value directly.


*************
Summary.... This looks like "Bugs" but this is the main logic mobiflight work since beginning. Apollogy we never directly announce this. For me i learnd this by testing in the first days and i never again think about that cause then i know it and simply handle it same way like you also recommend.
Good Luck !
2019-11-11 22:53
Avatar
eapc.piloto
Posts: 11
Hi pizman for your answer, and thanks for new information. It confirms that I was in right path. :thumbup:

Respect to possible bug, I was not meaning directly to math formula, but the phisical servo keeps energized (feels like buzzing) with some values, and others is not (as it has to be).
Maybe even with decimal convertion, some remanent decimals causes to servo buzz with vibrating and noise results.
Resuming: some values with remanent decimals causes that servo buzzes meanwhile values close to integral values maintain servo quite.

I hope I get myself understandable! (Sometimes my english redaction is poor!)
2019-11-13 02:55
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2921
Supporter
That should be not happen.

Is the problem "in the middle" of the range or on the start/end point.

In the Middle its maby a problem of to much numbers..... If a Servo got e.g. 1000 Positions and you use 5000 Values then maby a value is exactly between 2 points and system start jumping.
Try to downsize the "numbers" .
For example Raw Value = 1-1000 ...... Say in Servo Setting MIN 0 MAX 100 and use Transformfield $/10
So you reduce steps from 1000 to 100

***

If Problem is on start/end you moby "Override" the range.
If you say Servo Value MIN 0 MAX 1000 and your Sim Value is going to 1001 for example then your servo try to reach 1001 ( a little above the end) But it can´t in case of mechanical endstop. ..... So it will turn and turn and turn until it goin broke maby.

To solve this we normaly use interpolation or a good logic.

With interpolation in upper example i would say .... -1000 = 0 ...... 0=1 ....... 1000=999 ....... 9999=1000
Now All below 0 would be 0 ....... The real range go from 1-999 ..... And all above 1000 is set to 1000
Now you cover both ends..... If Sim Value is to low or to high this will coverd by the 0-1 and 999-1000 Positions.

Another way is to Use a transform or Compare....
If Sim Value can never be below Zero then you not need to cover the lower end......
But Maby the Upper...... So you can show a Climbrate of 80° by Servo but sure you can also climb up to 90° .
Here you make a transform and say..... If Sim Value is Above 80° then SET 80° ....... Means all above the Servo Limit is simply shown as highest value that is allowed.
In Compare this is just a simple entry..... For Transform you need something like "if($>80,80,$)


If your problem is not solved with this hints tell us what exactly happen and what offsets / situations are used to reproduce that.
Also test maby another Servo..... Maby this is just a manifactur issue.
Good Luck !
2019-11-13 08:23
Avatar
DocMoebiuz
Moderator
From: NW of KPWK, United States
Posts: 1441
I have used the SG90 mini servos when I implemented the support for servos in MobiFlight.

When I did that I noticed often that the servos continue making noise even if the value doesn’t change. I tried to optimize this as best I could but I was not able to get completely rid of it.

That’s why I personally prefer steppers. They move smooth and don’t make hardly any noise.
Have a great day!
Sebastian

MobiFlight - Simply build your own home cockpit for your favorite flight sim - FSX, Prepar3D (FSUIPC), X-Plane (XPUIPC)
2019-11-15 02:32
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2921
Supporter
iconDocMoebiuz:


That’s why I personally prefer steppers. They move smooth and don’t make hardly any noise.



100% Agree.

Whatever i not started with my final Cockpit project till now.... After first time testing Servos and Steppers with Mobiflight to gain experience i know after 5 mins that i will use Steppers only in the future !

Servos are cool for a mechanical move ..... Like building a Switch-Back function for Engine-Startswitch B737 or the AT Switch in MCP . Also cool for SpeedbrakeLeaver Automoving or any other "mechanical" Process ( Whatever solenoid are here finaly more profitable)
BUT for Gauges that need to be controlled all time, a Stepper is (for my opinion) the only useable solution.

Interesting is..... From Forum Support i see that most users decide for Servos a.t.m. Maby cause they are cheaper.... need less wires ..... Need no calibration .... have better power managment . :confused: :confused: Not know the reason but looks like they are more popular as Steppers..... Also for gauges !

Maby this is finaly wrong and the Stepper Users are much more people...... But simply ask no questions here cause there systems work fine already :P
Good Luck !
2019-11-15 11:35
icon