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
pluckas
Posts: 63
Supporter
Hi all,

I've fabricated a dual stepper duct pressure gauge using 28BYJ-48 / ULN2003 stepper motors.

I've managed to get good results with trial and error, but I'm still a little confused on what the "best" values for sim/stepper might be, and whether or not interpolation is needed (my understanding is only for non-linear scenarios).

I believe this stepper has 2038 steps per revolution, and I'm combining this with a gauge that has a scale range from 0 - 80 over approximately 75% of its full circle (ie, the duct press gauge).

Does anyone have any tips on how to consistently approach the configuration of stepper motors for different gauges, rather than my 'trial and error' method?

Many thanks,

Paul
2019-11-03 12:08
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2921
Supporter
Hi
I wrote a guide for this long time ago..... But i can´t find it a.t.m.

I use the "360 Degrees Methode"

This can be done for all Gauges.... Whatever Linear or Non Linear..... Sure for Linear Gauges this is basicly not needed and let Mobiflight do some unless worksteps..... But finaly the result is the same. ( For Endless Gauges ( more then 1 circle like Altimeter, Compas etc) we use another technic.

Step 1 : Find out the number of Steps of your Motor. You say "2038" Thats not normal. In most cases a Stepper got 2048 Steps .... Some got 1024 and other got 4096 . Until So i think you mean "2048" finaly.

To test this the most easy way is to use in settings " Sim: 1000 Stepper 2048 Test Value 1000" and Run the Test Mode.
If it turn exactly 360° its a 2048 Stepper..... If it turn only 180° its a 4096 Stepper..... If it turn TWO Full Circles then its a 1024 Stepper.

Step 2 : Use for SIM Value always 3600 ..... For Stepper Value you use the correct number from Step 1...... 2048 eg.

Step 3 : Set Zero Point Where the Gauge should show the Lowest Sim Value.

Step 4 : Enable Interpolation

Step 5: Think about the "Range of your Gauge" .... You say for example 75% Of full Circle...... this means it turns 270 Degrees. In our Example we use 3600 as Sim Value ( So a Full Circle is 360° = 3600 ...... If your Gauge should move only 75% means 270° means until Value 2700

Setp 6 :
A ) Linear Gauges : Set in interpolation 2 Lines ..... Lowest Sim Value ( for eample 0 ) = 0 ..... Highest Sim Value ( For example 16383) = 2700 ( With this 75% situation). If you need a Gauge with only 50% Turning Range you say here Highest Sim Value = 1800
In case the Value is Linear all is fine and your gauge already work.

B ) NonLinear Gauges : Here you do the same..... Lowest Sim Value = 0 Highest Sim Value = Range of Gauge 2700 e.g.
BUT Now you must also include one or multiple points between. For example in a Flaps Gauge you will create a Value for every Position like 1,2,5,10,15,30,40
Here the "360 Methode" is also helpfull..... You simply check the angle from Zero Point to the needed Position on your printed Gauge Label ( With a gemometric triangle for example) .... If the Falps 10 Point is exactly 32° angle from Zero Position then this means 320 Output Value .... If its in 127 Degrees then its Value 1270.
So finaly you need for every point the Raw Sim Value that comes from FSUIPC when that ituation occures AND you need the calculated Position where your Motor should be.
Try some Points for example 3-4 between and check the gauge. If its not accurate enough set another 3-4 Points between the others. As More Points as more accurate.


Last Note:
For pure linear Gauges you not need this as i said. Here you can also limit the Gauge by reducing the number of Steps. If you got 2048 Steps and you need only 75% then 2048*0,75 = 1536 . For example Your Sim Value shows temperature from 0-100° and have value from 0-100 then you say.... SIM 100 Stepper 1536
Then 100° means Value 100 and this turn the Motor 1536 Steps to the Right .... So it end at exactly 75%

OR Change the Sim Value by a multiplication.
Same example but now you let the Stepper Value at 2048 ..... Now 100° would turn 100% ..... If you now say in transform $*0.75 then every output value is just 3/4 of original value..... 100° C result now in a Output of only 75 so Your Gauge turn only 75% .


Summary..... Lots of possible ways..... The 360° Methode is easy for all situatiations. If you find no better solution yourself simply use it.
Good Luck !
2019-11-03 15:42
Avatar
pluckas
Posts: 63
Supporter
Very useful, thanks Piz.

BTW, this little stepper uses a 64:1 reduction gearbox. Someone on the internet spent some time determining that it's actually 63.68395:1. So, it's closer to 2038 than 2048, but this is a totally unnecessary level of accuracy ;-)

Is there any reason that you use 3600 as your starting SIM value. Why not 360 (or some other arbitrary value)?

Thanks for your detailed reply,

Paul
2019-11-04 02:19
Avatar
StephanHo
From: EDDG, Germany
Posts: 1370
Supporter
Hi Paul,

360 is a full circle. At 360 steps for a full circle, this would be 1 degree per step. You see what I want out of.
With the enlargement by a factor of 10, I also get an increase of the resolution by this factor. Thus, the step size is 0.1 degrees and the transitions of the individual steps are softer and not so abrupt.
It depends on the application, which value I take. I need a rough display, I take a small value, I want soft, flowing transitions, I take a great value. You can try this with any value. But pay attention to the implementation of the values ​​provided by FSUIPC. The interpolation table is suitable for this purpose.

I realized the flaps display with this stepper. The pointer does not go the 360 ​​degrees, but 270 and so I can reference everything about the full circle. 270 degrees are 3/4 of a full circle and accordingly, I can then accurately represent everything in this context.

I hope this explanation will help you further.
Grüße,
Stephan
2019-11-04 11:45
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2921
Supporter
Stephan basicly explane all correct....

The key is to know..... Mobiflight have on Output Side only Full Integer Numbers ( For Motors) . It not know a decimal value.

If you use 360 for SIM then you have 360 different Values and your Motor have ( full circle in use) ~~ 2000 Steps.
That mean if your Sim Value increase by 1 then the motor runs ~~ 5-6 Steps. This occure in a not smooth jumping.
If you use 3600 then a increase of 1 in Sim Value is less then 1 Step..... Increase by 2 then is nearly 1 step.

With this trick you can enlarge also a Raw value..... For example in a Compass. This is a deciaml Value from 0,000 until 359,999 BUT Mobiflight will see only the full numbers in the Motor Controll.....
So a Value of 100,001 and a value of 100,999 is both finaly 100. Result.... Your Motor jump by 1 degree ( 6 Steps) everytime if a new degree is starting but do NOTHING between.

So here you say for example $*10 ..... Then a Value like 100,1 result in 1001 .... A Value like 100,9 result in 1009 ....
You see.... Now every degree is splittet in 10 additional steps.

Note.... This system have a physical Border..... The Number of Steps from the Motor.
In the Compas example you can technical say $*100 ..... Then you have 100 small steps between two degrees...... BUT As i explane above the Motor itself can only have maby 5-6 Steps in a 1 Degree Range...... So 100 Values do the same like 10 Values..... Cause the Step Number is just 6.

Summary to benefit from this the SIM Value for the Motor must be nearly ( or bigger) then the number of steps from the Motor..... If Value is lower ( like SIM 360 STEPPER 2048) then you "loose" this additional steps and gauge jump instead to be smooth. If its extremly higher then there is no error..... But also no more benefit.
Good Luck !
2019-11-04 15:08
Avatar
pluckas
Posts: 63
Supporter
That's an excellent and very useful description. Thanks both.

Paul
2019-11-04 15:27
icon