Welcome to Cockpitbuilders.com. Please login or sign up.

April 27, 2024, 02:08:55 AM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
473 Guests, 1 User
Members
  • Total Members: 4,154
  • Latest: xyligo
Stats
  • Total Posts: 59,641
  • Total Topics: 7,853
  • Online today: 506
  • Online ever: 582
  • (January 22, 2020, 08:44:01 AM)
Users Online
Users: 1
Guests: 473
Total: 474

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

flap indicator interface with Fs9

Started by Mach7, August 03, 2023, 04:23:14 PM

Previous topic - Next topic

0 Members and 6 Guests are viewing this topic.

Mach7

Hello Everyone,

I want to interface a (real) flap indicator for my BAe 146 simpit. I was thinking about a dc servo motor board, but this gauge would not accomodate this type of application. How would I go about setting this up as a 'plug and play' unit?

The gauge is a 5 volt unit...and I have already applied 1.5 volts to test the needle...and it moves.

Thanks in advance


mickc

Easiest way would be to use something like a Phidgets 4-Analog board. These will put out -/+ 10v, so put a resistor in series with it.

_alioth_


It seems to be a galvanometer.

You should tell which simulator and how are you interfacing the software with the cockpit.

The cheap way...  Arduino/teensy to get data from simulator, PWM output pin and an uln2803a chip. 5-12v power supply.

With one arduino and one uln2803a chip you can drive 8 galvanometer gauges.

Mach7

Hello, here are more specifics with respect to my question.

I am using FS2004 with QW 146 as my sim platform. The flap lever hardware is connected to the Bodnar 836x joystick board through a linear potentiometer. I am currently using a modified dc servo motor gauge using  opencockpits DC servo motor board programed through SIOC.

ame

Quote from: _alioth_ on August 03, 2023, 10:46:51 PMIt seems to be a galvanometer.

You should tell which simulator and how are you interfacing the software with the cockpit.

The cheap way...  Arduino/teensy to get data from simulator, PWM output pin and an uln2803a chip. 5-12v power supply.

With one arduino and one uln2803a chip you can drive 8 galvanometer gauges.

I believe this is a good starting point. And it might not be necessary to have the buffer.

As my first experiment I'd probably try the Arduino "fade" example and hook up the instrument instead of an LED. Since the instrument is rated at 5V it shouldn't be damaged.

After the experiment I'd think about what to do next.

Mach7

Sounds like a plan...will take a deeper look when I get home next week....more questions to follow...

Mach7

In the meantime...(and this is due to the fact that I have had only one interaction with Arduino thanks to ame). for my own clarification,  using my Flap selector lever through the 836X board to operate the flaps, as I do now, should (will) provide the input ( through USB interface from the FS9 program)to Arduino which in turn will send a (hard wired output) to the mechanical flap indicator gauge for selected flap positions.In order for Arduino to do this I will have to write and download code into the chip as I (we) did for the TMS (thrust management system)project. Am I close so far?

ame

Quote from: Mach7 on August 05, 2023, 07:07:15 AMIn the meantime...(and this is due to the fact that I have had only one interaction with Arduino thanks to ame). for my own clarification,  using my Flap selector lever through the 836X board to operate the flaps, as I do now, should (will) provide the input ( through USB interface from the FS9 program)to Arduino which in turn will send a (hard wired output) to the mechanical flap indicator gauge for selected flap positions.In order for Arduino to do this I will have to write and download code into the chip as I (we) did for the TMS (thrust management system)project. Am I close so far?
Pretty much. The details will vary, but data has to move around somehow, and actions must be initiated depending on the data.

Sometimes there are shortcuts insofar as you can take advantage of a side effect of something, or of something that is already present, but it's probably best to implement a naive solution and improve from there.

So the project boils down to:
Figure out where to get the input value, and what it means.
Figure out how to drive the gauge, including reliable conversion from flap angle (a number) to physical position.
Figure out how to get the data from the input to the output.

Out of interest, how many gauges will be present? This will help for planning ahead.

Mach7

Hello ame..there is only one flap gauge..but I am thinking now of also connecting up my fuel quantity gauges..which are slso the same internal type..through arguing using the fs9 outputs.

ame

Ok. Well I generally start with "what's the simplest thing that could possibly work?"

In this case, since the instrument responds to a 0-5V signal you may be able to use a PWM output from the Arduino directly.

The first step is to acquire your Arduino and set it up on your PC with the Arduino programming environment. Try a couple of examples on the Arduino to be confident that you can upload new code and everything is working.

Next, look at the PWM example code (which is documented here https://docs.arduino.cc/built-in-examples/basics/Fade).

You should be able to wire up the instrument in place of the LED, and no resistor is needed. I'd also change delay(30) on the last line to delay(100) or delay(500) to slow down the rate of change.

This will use PWM to alter the percentage of power supplied to the output pin, and the gauge should move in sympathy. Actually, it's a value from 0 to 255, with 0 representing 0%, and 255 representing 100%. One downside is of course you will only have 255 discrete positions on the gauge, but that can be addressed later.

If that works then you have the basic implementation ready to go. If it doesn't, then it's time for plan B (which I don't currently have to hand).

Mach7

Thanks @ame

This is exactly what I will do. I am going to check my inventory, but I think I have an Arduino uno in stock. After the LED I will try the flap indicator gauge.

More to follow

Jim


_alioth_

#11
Try Ame proposed approach first.

Later, my complete diagram would be something like this:



https://i.imgur.com/OZ8zkx7.jpeg

Why using the uln2803a? We don't know the current needed to drive the flap gauge. If you direct drive the galvanometer inside, and you exceed the max arduino pin current, you can destroy the Arduino.  With the 2803 buffer you are safe. (Max recommended current in arduino pin is 20mah, and due/teensy about 5-10mah, which is not so much).

Why the multiturn 10k pot? imagine you do a test and see that analogWrite (pin, 50) gets the maximun scale value. Then you only have 50 steps to drive the needle from 0 to 50.
In this case, do an analogWrite (pin, 255) and turn pot to exactly get the max value. In this way you get the 255 steps. 255 steps in a gauge like this is great.
You can get 1024 or 4096 steps using arduino due, teensy... etc, or some complicated methods. But 255 is great.

There are a lot of galvanometer gauges that need 12v. If you find this case with other gauges just remove the 5v line from arduino to uln2803a com_d pin and use a 12v power supply. Connect +12v to Com_d and GND to arduino GND

If you have a mixture of 12v and 5v galvanometers, then use 12v for all of them. Later, setup every multiturn pot to get the exactly max position with analogWrite( each galvanometer PIN, 255).

The second part would be writing a function to drive the needle exactly where you want.
I could help you when you get to this part.

Arturo.

Mach7

Thanks @_aloith,

I think the current to drive the gauge is quite small...in attempting to find the pins to drive the needle I used a 1.5 volt battery and used trial and error. When I did find the correct pins the needle moved quite substantially, so not sure if the uln2803a would be necessary. The 10k pot idea is a good one for sure.

_alioth_

Quote from: Mach7 on August 09, 2023, 05:27:40 AMThanks @_aloith,

I think the current to drive the gauge is quite small...in attempting to find the pins to drive the needle I used a 1.5 volt battery and used trial and error. When I did find the correct pins the needle moved quite substantially, so not sure if the uln2803a would be necessary. The 10k pot idea is a good one for sure.


Be careful. Voltage and amperage are not the same thing!
Just because it moves a lot with a 1.5v battery doesn't mean anything about the amperage.

If you want to measure it correctly, set 5v to see all the deflection of the needle and put an ammeter in series to see how much current there is at that moment.

It needs to be lower than 20mah to be driven by Arduino uno/nano/mega, and about 10mah with arduino Due or teensy.

Arturo.

Mach7

@_Alioth_, good point.

So, my progress thus far is finding the pins that control the gauge and rummaging around my spare parts to fine a quick connector that will accommodate this request.

I have also been researching and reading about Arduino interface applications, but I want to once again clarify one important part of my project using the attached picture.

My desire is to have the Arduino control the flap gauge through flap selector commands from the 836x board to FS9. Then usb output to arduino to manipulate the flap indicator gauge.

In other words, I am looking for clarification that this is something that is possible within Arduino, as most of the researched info I have found has a switch, pot, or button attached directly ot the board that will then close or modulate a circuit to operate a specific item within flight sim.

Jim

ame

Quote from: _alioth_ on August 09, 2023, 09:53:39 PM
Quote from: Mach7 on August 09, 2023, 05:27:40 AMThanks @_aloith,

I think the current to drive the gauge is quite small...in attempting to find the pins to drive the needle I used a 1.5 volt battery and used trial and error. When I did find the correct pins the needle moved quite substantially, so not sure if the uln2803a would be necessary. The 10k pot idea is a good one for sure.


Be careful. Voltage and amperage are not the same thing!
Just because it moves a lot with a 1.5v battery doesn't mean anything about the amperage.

If you want to measure it correctly, set 5v to see all the deflection of the needle and put an ammeter in series to see how much current there is at that moment.

It needs to be lower than 20mah to be driven by Arduino uno/nano/mega, and about 10mah with arduino Due or teensy.

Arturo.

I expect as the meter is designed to work from 5V it will work from the Arduino pwm output. I found a similar project before I gave advice:
https://hackaday.io/project/9696-not-another-darsonval-movement-clock

ame

Quote from: Mach7 on August 10, 2023, 06:47:39 AM@_Alioth_, good point.

So, my progress thus far is finding the pins that control the gauge and rummaging around my spare parts to fine a quick connector that will accommodate this request.

I have also been researching and reading about Arduino interface applications, but I want to once again clarify one important part of my project using the attached picture.

My desire is to have the Arduino control the flap gauge through flap selector commands from the 836x board to FS9. Then usb output to arduino to manipulate the flap indicator gauge.

In other words, I am looking for clarification that this is something that is possible within Arduino, as most of the researched info I have found has a switch, pot, or button attached directly ot the board that will then close or modulate a circuit to operate a specific item within flight sim.

Jim
I'd say yes, but it will take a bit of research to find out how.

I thought it would be better to start at the end, and determine how to drive the gauge, on the assumption that if you couldn't drive the gauge then there was no point figuring the other stuff out.

You could do all the development in parallel, but there's only one of you.

Mach7

As per ame's guidelines, I connected up the Arduino UNO as per the schematic with the successful download of the "Fade" program.

I have included a link to my youtube channel to see the operation.

I did not change any code in the text, so this is the direct result I got after connecting up 5 volts of power. (note I used a 5 volt dry cell battery, so the voltage may have been a bit below 5)

I suppose we can agree that the gauge can accept PWM outputs directly from the board...so what are the next steps in the implementation?

Jim

https://www.youtube.com/watch?v=MKtGRb3HmVk

ame

That's great! It's not clear from the video, but does the needle cover the entire range? Did you have the meter connected directly to the Arduino, or is there a resistor in series?

If the needle covers the entire range, great! If not, it needs to be buffered, as alioth suggests. This could be done with a transistor, or uln2803a.

Next, you probably need a function in the Arduino code which converts the flaps value from the simulator into a PWM value to output. If you're lucky this will be linear, and you can use a simple equation like:

pwm=flap_angle_degrees*7.727

That will convert a number from 0-33 into 0-255.

If you're unlucky then it's non-linear, but hopefully predictable in some way.

Either way, you can print out the PWM value in the code and make a note of the value at each marked position on the gauge and figure it out.

But, this is a great start.

Mach7

Hello ame,

No, the needle did not cover the entire range. I connected the gauge directly to the Arduino board, no resister.

ame

Ok. If the needle doesn't cover the full range and there is no resistor present then it means this approach won't work. It could mean that a buffer is needed, as suggested, or I wonder if you have an air core meter:
https://en.m.wikipedia.org/wiki/Air_core_gauge

This needs a different method to drive the needle.

Mach7

With respect to the needle movement...would this not be a function of the values set in the "Fade" program...in other words if the program was modified could the needle not be 'forced' to move the entire range of the gauge?

Mach7

@ame, I don't think it is an air core gauge, but rather closer to a Desynn Type Position Indicator. The fuel gauges are the same construct as well.

With respect to the flap gauge, it does not travel a full 360 degrees, but rather closer to 250 degrees, (0 degree flap angle to 33 flap angle on the dial).

ame

You could also try emailing the manufacturer.
https://www.rogersonkratos.com/

Bit of a long shot, but it might work. Even if they would describe the kind of mechanism inside, or a wiring diagram, it would help. Even to avoid damaging the unit.

I haven't had much luck googling the part number, other to find that it is a Rogerson Kratos flaps indicator, which I pretty much knew. :)

ame

Quote from: Mach7 on August 10, 2023, 06:45:51 PMWith respect to the needle movement...would this not be a function of the values set in the "Fade" program...in other words if the program was modified could the needle not be 'forced' to move the entire range of the gauge?
The fade example program does indeed cover the whole PWM range from 0 to 255. If you forced the value to 255 it's the same as 100% on, and will basically output a constant 5V on the GPIO pin.

It could be that the Arduino can not source enough current to drive the coil to fsd, so a buffer may be necessary. Or perhaps the meter movement is very sluggish, and increasing the delay in the loop (therefore changing the output more slowly) would help.

This was basically the simplest experiment to glean information.

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate