PDA

View Full Version : Arduino driven VOR



SimSupervisor
09-06-2015, 10:41 PM
I had a couple Narco VOR instruments, and spent some time figuring out how they work, then some more time to figure out how to control them from Arduino, and ended up with quite a nice result that I wanted to share:


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

Both the CDI needle and to-from indicators work the same way, and its like bi-directional voltmeter indicator, where if the two reference pins have a certain differential the indicator goes on one side, and if they have the opposite differential they go the other side.

The OBS ring was quite harder to understand, and then even harder to figure out what to do with them in order to get the OBS bearing value. Literally, its like there are four potentiometer, where there is a common reference, and a reference at 0, 90, 180 and 270 degrees.

Using that I could read three points on the scale, that each gives good reading on +- 90 degrees. Using them combined gives the whole 360 degrees with a certain precision; and then it is used with the bearing received (via flight sim, trough link2fs, to the arduino board) from the simulated VOR station, and reacts accordingly, interacting with the user's OBS knob value.

Its actually quite fun to play with. :)

hyamesto
09-07-2015, 02:06 AM
Great. Can you post a squematic of your connections? Just for curiosity....
I have one similar, but the OBS internal wiring is broken. (by my mistake).
What is your "certain precision?
3 years earlier I follow this post about the same instrument.
The error goes from 4,5 to 6,23 degrees (too much for real flying)

You can see in:

http://www.mycockpit.org/forums/showthread.php?t=25328

Regards.
Horacio.

SimSupervisor
09-07-2015, 03:35 AM
I didn't find that thread when I searched the forum for VOR information. Would have given me a headstart and be helpful.
Still, I had a damaged unit that I unmounted (and will likely use the frame for another instrument) so I had a good idea of the internals. But, I would have liked to have seen that thread! :)

here's my notes on the internal wiring. Its mainly a huge potentiometer, with taps at every 90 degrees.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10666&stc=1

for me, it was all linear. So, what I decided to do was to use all the pins. One GND, and 3 OUTPUT signals. I programmed them on a timer, but essentially what happens is that you set one output pin HIGH, the other ones LOW, and wait a certain time - about 100ms with my current timer. I think it could be quite lower (faster) but didn't experiment much on it, this seems to work. Then you read (analog input) the wiper pin. Repeat for the next pin, keep measuring continually.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10667&stc=1

The value is linear, and gives a good appreciation of the 90 degrees from the point of that pin. Farther than that and the arduino's HIGH signal is too dim to be read properly (value is not zero, but very very low) - Which isn't a problem, as you are measuring 3 pins at 3 different points on the 360 degrees ring...
So, at any point in the 360 degrees, you can combine the valid info from the 3 tap points you are measuring, into a unique manner -> using the higher value as linear measurment and the two others to know directions around the central angle of that reference pin.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10668&stc=1

It works good for me. The imprecision is rather small. I assumed this is caused mechanically by the hardware and would be pretty much the same with the real circuitery.


I still have one of the CS-3B that is intact, not dismantled, and the pins all read good (but it is rather discolored by age) - I'll trade it with you if its of any interest to you.

SimSupervisor
09-07-2015, 11:44 AM
The thread you posted makes a rather valid point, which explains a few things...


Rob,
Are you using the same gauge as we are? I tried the approach I think you described and I finally realized something: The distances between the numbers on the gauge isn't linear.
30 to 60 is less then 0 to 30. In fact, it appears that 30 to 45 is the same as 0 to 30. This pattern repeats around the dial, you can see it in my first photo.

I was surprized to not have to correct the analog reading values to have corresponding angles, but I think this makes the magic happen instead of a correction equation.
Nevertheless, I would have to take better measurments, but when I did the initial tests, I compared my readings with the actual numbers on the OBS ring gauge (there's one number every about 30 degrees) and they all matched up within the degree if the TO arrow was on the gauge mark.
That said, the marks are THICK, and there is only markings ever about 5 degrees. I don't think we can get more precision out of this form of hardware.

For what its worth, with my schematics I get a value between 0 and 1005, where 5-to-1005 maps a 90 degree angle around the reference point (with the 0-to-5 being the non-conclusive value passed the 90 degrees, that requires being read from another reference point)

hyamesto
09-07-2015, 02:24 PM
If only we were closer, but 8804 km = 5470 milles
is to much for send or receive solenoids, trade instruments (custom duties, tax, shipping costs) and the policies of my country on import, make that impossible (i must pay 3 times more than real value including shipping, tax, etc)....
Can you explain or make a diagram of how you connect the needle or to-from flag, to obtain negative values from arduino? and the sketch, please....
I have an idea to implement a better reading of the OBS, but i need your schematics (4 PWM outputs and 1 Analog input and some sketch idea)..... 3 years earlier i have not and arduino to make tests....

About the error, itīs a mistake than an older instrument has no good resolution. The max error is ą 1,4°, but the normal is ą 0,35°.
Remember, every dot in scale represent 2š, thatīs 10š full deflection to one side (20š full scale), in VOR.
As ILS, every dot is 0.5š (2.5š full deflection in either direction or 5š full scale) for localizer, and ILS glidepath is 0.14 degrees per dot Full scale deflection 0.7 degrees

A good reading:

http://www.csobeech.com/files/KI209A_Maintenance.pdf (http://www.csobeech.com/files/KI209A_Maintenance.pdf)


Regards.
Horacio.

SimSupervisor
09-07-2015, 03:36 PM
I do not think we get imprecision from the instrument itself, but from the low resolution of the scale used to dial in. With about 5 degrees between markings, its impossible to be precise to the fraction of a degree when entering OBS. That said, the reading I get when straight on the numbers are always consistent. I could run more tests if you want to.

BTW we don't use miles in Canada, we work the metric system. ;)

It is sad the import laws of your country make it hard to get anything shipped to you, as I would have gladly sent some your way.

For the needle, and to get negative value, I cheated a bit. We have two wires for each indicator. One I placed on about 2.5V as the center reference. To achieve that on the arduino, I used a potentiometer as a voltage divider between the 5V and GND, so I could tweak it. Each need to have their own divider, because you do not want indicator 1 influence indicator 2.

For the other pin, I used an PWM from arduino. they run from 0 to 255 so 127 is the center. I had to reduce the output of the PWM to gain resolution, and made that by adding a 3k ohm resistor between the arduino output and the instrument pin.

here's a quick reference drawing if it can help

http://www.mycockpit.org/forums/attachment.php?attachmentid=10672&stc=1

To address the needle all you need is a PWM in arduino.



On the OBS side, there's no more schematics than what I posted. I interface the OBS ring directly to the arduino pins as mentionned in previous post. You need to light up one of the pins, wait, and read. Repeat with the next one. That way, you always have a recent value to use in computation.


I admit, arduinos are awesome to help with quick prototyping. It opens up microcontrollers rather well, and even those knowledgeable in microcontrollers enjoy its ease of use. It makes prototyping easier and funier.

hyamesto
09-07-2015, 11:58 PM
You donīt need "a fraction of a degree when entering OBS". The Radial selected is ever a whole number.
If you get a correct reading in every point of the OBS, thatīs fine.

My idea in theory (like the real VOR operation) was to connect 4 PWM to the OBS (not 3 and ground as you), and simulate a sine and cosine signals. (with this 4 PWM outputs, you can feed 2 instruments OBS, like VOR1/ILS and VOR2). Later, the wiper must sum the values, but you need some sort of voltage divider (like you implement in the needle) to read the values and make some calculations.......

For the needle, i must congratulate you on your simple solution.

For the To-From Flag, why not use 2 digital outs to not waste PWM outputs?
If both Outs are low or high, the flag is centered, and other state makes flag go To or From, depending on which output is active. Only need 1 resistor.

Great Work!!!
Regards.
Horacio.

SimSupervisor
09-08-2015, 06:24 AM
For the to-from, you need three values. Low, high, and you also need the OFF position.

Now that you mention it, you could do that with two appropriately tweaked digital out with voltage dividers.
So, one pwm and one potentiometer, or two digital and two potentiometer?

I might change for digital, pwm are not that many.

hyamesto
09-08-2015, 06:34 AM
No, you need two positions only, TO and FROM.
OFF or NAV is default with no signal (Flag at restl). Except that the indicator is uncalibrated.

Regards.
Horacio

SimSupervisor
09-08-2015, 11:13 AM
Yes, you actually need the microcontroller to be able to send the correct values for the physical indicator to display it... So, you need zero (off), low (lower than zero) and high (higher than zero).


Forget real life, the microcontroller needs to be able to output the proper results ;)
With only 0 and 5v how do you tell the Arduino to display off?

meatbomber
09-08-2015, 02:15 PM
OOPS Wrong thread... was late yester day night..

Zlatko
09-08-2015, 05:21 PM
Hey, that is a great topic to read. Nevertheless – I have something to say:
I am not sure if I am right or not, but what I think I’ve noticed from the video above – the deviation needle goes as far as two –tree dots in its maximum deflection ( that is 4 – 6 degrees instead of all 5 dots = 10 deg. ) If this is the case, it might be due to the reduced voltage margin ( between 0-5 volts instead +5 … -5 ). I don’t want to criticize , since you have done a great job , especially with the reading of the OBS knob
(To be honest – I didn’t quite understand how you achieved that one. ) .
As I said – if this is the case – I would like to offer a possible solution – so – for you to achieve +5…. – 5 range and provide over-current protection to the circuitry in one go . Theoretically – it is practicable to use a ready made motor shield for Arduino ( H –bridge) like this one –
http://www.ebay.com/itm/Mini-Motor-Drive-Shield-Expansion-Board-L293D-Module-For-Arduino-UNO-MEGA2560-R3-/200982006661?hash=item2ecb760b85

They are used to change direction and speed of dc motors. For your needle you’ll need to provide signals to three of the shield pins - in1 , in 2, en 1. When FSUIPC offset value is positive – set in1 LOW, in 2 HIGH. When is negative – vice versa . And use the number 0-127 to provide pulses to en 1 pin . This changes the motor speed ( needle deflection in your example) . I am not sure if it is going to work that way, worth trying though.

All the best.
Zlatko

hyamesto
09-08-2015, 05:43 PM
As an old teacher once told me:
"Think twice, there is always a more complicated way to do", or like the american says. K.I.S.S. (Keep It Simple Stupid):-D:lol:

You can experiment virtually in:

https://123d.circuits.io/circuits/1002450-vor-flag-to-from

With this, you have -5v, 0 and +5 v. (look the motor running clockwise, and anti-clockwise) (sorry, no needle voltimeter in library).
The OFF Flag is at rest (0 volts, output 7 low, output 8 low), the TO Flag, is +5 volts (output 7 high, output 8 low), and the FROM flag is -5 volts (output 7 low, output 8 high).
And you can have the OFF Flag, with output 7 and 8 ON too.
Only 1 resistor, 2 Digital outputs, No current divisor.

Warnings: The resistor is approximate. Try with a potenciometer to find full scale, measure and replace by a resistor.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10685&stc=1

hyamesto
09-08-2015, 06:28 PM
Hi Zlatko:

The full deflection depends on serie resistor, and value of the PWM output. You can handle this by soft.
Or you can use the board found inside of micro-servos.
Just replace the motor with the needleīs galvanometer, put a resistor in serie, and use the feedback pot to center the needle. In this way, you just use 1 PWM output. (your shield needs 2 digitals and 1 PWM output)
The value of the H-Bridge Motor shield is almost the same of the cheap chinese micro-servo, and you have a couple of gears,and a motor to buid another thing......
Regards.
Horacio.

Zlatko
09-08-2015, 07:11 PM
Well , more thinking for me to be done. I'll answer tomorrow, when i figure it out how PWM + resistor would work for controlling needle range
If i don't say anything by then, it probably means you were right :)

hyamesto
09-08-2015, 08:27 PM
Zlatko:

You are right. For the needle, you need a solution like Simsupervisor (one PWM and some voltage divider), or a H-bridge like your solution, or the micro-servo board (its a H-bridge too, with a pulse width sensor to define rotation)
The flag TO-OFF-FROM is another story. Thatīs what i have made work with only 2 digital outs, like the example post earlier.
Regards.
Horacio.

SimSupervisor
09-08-2015, 10:23 PM
As an old teacher once told me:
"Think twice, there is always a more complicated way to do", or like the american says. K.I.S.S. (Keep It Simple Stupid):-D:lol:

You can experiment virtually in:

https://123d.circuits.io/circuits/1002450-vor-flag-to-from

With this, you have -5v, 0 and +5 v. (look the motor running clockwise, and anti-clockwise) (sorry, no needle voltimeter in library).
The OFF Flag is at rest (0 volts, output 7 low, output 8 low), the TO Flag, is +5 volts (output 7 high, output 8 low), and the FROM flag is -5 volts (output 7 low, output 8 high).
And you can have the OFF Flag, with output 7 and 8 ON too.
Only 1 resistor, 2 Digital outputs, No current divisor.

Warnings: The resistor is approximate. Try with a potenciometer to find full scale, measure and replace by a resistor.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10685&stc=1

As I said earlier, you can't achieve it with only one digital output, you need at least the two outputs you used in that simulation... Can't make 3 states with only two distinct values. ;)
-- I realise I mentionned voltage divider, and really this isn't needed. For some reason it made sense when I typed the message on my cellphone.
I personally went with a single PWM output when I made it, mainly because I was copying the needle, and didn't think about making it otherwise. I am using a perfboard to put all the avionics, but will want to make it out of a protoshield instead, as the arduino pins don't fit perfectly on normal perfboards... and sometimes it will stop working, which is frustrating. When I do the migration, I'll likely remove the TO-FROM PWM in favor of two properly tweaked digital out. There's not that many PWM available on a MEGA. ;)



The deviation needle goes as far as two –tree dots in its maximum deflection ( that is 4 – 6 degrees instead of all 5 dots = 10 deg. ) If this is the case, it might be due to the reduced voltage margin ( between 0-5 volts instead +5 … -5 ).

Nah, I was limiting it to these few dots. From memory I tought the VOR had its needle always visible, that's what I was aiming for. I can double its range without any issues.
Would you happen to have a video of an actual VOR being tuned?


(To be honest – I didn’t quite understand how you achieved that one. ) .
Probing the values to deduce the internal wiring, then figuring out a way to use it. It took some time, but I am very happy with the result.

Zlatko
09-09-2015, 03:53 AM
Would that video be of any help? : https://www.youtube.com/watch?v=zzXXxG-BKgA

Still can't figure it out how placing a resistor to the PWM pin would make the needle travel all distance to the very end ( 5 dots ).
In my understanding placing a resistor makes voltage "steps" measured to PWM pin smaller and in that way - needle movement - more precise but wouldn't enlarge the overall distance travelled. It would be like a man, who covers a certain distance from premise A to premise B in 10 normal steps. On the next day he is weak and capable of doing only 5 steps ( cover half distance) . So - he is trying to cheat by doing 10 small steps - still half distance travelled.
The only way i can think of -if the wires inside VOR are not going directly to the needle motor, so it is not a voltmeter working on -5 ... + 5 v , but sort of galvanometer instead, working on millivolts and connected to additional internal circuitry. That way - if you cheat the circuitry, it would provide same millivolt range .

@Horacio , i admit - your solution with servo H-bridge is more elegant one, especially if you are short of Arduino pins, but most motor shields provide outputs for 2, 3, 4 or more motors and that mean - all VOR needles driven by one shield. I am still curious about simSupervisor solution with a voltage divider and one PWM pin - if that works to its full range, that probably is the easiest way.

@SimSupervisor i meant 4 dots needle travel with your "Narco VOR, not 5 dots. Still well within visible area. Take a look at minute 1.30 with this Narco Gauge
https://www.youtube.com/watch?v=mvX6zMUQMj4

hyamesto
09-09-2015, 05:42 AM
Zlatko:

The TO-OFF-FROM flag, the CDI Needle, the Glidescope Needle, and GS-OFF flag, are galvanometers. No motor, no internal circuits. Just a galvanometer connected to cables to exterior connector.
Look this series of pictures :
http://www.mycockpit.org/forums/attachment.php?attachmentid=10688&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10689&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10690&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10691&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10692&stc=1

According with specifications manuals, the data are:

http://www.mycockpit.org/forums/attachment.php?attachmentid=10693&stc=1
Another instrument table:

http://www.mycockpit.org/forums/attachment.php?attachmentid=10694&stc=1
The resistor go in serie, to obtain 150 milivolts, in 1k ohms, 150 microamper galvanometer. Maybe you can add some capacitor to dampen needleīs movement.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10696&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10697&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10698&stc=1
This squematics work only from 0 to full scale.
Tomorrow i can send you a squematics for connect the needle as Simsupervisor, but the side of the galvanometer connected to ground, must be connected with a resistive divisor like a pot, with one side to ground, the other side to 5 volts, and the wiper to the galvanometer original ground.
And about the "elegant solution" of servo board, now in my country, its very difficult to find others alternatives. I know about hundred shields, and some fantastic absolute encoders to replace the OBS, like this:

http://www.usdigital.com/products/encoders/absolute/rotary/shaft/ma3

but govermentīs import laws make impossible to find, and/or buy online. Last time (6 years ago) make a internet buy with credit card.
Original cost x3, now its x 5 times.....
I hope this can help.

Regards.
Horacio.

hyamesto
09-09-2015, 06:28 AM
Zlatko:

I think Simsupervisor make this way:

The circuit:

http://www.mycockpit.org/forums/attachment.php?attachmentid=10699&stc=1

The 5 volts on centering pot and ground, must be taken from the same arduino. (or from external power supply, with common ground with arduino.
How its work? Supposed 2,5 volts in PWM (50% dutty cicle), centering pot to obtain 0š deflection on needle.
Now:
If PWM is 5 v, one side of galvanometer is 5v and the other is 2,5v, you get full right (or left) deflection. (left side potencial is +2,5 volts up relative to the right side)
If PWM is 0 v, one side of galvanometer is 0v and the other is still 2,5 v, you get full left (or right) deflection, (right side is +2,5 volts up relative to the left side at 0 volts).
I know i canīt take a PWM like a lineal variable volt, but itīs for simplify the concept.
And the condenser, can be used if the needle got "nervous"....

Maybe Simsupervisor can help if any mistake has be done here...

Regards.
Horacio.

Zlatko
09-09-2015, 07:10 AM
Well, i must admit - if it is a galvanometer, all that make sense.
Thank you for the good explanation provided. So - no more sound cards driving . Arduino plus some current limiting resistors
should work nicely by themselves.

PS:
I am a little sceptic about implementation of an absolute encoder - most of them don't have 360 deg. /resolution . They are more or less like a codding switch with 8 wires and that would result in 8* 8 = 64 deg. For 360 deg. would need 19 wires on the back ( i suppose ) and some port to read them all. And that makes such a fancy encoder really expensive . Analogue resolvers are expensive too. I don't know - i am not that good with electronics.

PSS: 5 * Original price, wow , that is a lot. Why not coming to live and work in Europe - not much talented people here, mostly ingenious bankers and euro-bureaucrats. And some 20% on top of all - VAT - to gather money and feed all those ( doing nothing ) people. But not much engineers and talented people, willing to do business and produce something useful.

hyamesto
09-09-2015, 08:12 AM
Zlatko:
Sound cards driving?
How do you are working?
The sound card was an idea to drive the OBS years ago!!!
Iīm study for a similar method, using 4 PWM outputs, or 4 digital outs, in sequence to read the OBS setting.
Waiting your explanation.
Regards.
Horacio.

Zlatko
09-09-2015, 09:23 AM
I don't really own such thing, working in my house. And in theory - you probably already know, what i know - all is done on the PC -side . For each radial 0-360 deg. one sound file is pre-recorded . Each sound file differs from others by its sample rate. Then the guy, who created that, wrote an application to read FSUIPC offsets and for each particular radial, he made the application sound a different file on the sound. exit. Then hi tied the sound exit to the VOR signal input. Sorry for not being of much help, i am not that good with electronics ( i am a physician by trade ).

All the best .
Zlatko.

SimSupervisor
09-09-2015, 11:48 AM
The sound card is just a digital to analog converter, like we use pwm for... It's not a bad implementation if you do not have a microcontroller, but I would still suggest getting an arduino. It's cheap and effective.


Zlatko:

I think Simsupervisor make this way:

The circuit:

http://www.mycockpit.org/forums/attachment.php?attachmentid=10699&stc=1

The 5 volts on centering pot and ground, must be taken from the same arduino. (or from external power supply, with common ground with arduino.
How its work? Supposed 2,5 volts in PWM (50% dutty cicle), centering pot to obtain 0š deflection on needle.
Now:
If PWM is 5 v, one side of galvanometer is 5v and the other is 2,5v, you get full right (or left) deflection. (left side potencial is +2,5 volts up relative to the right side)
If PWM is 0 v, one side of galvanometer is 0v and the other is still 2,5 v, you get full left (or right) deflection, (right side is +2,5 volts up relative to the left side at 0 volts).
I know i canīt take a PWM like a lineal variable volt, but itīs for simplify the concept.
And the condenser, can be used if the needle got "nervous"....

Maybe Simsupervisor can help if any mistake has be done here...

Regards.
Horacio.

Horacio is right. Except, the meter reacts on way less than 5v... At full 5V and with 50% duty cycle, being centered, you floor or roof the needle with about 10% pwm variation. That is why I used a resistor, to increase granularity. But then the output is no longer centered at 2.5v so having a potentiometer to adjust the needle does help.

Horacio can you get electronics locally? Without getting a stepper shield, a h-bridge can drive a stepper motor, one chip and a few basic components will interface nicely to arduino. I salvaged an interesting bipolar stepper from a broken hard disk that I might use for the heading indicator...

hyamesto
09-10-2015, 12:41 AM
Horacio can you get electronics locally? Without getting a stepper shield, a h-bridge can drive a stepper motor, one chip and a few basic components will interface nicely to arduino. I salvaged an interesting bipolar stepper from a broken hard disk that I might use for the heading indicator...

Yes, i can get electronics, but we are living in govermentīs pre-election climax:roll:. Time to sit-down, relax and wait.
Dealers are crazy with the price of components (exchange rates are 1 u$s= 16$ argentina).
For example:
A MAX7219 chip only: u$s 7,80.-
A 64 dot led matrix, with pcb, and MAX7219 chip u$s 6,25.- (ready to connect, but i donīt need the matrix)
7-segment led display "Sorry, i have 2 of 3 cms long, 1 green, other red, one common cathode, the other common anode"
Only one dealer to each component, in different cities.
They are crazy, an so on:
Garmin Aera 500: Iīm a PPL, and i want to fly in real life and connect to Simulator with GPSout....
Oficial dealer in every place of world, i can buy for u$s 600.- (dollar bill)
Here in Argentina i must pay u$s 1.600.- (in dollar bill too !!!!!!, forget exchange rates).
And stupids dealers: How you can sell a PIC18F4450 without socket, and sell crystal oscillators of every value, except the value needed for that PIC????????

And yes, i salvaged near 20 steppers, sensors, etc , and others motors from old printers, hard disks, etc... they are waiting better times....
Sorry for the response, nothing to do with the VOR....:lol::lol::lol:
Regards.
Horacio.

hyamesto
09-10-2015, 05:24 AM
Hello everybody: Great news....

http://www.mycockpit.org/forums/attachment.php?attachmentid=10699&stc=1


This circuit is working better than expected......
The potenciometers are 10K linear, the centering is perfect. Full range from left, to right, setting with limiter pot.

This is the test sketch:


int n=1;
int out=127;
//------------------
void setup()
{
pinMode(6, OUTPUT);
}
//---------------------
void loop() {
out+=n; if (out==224 || out==30) n=-n;
analogWrite (6, out);
delay (20);
}


Range from 30 to 224, thatīs 194 steps.....

A recommendation: use shielded cable and multiturn presets like this:

http://www.mycockpit.org/forums/attachment.php?attachmentid=10701&stc=1
Tomorrow will upload a video, and try the TO-OFF-FROM flag concept.

Regards.
Horacio.

Zlatko
09-10-2015, 06:05 AM
That is really exciting .
Thanks. The last thing - how much power galvanometer would consume . Is it safe to tie
it directly to PWM pin.
I think - we should repeat the experiment with 5v analogue voltmeter. ( just the part with the galvanometer made for integration in face panels). They are dirty cheap and readily available on the market .

http://www.mycockpit.org/forums/attachment.php?attachmentid=10703&stc=1

SimSupervisor
09-10-2015, 08:40 AM
Horacio, I used the same type multiturn 10k potentiometer too. 194 steps for the needle is awesome. Glad it's working on yours too and not pure luck on my end :)

Zlatko, these meters shouldn't sink too much current. I know I am interfacing directly to my pwm and am not worried.
I interfaced with a similar voltmeter as you posted, before. Main difference is that it's not self centered.... Not needing positive and negative is actually easier.

I am trying to find some of those meters with the same dimensions as the ones on a Cessna 150; no luck so far. I guess I will use bigger ones.

Not fully related, but I am strongly thinking about using the casing and obs ring of a broken unit in another instrument, the 360 reading could be useful for the heading indicator.

hyamesto
09-10-2015, 02:22 PM
Zlatko:
The power of the galvanometer is in the range of 50 to 150 microamper, (you can connect near 30 to one output!!!)
Look at the black screw in the base of instrument. It is to regulate the rest position of the needle. Some voltmeters can be rotated up to the central position. For more precise operation, you can remove the built-in serie resistor, and use only the galvanometer like the circuit that i use. (Donīt forget limiter potenciometer if you remove the internal resistor!!)
http://www.mycockpit.org/forums/attachment.php?attachmentid=10708&stc=1

But with my connection, you donīt need that, because you can regulate position with the centering potenciometer. Only disadvantage, is when you power off the instrument, the needle is go to rest the left side.

Or you can put a charge-discharge ammeter as the photo, removing the shunt resistor, and using external potenciometers.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10709&stc=1

Simsupervisor:
You can disassembled to remove only the galvanometer and build the rest of the instrument.
Or you cand find indicators used in older cars, with more appropriate needles.
Some old indicators have a range of 270š like this......
http://www.mycockpit.org/forums/attachment.php?attachmentid=10710&stc=1


Later i will upload the videos.

Regards.
Horacio.

SimSupervisor
09-10-2015, 03:26 PM
Horacio, I wasn't referring to circular instruments, but the 4 square indicator on the right panel. Volts, amps, gas, temp. They are bigger than the small ones I saw, but smaller than the big ones. If I can't find properly sized ones I'll get bigger ones.

hyamesto
09-11-2015, 02:02 AM
Well, i must admit - if it is a galvanometer, all that make sense.
Thank you for the good explanation provided. So - no more sound cards driving . Arduino plus some current limiting resistors
should work nicely by themselves.

PS:
I am a little sceptic about implementation of an absolute encoder - most of them don't have 360 deg. /resolution . They are more or less like a codding switch with 8 wires and that would result in 8* 8 = 64 deg. For 360 deg. would need 19 wires on the back ( i suppose ) and some port to read them all. And that makes such a fancy encoder really expensive . Analogue resolvers are expensive too. I don't know - i am not that good with electronics.

PSS: 5 * Original price, wow , that is a lot. Why not coming to live and work in Europe - not much talented people here, mostly ingenious bankers and euro-bureaucrats. And some 20% on top of all - VAT - to gather money and feed all those ( doing nothing ) people. But not much engineers and talented people, willing to do business and produce something useful.

Zlatko: I just saw your post modification....

First:
The absolute encoder to which I referred and you can see properties on the link:

http://www.usdigital.com/products/encoders/absolute/rotary/shaft/ma3

Is a magnetic absolute encoder, with 10 bits analog output resolution, thatīs 1024 values in 360š, or 0,35š resolution, and use only 3 pins.
Is like having a potenciometer without detents with endless 360š rotation.
Yes, at u$s 60.- its no cheap, but not expensive like analog resolvers.
If you want more resolution, this absolute encoder can be orderer with 12 bits PWM output resolution (4096 values in 360š or 0,087š resolution !!!).

And about "Why not coming to live and work in Europa?"
Yes, right now, wait for me at the airport....I arrive in twelve hours :lol::lol::lol:...
Seriously, itīs too late for me. I am old, have family, properties,... you know.......

And for you and Simsupervisor (why not use your first real name?)...

You can find Vu meters for audio, sometimes cheaper than voltimeters or ammeters (at least in my country are half price).
If the voltimeter, ammeter or VU meter are big or small, just disassembling and use the air-core, and cut the large needle if it is bigger, or suplement with paper or other light material if it is short...

I cannot upload the video tonight, sorry, but i want to make a very good description of the process for calibrate the flag TO-OFF-FROM and the CDI needle. And i want to try another way, for better resolution..:twisted::twisted::twisted::twisted:
Be patient.
Regards.
Horacio. (Real Name......:lol::lol::lol::lol::lol:)

SimSupervisor
09-11-2015, 12:48 PM
You can call me Yan.

My main issue is with the glass protection, that's why I say I will use bigger ones. Just haven't found a suitable cheap ones yet.
Vu-meters are harder to find here. But there is no rush to find these. Still lots to do on other instruments.

I can't wait to see what you have in mind to increase resolution. No rush however, take your time. I am just real curious.

Zlatko
09-12-2015, 06:59 AM
Couldn't get my hands on such boutique and rare parts as encoder in question, in Europe either. Unless i am not buying 1000+ parts from the local distributor. When i am looking at all those shiny producer's web sites , i feel what the meaning of the word frustration is . To make long story short - if it is not listed on Ebay and Alibaba, etc, it simply doesn't exist.

xplanematt
09-12-2015, 12:28 PM
I just skimmed through this thread and thought I would offer a few thoughts....

First, kudos to SimSupervisor for figuring out how to read the OBS scale directly. That's the kind of avionics reverse-engineering that makes this stuff fun. As you probably know, the outputs you are reading off the OBS scale actually drive a phase shifter. The output of the phase shifter drives the CDI needle (which is just a big D'Arsonval meter...aka a volt meter). The signal coming into the OBS gauge is the decoded VOR composite signal that is output from the NAV receiver (which demodulates this composite signal from the 108-117.95mhz carrier signal that the VOR ground station puts out).

I had some help from a ham radio guy who had written software to generate the VOR composite signal and output it to the soundcard. I made some slight modifications to make his software compile on my system, and used it to generate WAV files for each radial from 0 to 359. Then I wrote a little interface software to play the appropriate WAV based on X-Plane's VOR status. Been using this solution for over two years now I think, works a treat. It also means I had to do zero reverse-engineering on the gauge itself. I did learn a lot about the VOR signal (still can't say I fully grasp how to generate it). There is an offset between two signals in the composite signal....the phase shifter you control with the OBS scale shifts the offset signal back into phase with the reference signal when the OBS is tuned to the radial the aircraft is currently on, neutralizing the phase shifter's output (and thus centering the CDI needle). Deviation between the signals generates a voltage on the CDI needle, causing it to deflect from center. Simple, slick.

From what I am reading here, it sounds like you guys are saying the CDI needle requires more than +/- 5vDC to get full deflection, no? Just use an H-bridge to control the needle. You can reverse polarity easily, and you can control the enable pins on the H-bridge chip with PWM to get your "variable" input voltage. I use the L298N a lot. The board I'm using officially supports 12vDC, although I've run 28vDC in it as well (it just makes the 5vDC voltage regulator on this particular board unusable, which doesn't matter if you are powering your 5vDC stuff from somewhere else).

If you are needing absolute rotary encoders with continuous rotation, look no further than the AS5040/AS5045 chips:

http://www.madscientisthut.com/Shopping/agora.cgi?cart_id=9830266.2907&product=CNC%20/%20Robotic%20Sensors&user4=Rotary%20Encoder&xm=on

These are small chips with embedded Hall effect sensors and a bunch of neat logic and noise filtering, as well as several different types of output. I am using the AS5040 breakout board to read the position of a syncro on an altimeter, and it is FLAWLESS. Takes a little more work than a simple potentiometer or bare Hall sensor, for instance, but I get amazing precision, and the altimeter has been absolutely perfect for the year or two since I interfaced it. And, it's $20USD, not $60. I assume they would ship internationally.

With all this being said, there is some variation in how OBS gauges are designed. It is my impression that some systems do ALL the demodulating in the NAV receiver, and the OBS gauge in this instance gets some other type of signal. Additionally, I have two OBS gauges that I think may have been off a commercial simulator, and they use syncros for the OBS scale. I could easily read them with the AS5040 boards, but I am very close to being able to fully and precisely read syncro outputs with an Arduino, which would be a cleaner solution....will probably go that route with these particular gauges.

Matt

SimSupervisor
09-12-2015, 09:17 PM
In fact its pretty much the opposite. The D'arsonval needle indicator reacts in less than one volt side-to-side I'd say (without measurments)

I am curious to know how you connected the NAV unit - power and sound card. I never could manage to get mine to work (although, I need to mention it was sold as non-operational...)
That being said, I can confirm your assumption that not all OBS reader are identical. I had 3 old VOR indicator - all Narco. one being the CS-3A and I assume it gets its signal from an additionnal box, as there's no electronics inside, only links to the various D'arsonval and OBS pins. The two others were VOA-4 units - and they use CS-3A internally, but have electronics in there.
I never managed to power any up. One was missing its transistors, and the other seemed OK; it was one of the best-looking instrument I got from the supplier I bought my indicators from (some were rather destroyed by corrosion)

hyamesto
09-13-2015, 02:16 AM
Ok: we have a full resolution needle with this connection:

http://www.mycockpit.org/forums/attachment.php?attachmentid=10724&stc=1

Sketch to test: (Complete sweep of the needle, from left to right maximum scale)

1 int n=1;
2 int out=127;
3 //------------------
4 void setup()
5 {
6 pinMode(6, OUTPUT);
7 }
8 //---------------------
9 void loop() {
10 out+=n; if (out==255 || out==0) n=-n;
11 analogWrite (6, out);
12 analogWrite (13, 0);
13 delay (1);
14 }



How to setup:
1.- Put limiter trimpot to max resistance. Put centering Trimpot at medium.
Comment line 10 of sketch with //
Set in out=127 in line 2
Upload the sketch.

2.- Now, Arduino send value of 127 from PWM output, and now set centering trimpot, to obtain 0 desviation in the needle (center).

3.- Set in out=255 or 0, in line 2, left commented line 10 of sketch.
Upload the sketch again.
Now, Arduino send value of 0 or 255 from PWM output, and now the limiter trimpot to obtain full deflection of needle (left or right, depends of value of int out).
4.- Carefully setting the potentiometer until the needle just touches the physical limiter, no more.)
5.- Send again value of 127 from PWM output, and retouch centering if needed.
6.- Upload the original sketch, with in out=127. (You can change the delay value from 1 to 1000 to see fast response (delay=1) or the "steps" (delay=1000).
7.- If you reset your Arduino, the needle goes to centering position.

Now you have a full resolution needle (256 steps).
It is the maximum resolution provided by FSUIPC Offset 0C48 (NAV1 Localizer needle -127 left to +127 right).

Connect Arduino with Simulator interface software, make your own sketch, some tweaks and enjoy....

FAQ:
Why 22 Kohms more than earlier test?

To reduce the current inside the D'arsonval coil (you need only 150 microamper).
With only 10k trimpot, i see the power led indicator of the arduino changing intensity, signal of to much current flowing inside the coil.
And i have a better resolution (256 steps vs. 194 steps earlier setup)

Why the needle donīt go beyond 3,5 points in scale on each side?

Because the physical stops of the instrument are bad calibrated.. (work to do......)

http://www.mycockpit.org/forums/attachment.php?attachmentid=10725&stc=1

A video of test:


https://youtu.be/qbpv9LOR-uo

Next test, TO-OFF-FROM Flag with only 2 digital outputs (NOT PWM)
I just need to open and regulate the physical stops, because the Flag locked in TO position.
OFF and FROM working ok...

Now i know why the instrument was descarted.......

Regards.
Horacio.

hyamesto
09-13-2015, 03:28 AM
Matt:

I am interested in your soft. Can you post in some free host (Mediafire, Mega) ,or send via mail?
I was trying to do something similar with a sin-cos signals out of phase by 90š, very large to explain here...
but you can see something in this post:

http://www.mycockpit.org/forums/showthread.php?t=25328

With Arduino now, seems to be and easy solution to generate the signals and injecting on the instruments.

As you can see, with only 1 PWM output, i can drive the CDI needle (no need of h-bridge, or more outputs).
The D'ansorval needle indicator reacts with only 150 mv (yes, milivolts) and need only 150ĩa (microamper)

I donīt think there is a easier or more simple way solution like this.

And for the FROM-OFF-TO flag, only 2 digital outputs (not PWM).

About the VOR internals, the new instruments have a resolver to set the OBS.
Newest maybe use and magnetic absolute encoder (I heard of this from Honeywell, owner of Bendix/King and manufacturer of electronical components)
(And in a Glass Cockpit who knows?)
The older instruments, like Slimsupervisor and I have, has a sort of Wheatstone Bridge (as said, " a sort").....
This is a picture of the internals, and squematics of connection:
http://www.mycockpit.org/forums/attachment.php?attachmentid=10726&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10727&stc=1http://www.mycockpit.org/forums/attachment.php?attachmentid=10728&stc=1

Now, they are descarted because the wiper is mechanics (photo 2), and subject to wear, Flags replaced with led lights, etc.
Mine have broken wire coil.....

The AS5040 boards are amazing, but i canīt buy from my country right now (import laws, dollar restrictions, etc).
I was thinking of using the HMC5883L magnetic sensor with a magnet, available in my country, but i read it is very delicate with strong magnetic fields.
Maybe others in the rest of the world will appreciate this information (Simsupervisor, Zlatko .....)

And for all, thanks for collaborating.. As Mahatma Gandhi says: "Satisfaction lies in the effort, not in the attainment"......

Regards.
Horacio.

hyamesto
09-13-2015, 03:38 AM
Couldn't get my hands on such boutique and rare parts as encoder in question, in Europe either. Unless i am not buying 1000+ parts from the local distributor. When i am looking at all those shiny producer's web sites , i feel what the meaning of the word frustration is . To make long story short - if it is not listed on Ebay and Alibaba, etc, it simply doesn't exist.
Zlatko:

Frustation is what happened to me friday in the three local electronics shop.....

"Hello Sr, do you have 10K Potenciometers?"
----NO
"Trimpots?"
----NO
" 20 Mhz crystal?"
----NO
"a 0,5 amper short type fuse?"
----NO
:shock:

The same in every shop.

As you can see, if you can not get a simple fuse to replace, forget something like a simple chip.......

Regards.
Horacio.

PS.: Donīt wait me at the airport, flight delayed without explanation...:-D:-D


http://www.mycockpit.org/forums/attachment.php?attachmentid=10729&stc=1

SimSupervisor
09-13-2015, 10:34 AM
Yeah, electronic shops are not what they used to. That is why I generally buy online. When I find locally I tend to buy moire then I need, just in case.
Horacio, what values resistor do you get for full maximum deflection? I didn't have that many potentiometer and didn't do the whole exercise of tweaking it to the max, 3k worked ok.

I am planing to use the obs ring of the broken unit as the feedback of a servo to scratch build a heading indicator. These are quite useful. ll post up my progress on a new thread as soon as I get an H-bridge

hyamesto
09-13-2015, 03:02 PM
As the new graphic says, i use a 22k resistor in serie with a 10k trimpot (to limit current), and a 10k trimpot to centering needle.
With 3k like you setup, worked ok too, but too much current flow inside the D'ansorval, and make the needle least sensitive.

http://www.mycockpit.org/forums/attachment.php?attachmentid=10734&stc=1

Regards.
Horacio.

SimSupervisor
09-13-2015, 08:27 PM
So you have it with somewhere between 22k and 32k for the PWM pin. Interesting. I get nearly 100 values each side, which makes me wonder if I read wrongly my resistor and its 30k instead of 3k ???? I didn't do any current measurments, and the pin13 LED didn't seem to dim. I'll check that out next time I work with the VOR. (I have been working on my airspeed indicator this week-end)

Thanks for the information.

hyamesto
09-13-2015, 11:51 PM
Yeah, thatīs right.
I have between 20k and 30k.
I use two trimpots, but replace the 20k in the graphic with a 2,2k resistor (the most standard near value, my trimpot is set to max value)
Maybe can be put more resistor, but with this value works full resolution).
Think D'ansorval meter like "a sort of LED", no matter the volts, but yes the current (amper).

However, with a 10k works too, but no full resolution (195 steps), and in my Arduino, the power Led indicator, (not the pin13 LED) changes brightness in sync with the max values of PWM output.
(The power led in my ArduinoMega is near of reset button and in front of communication pin RX2, or digital pin 17, and ever is on when the arduino is powered by usb or external battery)
This is a sign of elevated amper consumption.

Measures: with the multimeter in series connection, measuring 2,5mA at full scale.

With 30K, i canīt not measure current, because itīs too low for my multimeter range of current. Needle movement is smoother like the real life VOR. (full resolution)

If I reduce to 10K, there is a 0,5 mA reading on the multimeter, and the movement of the needle is more sharp, and goes to fast from one extreme to other (loose resolution).

Regards.
Horacio.

Zlatko
09-14-2015, 03:37 AM
Zlatko:



PS.: Donīt wait me at the airport, flight delayed without explanation...:-D:-D


http://www.mycockpit.org/forums/attachment.php?attachmentid=10729&stc=1



Come on buddy , don't give up so easily - hire a Cessna and fly it to here your self . :)
You've got nothing to do till next elections anyway . And on the way back you'll get that fancy encoder.

SimSupervisor
09-14-2015, 08:51 AM
Yeah, thatīs right.
I have between 20k and 30k.
I use two trimpots, but replace the 20k in the graphic with a 2,2k resistor (the most standard near value, my trimpot is set to max value)
Maybe can be put more resistor, but with this value works full resolution).
Think D'ansorval meter like "a sort of LED", no matter the volts, but yes the current (amper).

However, with a 10k works too, but no full resolution (195 steps), and in my Arduino, the power Led indicator, (not the pin13 LED) changes brightness in sync with the max values of PWM output.
(The power led in my ArduinoMega is near of reset button and in front of communication pin RX2, or digital pin 17, and ever is on when the arduino is powered by usb or external battery)
This is a sign of elevated amper consumption.

Measures: with the multimeter in series connection, measuring 2,5mA at full scale.

With 30K, i canīt not measure current, because itīs too low for my multimeter range of current. Needle movement is smoother like the real life VOR. (full resolution)

If I reduce to 10K, there is a 0,5 mA reading on the multimeter, and the movement of the needle is more sharp, and goes to fast from one extreme to other (loose resolution).

Regards.
Horacio.

Thanks for pointing this out to me. I'll look into putting a bigger resistor. Last thing I want is to sink too much current from the Arduino and kill it during a flight...

Better be safe than sorry.

xplanematt
09-17-2015, 12:35 AM
SimSupervisor: As I recall, I also had to hook 12vDC into the power input pin. You probably won't see any indication of power until you feed a good signal to the unit. Mine also has integral lighting, so that's another connection...but the signal itself is just one output from the soundcard, and ground.

If it only takes 1vDC to get full deflection, that's awesome. Just needs a resistor in-line with one of the leads going to the needle.

Hyamesto and SimSupervisor: If you can measure the resistance of the coil driving the needle, you can use Ohm's law to figure out the required resistor value. It probably won't *exactly* match a standard resistor value, you'll want to go to the next LOWEST resistor value (to ensure you get full-scale needle deflection).

Or you can do what I've been doing.....stick a random resistor between the instrument and a 5vDC source and see what the needle does. Keep going up or down with resistors til you find one that just barely pegs the needle. Then you are ready to hook up to your Arduino. There's no risk of over-current on your Arduino this way. Option #1 is the scientific method, option #2 is the caveman method that you might end up having to do a bit anyway if you can't measure the resistance well enough during option #1. :)

The code is not mine, and I can no longer seem to get in contact with the author, so I am reluctant to share it online. I might throw the WAV files online that I generated, at some point (they are on my old sim, which I have mothballed at the moment). I don't think you'll have much luck using an Arduino Uno to generate the audio, though a faster board with audio synthesis hardware on it (either built-in, or as an add-on) might do the job. I would just stick to a PC, actually.

hyamesto
09-17-2015, 01:46 AM
xplanematt:

You are injecting the sound signal in the indicator, or in the radio unit connected to the instrument?
About the connections, if you see earlier post, you can see a original Bendix/King chart scan: the inductance of the D'ansorval is 100 ohms, with the current and/or voltage required for needle or flag deflection. 150 mV, or 0,15 volts (a 15% of a volt), but the important is the minimal current to move the D'ansorval and it's just 140ĩa (0,00014 ampers).
I was use the scientific method first, and caveman later to make some tweaks.
This I have already tested and it is working ok. Measure current is insignificant.
To generate signals, i was considering to inject a PWM in the internal resolver (but with 4 PWM needed, out of phase by 90š).
The signal to the internal wheastone bridge or resolve, can be a PWM signal as Bendix /King service manuals indicate.
Some little arduino autonomous board can be used only to generate the signals, and supply many instruments.
Or with a mp3 sound and SD card ready shield, you can use arduino to generate sounds, but without many information about you system, this is only speculation.
And again: as Mahatma Gandhi says: "Satisfaction lies in the effort, not in the attainment"......
Regards and thanks for your advices.

Horacio.

xplanematt
09-18-2015, 11:40 PM
The audio signal goes directly to the OBS indicator. If you could further modulate the signal at 108.0 to 117.95mhz, you could feed a nav receiver directly. Everything else that connects to the nav receiver would "just work", assuming you fed in the appropriate primary signals (so far we are just talking about the radial signal...there are other signals for the station's Morse code, DME if equipped, and glideslope signal if it's an ILS). So, with just a single audio line, you'd be running horizontal and vertical nav for OBS indicators and HSIs, Morse code audio, real RMIs, RNAVs, DME indicators, etc. That would be amazingly cool, by the way! I don't have a lot of interest in pursuing it further myself, as the "radios" in my Sabreliner are just control heads that I can interface easily. And the OBS indicators, RMIs, and HSIs do not receive the VOR composite signal directly.

Matt

brenth
01-26-2016, 08:44 PM
You guys have done amazing work. Did you ever get the "flags" working with the 2 digital outputs? If so, could you post the sketch? Thanks...
Brent