Controlling the Baron D55 Electric Flaps Gauge

Are you building a cockpit, planning to build one or just dreaming, this is your cockpit builder meeting point

Moderators: russ, Ralph

Message
Author
BaronD55
Posts: 33
Joined: Tue Jul 21, 2020 3:52 am
Location: 40°S,177°E

Re: Controlling the Baron D55 Electric Flaps Gauge

#11 Post by BaronD55 »

Lol. Thanks for the good humor Joe.
You are right; I do not have a pot in there because as yet I haven't got one.
However I have ordered one on-line. 22kΩ.
It would be a total disaster if I accidentally cooked this gauge because it is irreplaceable.
If I ever found another working one I imagine that it would be hundreds of US dollars.
From the aircraft that I am modelling as my sim. Was registered as P2-MFA. Nostalgia.
Its sentimental value is immeasurable.
P2-MFA in POM 1973.jpg

Ralph, I am working with P3Dv5.2.
I checked on https://www.prepar3d.com/SDKv4/sdk/refe ... 0Variables and it gives the units as "Percent over 100".
That expression leaves me unsure if I should divide the callback value by 100. I divided it because it seemed safer.
However, I think that it is also logical to think that the callback value should be multiplied by 100.
I find it ambiguous really.
Any suggestions?

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Controlling the Baron D55 Electric Flaps Gauge

#12 Post by Ralph »

Ah, you got me a little confused there. You are subscribing to a X-Plane dataref with a FSX / Prepar3D variable. You will need to change your subscribe to fsx_variable_subscribe instead of xpl_dataref_subscribe.
And indeed, FSX / Prepar3D uses 0 - 100 for percent. Aside from that, the PWM doesn't go further than 1 if you would write more than 1, so it won't break anything :)

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: Controlling the Baron D55 Electric Flaps Gauge

#13 Post by Tetrachromat »

djw4250@gmail.com wrote: Thu Feb 17, 2022 7:17 pm .. units as "Percent over 100".

That expression leaves me unsure if I should divide the callback value by 100.

Any suggestions?
Hi there

A subscription for a variable with unit "Percent over 100" will usually return a value in the range of 0.0 ... 1.0. There are a few variables where the range can got into negative or values slightly above +1.0. So check your ranges or cap the return values.

Paul

BaronD55
Posts: 33
Joined: Tue Jul 21, 2020 3:52 am
Location: 40°S,177°E

Re: Controlling the Baron D55 Electric Flaps Gauge

#14 Post by BaronD55 »

Hi Ralph,
Yes you are right. I don't know why I wrote it that way. Corrected. Thanks :)
So dividing the P3D return (0-100) by 100 puts it in the range that PWM can handle (0.00-1.00).
Paul, your comment is noted, thanks.

Now the gauge is working but it surges!

By 'surging' I mean that it seems to get a stream of data for 500msecs (during which the needle moves smoothly) then pauses for 500ms and then surges forward with the next pulse of data. It does this until the flaps reach the end of their travel.

I have a movie of this but apparently I am not allowed to upload it

Checking the console window I see that the flow of values being passed to my callback function from the variable subscription is also surging.

Is there any way to overcome this and get a smoother feed of data?

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Controlling the Baron D55 Electric Flaps Gauge

#15 Post by Ralph »

You can monitor the incoming data with the Viewer, even without the instrument running. It might be that the output value of the simulator is that way.
Maybe try the right flaps, or try this one: TRAILING EDGE FLAPS LEFT ANGLE
Or there are some network issues. You can try setting the connection to manual in the Settings tab.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Controlling the Baron D55 Electric Flaps Gauge

#16 Post by jph »

The 'surging' is definitely not an issue with the hardware as you have noted it is coming from the program. Perhaps the data coming in from P3D is trying to simulate the flap movement between stages ? . sounds very strange though. @Ralph Could this be a buffering issue ? - also Does P3D have a data ref type viewer ? - that would isolate the source.
Joe
Joe. CISSP, MSc.

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Controlling the Baron D55 Electric Flaps Gauge

#17 Post by Ralph »

You can run a virtual instrument and see what that does, but I've never seen it. Like Joe said, it might be the stages. I don't know about any buffering.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Controlling the Baron D55 Electric Flaps Gauge

#18 Post by jph »

@djw4250@gmail.com
I understand what you are saying re the gauge and propose you do the following.
fit a 10K resistor permanently in series with one of the gauge connections and attach this to the gauge body - a bit of hot glue will do or simply onto you little vero board on the back of the gauge. This always stays with the gauge along with a sticker / note saying MAX 5V !.
The 10k, if connected directly to 5V, will pin the needle but won't damage the gauge.
Slightly mod the original design at some point to use a lower value variable resistor (suggest 10K value also for the replacement variable resistor) in series with the existing 10K safety resistor on the gauge/
You can use your existing 22K but of course it will only be of any use in the lower 20 to 30 %. Best solution as mentioned above is to change the 22K variable resistor to a 10K variable in series with the new 10K gauge protection resistor.

You will only need crash helmet and cricket 'box' then. ;)
Joe
Last edited by jph on Fri Feb 18, 2022 9:49 am, edited 1 time in total.
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Controlling the Baron D55 Electric Flaps Gauge

#19 Post by jph »

Ralph wrote: Fri Feb 18, 2022 9:11 am You can run a virtual instrument and see what that does, but I've never seen it. Like Joe said, it might be the stages. I don't know about any buffering.
Hi Ralph, I was thinking of maybe some kind of incoming data buffer in code in AM that was filling ?. But if there is a way of seeing the P3Var directly within P3D - ie - BEFORE AM then the issue is absolutely identified. If the data from the var in p3D is acting in that way then there is nothing you can do with that specific variable as it is internal to P3d. As you said, you can always try another var that gives the same desired result.
Joe
Joe. CISSP, MSc.

BaronD55
Posts: 33
Joined: Tue Jul 21, 2020 3:52 am
Location: 40°S,177°E

Re: Controlling the Baron D55 Electric Flaps Gauge

#20 Post by BaronD55 »

Awesome, helpful discussion - thanks.
Joe, the sim only has two stages (3 positions) for the flaps. Up, 15° & 30° but there are whole lot more "surges" than that.
You are right about finding a way to view the data stream before AM.
However, the simplest thing for me to do is try a different variable and/or try the manual network connection.
If neither of those workarounds is successful then I will try to find out if P3D has a data ref type viewer which, if it does, would clarify the situation a bit. I vaguely remember something like that being accessible from one of the menus in the main window of the sim.

Post Reply