Re: Airspeed indicator interfaced with OC cards
Quote:
Originally Posted by
fordgt40
Edoardo
Excellent work and very impressive, especially with DC motors rather than servos
Well done
David
Thanks for your comment!
The easy part is about the motor itself as the gauge is already featuring small DC motors.
The hard part is to disassemble part of it and replace the syncros with pots which are not easy to find as for dimensions and shape. I found them on RS but are like more than 30€ each, luckily I got a lot over ebay for 60USD for 8 of them :)
The hard part of the code was about the barber pole as it is spring loaded to a position, so I needed to program the motor to stay in a given position applying the right force to it as a DC once reach a position is deactivaded and the spring woulded bring it back in a continuous loop.
Here is the code I made for AS indicator
Code:
Var 0000, Value 0
{
&ASControl = TIMER 999 ,0 ,2
&ASObj = 0
&ASMotor = 0
&SBControl = TIMER 999 ,0 ,2
&SBObj = 0
&SBMotor = 0
&BPControl = TIMER 999 ,0 ,2
&BPObj = 0
&BPMotor = 0
}
Var 0003, name ASMotor, static, Link USB_DCMOTOR, Device 2, Output 1 // motor control (0-127) 0=Left, +128 = Rig
Var 0006, name ASAd, static, Link USB_ANALOGIC, Device 2, Input 1, PosL 0, PosC 127, PosR 255 // Potentiometer value
Var 9001, name AirSpdOffst, Link FSUIPC_IN, Offset $02BC, Length 4
{
L0 = &AirSpdOffst / 128 // FSUIPC conversion, L0=AirSpd
&AirSpd = L0
L0 = ABS L0
L2 = L0
IF L0 <= 59 // First sector
{
L1 = 0 // pot 0
}
ELSE
{
L2 = L0 - 59
IF L0 <= 80 // Second sector
{
L1 = L2 / 1.25 // pot 17
L1 = L1 + 0
}
ELSE
{
L2 = L0 - 80
IF L0 <= 250 // Third Sector
{
L1 = L2 / 1.0119 // pot 185
L1 = L1 + 17
}
ELSE
{
L2 = L0 - 250
IF L0 <= 450 // Fourth Sector
{
L1 = L2 / 3.125 // pot 249
L1 = L1 + 185
}
ELSE // Out of range
{
IF L0 > 450 // Fourth Sector
{
L1 = 250
}
}
}
}
}
&ASObj = L1
}
Var 9002, name AirSpd
Var 9004, name ASControl, Link SUBRUTINE // Subrutine for Control (each 20ms)
{
L0 = &ASObj - &ASAd
L1 = 0
IF L0 < 0
{
L1 = 128
}
L0 = ABS L0
L2 = &ASVelMax + L1
IF L0 <= &ASAprox8
{
L2 = &ASVel8 + L1
}
IF L0 <= &ASAprox6
{
L2 = &ASVel6 + L1
}
IF L0 <= &ASAprox4
{
L2 = &ASVel4 + L1
}
IF L0 <= &ASAprox2
{
L2 = &ASVel2 + L1
}
IF L0 <= &ASAproxSlow
{
L2 = &ASVelMin + L1
}
IF L0 = &ASMargen
{
L2 = 0
}
&ASMotor = L2
}
Var 9006, name ASObj // objective position (fixed in the example)
Var 9007, name ASMargen, Value 0 // %error
Var 9008, name ASAprox8, Value 15
Var 9009, name ASAprox6, Value 12
Var 9010, name ASAprox4, Value 8
Var 9011, name ASAprox2, Value 4
Var 9012, name ASAproxSlow, Value 1
Var 9013, name ASVelMax, Value 24 // Speed for follow objective
Var 9014, name ASVel8, Value 20 // Speed for proximity obj
Var 9015, name ASVel6, Value 16
Var 9016, name ASVel4, Value 12
Var 9017, name ASVel2, Value 8
Var 9018, name ASVelMin, Value 4 // Speed approaching target
Var 0004, name SBMotor, static, Link USB_DCMOTOR, Device 2, Output 2 // motor control (0-127) 0=Left, +128 = Rig
Var 0007, name SBAd, static, Link USB_ANALOGIC, Device 2, Input 2, PosL 0, PosC 127, PosR 255 // Potentiometer value
Var 9101, name SpdBugOffst, Link FSUIPC_IN, Offset $07E2, Length 2
{
L0 = &SpdBugOffst / 128 // FSUIPC conversion, L0=SpdBug
&SpdBug = L0
L0 = ABS L0
L2 = L0
IF L0 <= 100 // First sector
{
L1 = 36 // pot 36
}
ELSE
{
L2 = L0 - 100
IF L0 <= 250 // Second sector
{
L1 = L2 / 1.0274 // pot 182
L1 = L1 + 36
}
ELSE
{
L2 = L0 - 250
IF L0 <= 450 // Third Sector
{
L1 = L2 / 3.125 // pot 246
L1 = L1 + 182
}
ELSE // Out of range
{
IF L0 > 450 // Third Sector
{
L1 = 250
}
}
}
}
&SBObj = L1
}
Var 9104, name SBControl, Link SUBRUTINE // Subrutine for Control (each 20ms)
{
L0 = &SBObj - &SBAd
L1 = 0
IF L0 < 0
{
L1 = 128
}
L0 = ABS L0
L2 = &SBVelMax + L1
IF L0 <= &SBAprox8
{
L2 = &SBVel8 + L1
}
IF L0 <= &SBAprox6
{
L2 = &SBVel6 + L1
}
IF L0 <= &SBAprox4
{
L2 = &SBVel4 + L1
}
IF L0 <= &SBAprox2
{
L2 = &SBVel2 + L1
}
IF L0 <= &SBAproxSlow
{
L2 = &SBVelMin + L1
}
IF L0 = &SBMargen
{
L2 = 0
}
&SBMotor = L2
}
Var 9102, name SpdBug
Var 9106, name SBObj // objective position
Var 9107, name SBMargen, Value 0 // %error
Var 9108, name SBAprox8, Value 6
Var 9109, name SBAprox6, Value 4
Var 9110, name SBAprox4, Value 3
Var 9111, name SBAprox2, Value 2
Var 9112, name SBAproxSlow, Value 1
Var 9113, name SBVelMax, Value 60 // Speed for follow objective
Var 9114, name SBVel8, Value 40 // Speed for proximity obj
Var 9115, name SBVel6, Value 20
Var 9116, name SBVel4, Value 15
Var 9117, name SBVel2, Value 10
Var 9118, name SBVelMin, Value 13 // Speed approaching target
Var 0005, name BPMotor, static, Link USB_DCMOTOR, Device 2, Output 3 // motor control (0-127) 0=Left, +128 = Rig
Var 0008, name BPAd, static, Link USB_ANALOGIC, Device 2, Input 3, PosL 0, PosC 127, PosR 255 // Potentiometer value
Var 9201, name BarPolOffst, Link FSUIPC_IN, Offset $02BC, Length 4
{
L0 = &BarPolOffst // FSUIPC conversion, L0=BarPol
&BarPol = L0
L0 = ABS L0
L2 = L0
IF L0 <= 255 // First sector
{
L1 = 147
}
ELSE
{
L2 = L0 - 255
IF L0 <= 387 // Second sector
{
L1 = L2 / 3.1667 // pot 189
L1 = L1 + 147
}
ELSE // Out of range
{
IF L0 > 388 // Fourth Sector
{
L1 = 147
}
}
}
&BPObj = L1
}
Var 9202, name BarPol
Var 9204, name BPControl, Link SUBRUTINE // Subrutine for Control (each 20ms)
{
L0 = &BPObj - &BPAd
L1 = 0
IF L0 < 0
{
L1 = -25
L0 = &BPObj - &BPAd
L0 = ABS L0
IF L0 = 3
{
L1 = -20
}
ELSE
{
IF L0 = 2
{
L1 = -15
}
ELSE
{
IF L0 = 1
{
L1 = -10
}
}
}
}
L0 = ABS L1
IF &BPObj <= 147 // 255Kts
{
&BPVelMax = 20
&BPVelMin = 0
}
ELSE
{
IF &BPObj <= 152 // 270Kts
{
&BPVelMax = 58 + L1
&BPVelMin = 55 + L1
}
ELSE
{
IF &BPObj <= 155 // 280Kts
{
&BPVelMax = 60 + L1
&BPVelMin = 60 + L1
}
ELSE
{
IF &BPObj <= 158 // 290Kts
{
&BPVelMax = 62 + L1
&BPVelMin = 60 + L1
}
ELSE
{
IF &BPObj <= 161 // 300Kts
{
&BPVelMax = 64 + L1
&BPVelMin = 63 + L1
}
ELSE
{
IF &BPObj <= 164 // 310Kts
{
&BPVelMax = 66 + L1
&BPVelMin = 65 + L1
}
ELSE
{
IF &BPObj <= 167 // 320Kts
{
&BPVelMax = 68 + L1
&BPVelMin = 67 + L1
}
ELSE
{
IF &BPObj <= 170 // 330Kts
{
&BPVelMax = 70 + L1
&BPVelMin = 69 + L1
}
ELSE
{
IF &BPObj <= 173 // 340Kts
{
&BPVelMax = 72 + L1
&BPVelMin = 71 + L1
}
ELSE
{
IF &BPObj <= 176 // 350Kts
{
&BPVelMax = 74 + L1
&BPVelMin = 73 + L1
}
ELSE
{
IF &BPObj <= 179 // 360Kts
{
&BPVelMax = 76 + L1
&BPVelMin = 75 + L1
}
ELSE
{
IF &BPObj <= 183 // 370Kts
{
&BPVelMax = 80 + L1
&BPVelMin = 79 + L1
}
}
}
}
}
}
}
}
}
}
}
}
IF L0 <= &BPAprox
{
L2 = &BPVelMin
}
ELSE
{
L2 = &BPVelMax
}
IF L0 = &BPMargen
{
L2 = &BPVelMin
}
&BPMotor = L2
}
Var 9206, name BPObj // objective position
Var 9207, name BPMargen, Value 1 // %error
Var 9212, name BPAprox, Value 2 // Proximity Value
Var 9213, name BPVelMax, Value 0 // Speed for follow objective
Var 9218, name BPVelMin, Value 0 // Speed approaching target
Var 9301, name MachOffst, Link FSUIPC_IN, Offset $11C6, Length 2
{
L0 = &MachOffst / 20480 // FSUIPC conversion, L0=Mach Number
&D_MACH_U = MOD L0 ,10 // Mach Units Number
L0 = DIV L0 ,10
&D_MACH_T = MOD L0 ,10 // Mach Tenth Number
L0 = DIV L0 ,10
&D_MACH_H = MOD L0 ,10 // Mach Hundreds Number
}
Var 9302, name D_MACH_H
{
IF &D_MACH_H = 0
{
&Mach_H_0 = 1
&Mach_H_0 = DELAY 0 100
}
ELSE
{
&Mach_H_0 = 0
}
IF &D_MACH_H = 1
{
&Mach_H_1 = 1
&Mach_H_1 = DELAY 0 100
}
ELSE
{
&Mach_H_1 = 0
}
IF &D_MACH_H = 2
{
&Mach_H_2 = 1
&Mach_H_2 = DELAY 0 100
}
ELSE
{
&Mach_H_2 = 0
}
IF &D_MACH_H = 3
{
&Mach_H_3 = 1
&Mach_H_3 = DELAY 0 100
}
ELSE
{
&Mach_H_3 = 0
}
IF &D_MACH_H = 4
{
&Mach_H_4 = 1
&Mach_H_4 = DELAY 0 100
}
ELSE
{
&Mach_H_4 = 0
}
IF &D_MACH_H = 5
{
&Mach_H_5 = 1
&Mach_H_5 = DELAY 0 100
}
ELSE
{
&Mach_H_5 = 0
}
IF &D_MACH_H = 6
{
&Mach_H_6 = 1
&Mach_H_6 = DELAY 0 100
}
ELSE
{
&Mach_H_7 = 0
}
IF &D_MACH_H = 7
{
&Mach_H_7 = 1
&Mach_H_7 = DELAY 0 100
}
ELSE
{
&Mach_H_7 = 0
}
IF &D_MACH_H = 8
{
&Mach_H_8 = 1
&Mach_H_8 = DELAY 0 100
}
ELSE
{
&Mach_H_8 = 0
}
IF &D_MACH_H = 9
{
&Mach_H_9 = 1
&Mach_H_9 = DELAY 0 100
}
ELSE
{
&Mach_H_9 = 0
}
}
Var 9303, name D_MACH_T
{
IF &D_MACH_T = 0
{
&Mach_T_0 = 1
&Mach_T_0 = DELAY 0 100
}
ELSE
{
&Mach_T_0 = 0
}
IF &D_MACH_T = 1
{
&Mach_T_1 = 1
&Mach_T_1 = DELAY 0 100
}
ELSE
{
&Mach_T_1 = 0
}
IF &D_MACH_T = 2
{
&Mach_T_2 = 1
&Mach_T_2 = DELAY 0 100
}
ELSE
{
&Mach_T_2 = 0
}
IF &D_MACH_T = 3
{
&Mach_T_3 = 1
&Mach_T_3 = DELAY 0 100
}
ELSE
{
&Mach_T_3 = 0
}
IF &D_MACH_T = 4
{
&Mach_T_4 = 1
&Mach_T_4 = DELAY 0 100
}
ELSE
{
&Mach_T_4 = 0
}
IF &D_MACH_T = 5
{
&Mach_T_5 = 1
&Mach_T_5 = DELAY 0 100
}
ELSE
{
&Mach_T_5 = 0
}
IF &D_MACH_T = 6
{
&Mach_T_6 = 1
&Mach_T_6 = DELAY 0 100
}
ELSE
{
&Mach_T_6 = 0
}
IF &D_MACH_T = 7
{
&Mach_T_7 = 1
&Mach_T_7 = DELAY 0 100
}
ELSE
{
&Mach_T_7 = 0
}
IF &D_MACH_T = 8
{
&Mach_T_8 = 1
&Mach_T_8 = DELAY 0 100
}
ELSE
{
&Mach_T_8 = 0
}
IF &D_MACH_T = 9
{
&Mach_T_9 = 1
&Mach_T_9 = DELAY 0 100
}
ELSE
{
&Mach_T_9 = 0
}
}
Var 9304, name D_MACH_U
{
IF &D_MACH_U = 0
{
&Mach_U_0 = 1
&Mach_U_0 = DELAY 0 300
}
ELSE
{
&Mach_U_0 = 0
}
IF &D_MACH_U = 2
{
&Mach_U_2 = 1
&Mach_U_2 = DELAY 0 300
}
ELSE
{
&Mach_U_2 = 0
}
IF &D_MACH_U = 4
{
&Mach_U_4 = 1
&Mach_U_4 = DELAY 0 300
}
ELSE
{
&Mach_U_4 = 0
}
IF &D_MACH_U = 6
{
&Mach_U_6 = 1
&Mach_U_6 = DELAY 0 300
}
ELSE
{
&Mach_U_6 = 0
}
IF &D_MACH_U = 8
{
&Mach_U_8 = 1
&Mach_U_8 = DELAY 0 300
}
ELSE
{
&Mach_U_8 = 0
}
}
Var 9400, name Mach_H_0, Link IOCARD_OUT, Output 0
Var 9401, name Mach_H_1, Link IOCARD_OUT, Output 1
Var 9402, name Mach_H_2, Link IOCARD_OUT, Output 2
Var 9403, name Mach_H_3, Link IOCARD_OUT, Output 3
Var 9404, name Mach_H_4, Link IOCARD_OUT, Output 4
Var 9405, name Mach_H_5, Link IOCARD_OUT, Output 5
Var 9406, name Mach_H_6, Link IOCARD_OUT, Output 6
Var 9407, name Mach_H_7, Link IOCARD_OUT, Output 7
Var 9408, name Mach_H_8, Link IOCARD_OUT, Output 8
Var 9409, name Mach_H_9, Link IOCARD_OUT, Output 9
Var 9410, name Mach_T_0, Link IOCARD_OUT, Output 10
Var 9411, name Mach_T_1, Link IOCARD_OUT, Output 11
Var 9412, name Mach_T_2, Link IOCARD_OUT, Output 12
Var 9413, name Mach_T_3, Link IOCARD_OUT, Output 13
Var 9414, name Mach_T_4, Link IOCARD_OUT, Output 14
Var 9415, name Mach_T_5, Link IOCARD_OUT, Output 15
Var 9416, name Mach_T_6, Link IOCARD_OUT, Output 16
Var 9417, name Mach_T_7, Link IOCARD_OUT, Output 17
Var 9418, name Mach_T_8, Link IOCARD_OUT, Output 18
Var 9419, name Mach_T_9, Link IOCARD_OUT, Output 19
Var 9420, name Mach_U_0, Link IOCARD_OUT, Output 20
Var 9422, name Mach_U_2, Link IOCARD_OUT, Output 21
Var 9424, name Mach_U_4, Link IOCARD_OUT, Output 22
Var 9426, name Mach_U_6, Link IOCARD_OUT, Output 23
Var 9428, name Mach_U_8, Link IOCARD_OUT, Output 24
As you can see it is a long one :P
Thanks
Edoardo
Re: Airspeed indicator interfaced with OC cards
Edoardo
An interesting bit of coding. Thank you for that and I may use some of it when motorising my throttles:)
Again well done and thanks for sharing
David
Re: Airspeed indicator interfaced with OC cards
Hi,
I just received the same DC-10 AIS today. The interessting thing is that mine allready has build in potentiometers. I will get 2 more in the next days. Will be interesstng to see if they also have pottys or resolvers. I was actually wondering what resolvers are ? some sort of potentiometer ? or like a motor ?
I also got a sperry altimeter yesteray which has resolvers instead of pottys. So I will have to excange them there. Will try edo's OC code as soon as I got the hardware part done and I received the OC DC cards (still waiting for them to arrive).
Here's some pictures of the Instruments:
http://www.md80.ch/images/myimgs/DSC00304s.jpg
http://www.md80.ch/images/myimgs/DSC00301s.jpg
the altimeter from above
http://www.md80.ch/images/myimgs/DSC00296s.jpg
oh, and I was wondering if edo knows how the mach digits are moved. Looks like their tiny stepper motors ? From the OC code it looks like you use digital outputs for the mach digits ?
Does your allready work and if so can you post a video ?
Cheers,
Gery
Re: Airspeed indicator interfaced with OC cards
Quote:
Originally Posted by
crashdog
Hi,
I just received the same DC-10 AIS today. The interessting thing is that mine allready has build in potentiometers. I will get 2 more in the next days. Will be interesstng to see if they also have pottys or resolvers. I was actually wondering what resolvers are ? some sort of potentiometer ? or like a motor ?
I also got a sperry altimeter yesteray which has resolvers instead of pottys. So I will have to excange them there. Will try edo's OC code as soon as I got the hardware part done and I received the OC DC cards (still waiting for them to arrive).
Hi Gary, Yes it has built in pots, 12.5K and it seemed simple to me as well at 1st impact...BUT
Those pots are not linear pots and the work more or less in this way:
for about 160 degrees of range the value increase more or leass linearly, then the value decreases for about 100 degrees to raise up again till 0 degrees.
That's the reason for which u HAVE to replace those pots...u can easily verify that with a multimeter. Sorry for this bad notice but It will let u lose less time to interface it. 2 are easy to replace, but to replace the one of the speed bug you'll have to remove the glass support, the needles, the faceplate and mach numbers, I can give u help with that if you need.
Quote:
oh, and I was wondering if edo knows how the mach digits are moved. Looks like their tiny stepper motors ? From the OC code it looks like you use digital outputs for the mach digits ?
Does your allready work and if so can you post a video ?
Cheers,
I made a test last night and it works like a wet dream :D will post a video in next 2 days, just stay subscribed to my channel to get the update.
They are not stepper, it is a rotating device with 10 mini electromagnets (one for each digit) that are excited by 12V tension. you simply connect each wire to an output using an USB output card and the game is done...I made small changes to the code posted, I'll update it tomorrow. FYI you can keep the connector of the device and simply make longer wires to the other connector side
Re: Airspeed indicator interfaced with OC cards
Thank you Edoardo for all the info. Extreamly helpfull ! :D
I have subscribed to your youtube channel and will keep looking there.
Will keep you posted on any progress or questions.
Cheers,
Gery
Re: Airspeed indicator interfaced with OC cards
and about the potty 256 bit there might be this solution.
The BU0836X card has a 4096 bit resolution. /http://www.leobodnar.com/products/BU0836X/ with the full version of fsuipc you can read some axis in the axis assignment tab and forward it to an fsuipc offset. That offset can be read by sioc. The numbers of axis are a bit limited. But for 2 altimeters it should work and maybe there are some more extensibility. Asking in Pete dowsons forum often helps.
Cheers,
Gery
Re: Airspeed indicator interfaced with OC cards
Quote:
Originally Posted by
crashdog
and about the potty 256 bit there might be this solution.
The BU0836X card has a 4096 bit resolution. /
http://www.leobodnar.com/products/BU0836X/ with the full version of fsuipc you can read some axis in the axis assignment tab and forward it to an fsuipc offset. That offset can be read by sioc. The numbers of axis are a bit limited. But for 2 altimeters it should work and maybe there are some more extensibility. Asking in Pete dowsons forum often helps.
Cheers,
Gery
I have 2 of those interfaces for flight controls actually and I didn't know about that function in FSUIPC...
The problem anyway is that SIOC won't be able to manage a motor control with more than 256 steps, there is not a function to support it...if you try to assign a max value greater than 255 in the motor control value, sioc won't go on with compiling... :(
Anyway I thought a good solution I think...If you see the altimeter there is one resolver which completes 1 turn each 2000 ft or 5000 ft depending on models, and another which makes more or less 180 degrees within the full range...my idea is to use the first for precision altitude indication and the second one as a sort of counter to let sioc understand in which altitude range is so the indication is always correct...will keep u updated with as I find the code for :)
Re: Airspeed indicator interfaced with OC cards
Quote:
Those pots are not linear pots
I could take the pots apart without destroying them. Do you know if they can be modifyed to be linear ? or mabe noth woth the effort ? which pots do you use Edoardo ?
Gery
Re: Airspeed indicator interfaced with OC cards
I posted the new VIDEOin my channel you can watch it.
About pots...I got a lot of 8 pots out of ebay, you should finde pots with servo flange and 3mm shaft diameter or u have to sort something out :)
Those pots can't be modified, baybe you can somehow keep its housing to fit another pot but can't say that...
Re: Airspeed indicator interfaced with OC cards
Just found a fully compatible potentiometer... or at least looks like it. 3.1 mm shaft, linear, same housing as the original and a really proud price...(almost CHF 85 ) but I will consider to take these as I don't need to mod the metal plates in the AIS. It should work right away.
https://www.distrelec.ch/ishopWebFro...ries/is/1.html
Gery
ps. sorry I was wrong the housing looks similar but he diamter of the housing is only 22mm where the original is 26mm.... so won't work I guess.