Jump to content

Table mounted landing gear selector switch from a Tornado


DeadMeat

Recommended Posts

Hi guys,

 

I think this is just the coolest setup ever, especially since it’s using a real tornado gear lever and able to use the down lock mechanism! I’m a newbie to DCS BIOS and Arduino, but I’m tenacious when I want to learn something and hope to recreate this myself. I’ve ordered an Arduino starter kit off of amazon, some on/off switches (to practice with and maybe make some other usable switches for DCS) and also ordered this:

 

http://www.ebay.com/itm/Aircraft-ZE158-1986-Panavia-Tornado-F-3-Undercarriage-U-C-Selector-Switch-K0653/323812044017?epid=21009529098&hash=item4b64b3acf1:g:OiUAAOSw7Kta6vYl

 

Can anyone tell if this should function like Dead Meat’s amazing setup if I wire it up properly?

 

Thanks guys, looking forward to a fun project and some conversations on here!


Edited by Sickdog

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

 

Has anyone tried this particular model? Well feel free to chime in if you have..

 

It is different from mine for sure, but I guess the functions should be similar. You have the pin diagram printed on top and it looks like you have the solenoid (including diodes across the poles) and two lamps in there.

 

It should be straightforward to wire this thing up based on the pinout and try it. Then pins on the back side should have the matching letters.

You need to feed the lamps 28V or switch them out for 5V LEDs+resistors (or 5V bulbs if you can find them). For the solenoid I would recommend trying 12V and see if it latches like mine does.. To control the 12V with the Arduino you need to build a MOSFET circuit: https://bildr.org/2012/03/rfp30n06le-arduino/ just make sure your MOSFET gives full output at 5V, like this IRL540NPBF

 

Also as I mentioned above check out Hansolo's thread for inspiration on driving mag switch solenoids and maybe Joe here

if you don't mind his TACAN constantly beeping haha no it's good stuff
Link to comment
Share on other sites

Oh boy, hope I didn’t waste money on this lever! Well, I’m sure I’ll have more questions once I get my Arduino starter kit tomorrow, so I’ll be back here again soon. Thanks DeadMeat (and anyone else chiming in) for your help!

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

My best guess is that the version of the Tornado lever you have ordered have the same weight on wheels function as the one DeadMeat has.

 

The A-10 and the F-16 has a similar function. From the looks of the Ebay link you supplied you can see from the schematics on top of it that it should have a coil.

 

cheers

Hans

Link to comment
Share on other sites

My best guess is that the version of the Tornado lever you have ordered have the same weight on wheels function as the one DeadMeat has.

 

The A-10 and the F-16 has a similar function. From the looks of the Ebay link you supplied you can see from the schematics on top of it that it should have a coil.

 

cheers

Hans

 

 

Thanks for looking and your input, Hans. I shall know a little more when the lever arrives in the coming weeks. I’d like to see if I can have the WOW/solenoid be triggered by radar altimeter (if possible) instead of a function of airspeed. Anyone have any comment on that? Seems like that might work better for something like the harrier, for example.

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Thanks for looking and your input, Hans. I shall know a little more when the lever arrives in the coming weeks. I’d like to see if I can have the WOW/solenoid be triggered by radar altimeter (if possible) instead of a function of airspeed. Anyone have any comment on that? Seems like that might work better for something like the harrier, for example.

 

Well as luck has it I have found a new way to determine WoW that is more realistic and does away with reading gauges..

 

DCS-BIOS can output the state of all animation arguments for the external aircraft model, so I just check the state of the landing gear strut compression. If it is fully extended there is no WoW. I check all three landing gear. Luckily most aircraft seem to share animation arguments (going back to FC3 it seems). I have only checked the A10 and F18 myself though.

 

The function is built into vanilla DCS-BIOS, but you currently have to call it and add whatever exports you want to your aircraft libraries yourself, like so for the A-10C and F/A-18C:

local defineIntegerFromGetter = BIOS.util.defineIntegerFromGetter
defineIntegerFromGetter("EXT_WOW_NOSE", function()
if LoGetAircraftDrawArgumentValue(1) > 0 then return 1 else return 0 end
end, 1, "External Aircraft Model", "WoW Nose Gear")

defineIntegerFromGetter("EXT_WOW_RIGHT", function()
if LoGetAircraftDrawArgumentValue(4) > 0 then return 1 else return 0 end
end, 1, "External Aircraft Model", "WoW Right Gear")

defineIntegerFromGetter("EXT_WOW_LEFT", function()
if LoGetAircraftDrawArgumentValue(6) > 0 then return 1 else return 0 end
end, 1, "External Aircraft Model", "WoW Left Gear")

You can put the code at the end of the file, before "BIOS.protocol.endModule()"

 

If you're using DCS flight panels fork the function is already included in most aircraft libraries (they use it to export external lights), you can skip the first line and just add the gear exports.

 

My Arduino code that uses this new WoW determination for the F18 looks like this

/*
 Tell DCS-BIOS to use a serial connection and use the default Arduino Serial
 library. This will work on the vast majority of Arduino-compatible boards,
 but you can get corrupted data if you have too many or too slow outputs
 (e.g. when you have multiple character displays), because the receive
 buffer can fill up if the sketch spends too much time updating them.
 
 If you can, use the IRQ Serial connection instead.
*/


#define DCSBIOS_DEFAULT_SERIAL

#include "DcsBios.h"

byte NoseWow = 0; //weight on wheels - check if variable needs to match unsigned int
byte RightWow = 0;
byte LeftWow = 0;

/* paste code snippets from the reference documentation here */

//---Check for WoW
void onExtWowNoseChange(unsigned int newValue) {
   if (newValue == 1){
     NoseWow = 1;
   }
   else {
     NoseWow = 0;
   }
}
[color="Red"]DcsBios::IntegerBuffer extWowNoseBuffer(0x54c2, 0x4000, 14, onExtWowNoseChange);[/color]

void onExtWowRightChange(unsigned int newValue) {
   if (newValue == 1){
     RightWow = 1;
   }
   else {
     RightWow = 0;
   }
}
[color="red"]DcsBios::IntegerBuffer extWowRightBuffer(0x54c2, 0x8000, 15, onExtWowRightChange);[/color]

void onExtWowLeftChange(unsigned int newValue) {
   if (newValue == 1){
     LeftWow = 1;
   }
   else {
     LeftWow = 0;
   }
}
[color="red"]DcsBios::IntegerBuffer extWowLeftBuffer(0x54c4, 0x0100, 8, onExtWowLeftChange);[/color]


void setup() {
 DcsBios::setup();
 pinMode(9, OUTPUT); //Output for solenoid control

}

void loop() {
 DcsBios::loop();
 
 if (NoseWow == 0 && RightWow == 0 && LeftWow == 0){ //all wheels off the ground
   digitalWrite(9, HIGH); //activate solenoid to retract downlock
 }
 else {
   digitalWrite(9, LOW); 
 }
}

Note that I have a modified F18 library, so the addresses in red will probably not work for you. Copy the code snippets from your own control reference and use this as inspiration for the code logic.

 

Here's video where I test the new code. Not sure you can see anything but you should at least be able to hear the solenoid activating as the wheels leave the deck, unlocking the handle.

Link to comment
Share on other sites

I can confirm that gear animation arguments are the same for at least the

  • A-10C
  • AJS37
  • AV-8B N/A
  • F-5E
  • F-14,
  • F/A-18C
  • F-86F
  • L-39
  • M-2000C
  • MiG-15, 19, 21

only the Harrier has an additional argument for the main/rear center wheels, like so:

defineIntegerFromGetter("EXT_WOW_REAR", function()
if LoGetAircraftDrawArgumentValue(343) > 0 then return 1 else return 0 end
end, 1, "External Aircraft Model", "WoW Rear Gear")


Edited by DeadMeat
Code
Link to comment
Share on other sites

It arrived today!

 

So, the adventure begins... got my Tornado gear lever today and now down to business of figuring out how to wire this baby up and get it working like DeadMeat’s. I’ve attached photos here, but does the wiring diagram look like the one you have DM? Seems pretty minimal in terms of information, and don’t know how to read it anyway. I will be able to get the help of my coworker aircraft technicians in their shop at my work hangar, but rather figure it out without their help if possible.

 

Edit- wow, I just discovered the letters written in micro print by the pins, maybe I can figure this out! More to come....

2305C0A0-6E91-4401-90B1-E621AC6A5728.thumb.jpeg.5d3f0026984b3709ea895122317a11f8.jpeg

DF166871-EE5F-422C-88B6-8371783F30A8.thumb.jpeg.e44eda2504a6db96cc47b0022cfc4fa8.jpeg

B17F4D3F-B7F2-4C71-B8F8-47C55DA502F6.thumb.jpeg.9ffb288a526cd436806543e420fe2a27.jpeg

AD3F5A81-3BAA-4E98-8D8B-1077CD50D33E.thumb.jpeg.dde862c24515ffab8105c1dbc31f41a5.jpeg

6D94F386-32E0-4105-9FFA-50964A491049.thumb.jpeg.f474e234137495416667b0663874c5a0.jpeg

ED43BE3C-EFA4-4554-A3B5-9B33975425C4.thumb.jpeg.0afa85c68702560bf2dc5104e284e01d.jpeg


Edited by Sickdog

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

So, the adventure begins... got my Tornado gear lever today and now down to business of figuring out how to wire this baby up and get it working like DeadMeat’s. I’ve attached photos here, but does the wiring diagram look like the one you have DM? Seems pretty minimal in terms of information, and don’t know how to read it anyway. I will be able to get the help of my coworker aircraft technicians in their shop at my work hangar, but rather figure it out without their help if possible.

 

Edit- wow, I just discovered the letters written in micro print by the pins, maybe I can figure this out! More to come....

 

Looks good! The circuit is similar to mine. It is really simple actually, you need to hook this up the same way you would a toggle switch. As I mentioned above I would recommend that you get DCS BIOS running with something simpler first though so you know your arduino and code works.

 

Regarding your gear handle there's redundant switches in there so you can hook up to any you want. For example, the left most on the diagram connects pin X as ground with pin W when the handle is down, and X to pin Y when the handle is up (or perhaps it's flipped, you can fix that in software)

For a quick and dirty solution, you can simply solder wires to the corresponding pins on the back and plug into your arduino: X to ground and W and Y to two digital ports, e.g. 3 and 4.

 

Load a blank DCS-BIOS sketch in your arduino IDE, paste the landing gear code snippet from the control reference and tell it what you have connected. You need to go into "Advanced" view to get the code that uses two pins instead of a single (like a push button would have)

 

For the A-10C it could look like this

 

/*
 Tell DCS-BIOS to use a serial connection and use interrupt-driven
 communication. The main program will be interrupted to prioritize
 processing incoming data.
 
 This should work on any Arduino that has an ATMega328 controller
 (Uno, Pro Mini, many others).
*/

#define DCSBIOS_DEFAULT_SERIAL

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */

[b]const byte gearLeverPins[2] = {[color="Blue"]3[/color], [color="DarkOrange"]4[/color]};
DcsBios::SwitchMultiPos gearLever("GEAR_LEVER", gearLeverPins, 2);[/b]

void setup() {  
 DcsBios::setup();
 
}

void loop() {
 DcsBios::loop();

}

Flash the board and connect the com port. You should be able to use the handle in game. You can just flip 3 and 4 in code if the action turns out to be reversed.

 

The downlock solenoid is activated by running at least 12V positive on pin C and pin D to your 12V ground (e.g. connect a 12V wall wart power supply to a DC barrel jack adapter).

 

If you want to control the solenoid with the arduino you need a logic level mosfet circuit as the arduino can't handle 12V directly. Wire one up yourself or get a pre-made kit - just make sure it is logic level switching. You can use the WoW code I posted earlier to activate the circuit if you want.

 

The lights are 28VDC bulbs so either feed them that or switch them out for 5V LEDs and run them directly from the arduino. Just be sure to put a pre resistor in there. They look to be in parallel so factor that in. Connect pin B to ground and pin A to a PWM enabled arduino pin (e.g. 5) and paste code from the control reference just below the gear lever code and give it some PWM dimming code, e.g. like this for the A-10C:

 

void onHandleGearWarningChange(unsigned int newValue) {
  if (newValue == 1){
   analogWrite([color="Green"]5[/color], 255);
  }
  else {
   analogWrite([color="Green"]5[/color], 0);
  }
}
DcsBios::IntegerBuffer handleGearWarningBuffer(0x1026, 0x4000, 14, onHandleGearWarningChange);

 

 

Outstanding work @DeadMeat. Thanks a bunch for solving this for us :thumbup: Much appreciated sir

 

Cheers

Hans

 

No sweat this is the fun part, messing with these things trying to get stuff interfaced :)


Edited by DeadMeat
Link to comment
Share on other sites

DeadMeat, I owe you a beer if you're ever in Los Angeles! THANK YOU!

 

So I've already been experimenting with DCS BIOS, got up and running super fast and have a template (printed out panel taped to cardboard) with Landing Light, Hook Bypass, Launch Bar, and Anti-Skid on/off toggle switches working great with an Elegoo R3 Aurdino (starter kit I bought from Amazon for about $39 USD) and a temporary landing gear lever using an analog joystick (from starter kit). I even went crazy at the hardware store, just playing with ideas to test out, and purchased a $0.99 USD light switch and attached a small metal tube to it to temporarily try out an arrestor hook. I couldn't believe it all worked the first time with DCS-BIOS, unreal how easy this is for someone without much experience like myself. So long story short, I've been getting very familiar with Aurdino/DCS-Bios while awaiting the gear lever, so I feel ready to tackle this.

 

The info you gave in this last post is the missing link on wiring it up and getting the solenoid to work, so I can't thank you enough! I'm on a work trip tomorrow and in a hotel for a couple days, I might bring some of this with me to play with in the hotel room... so stay tuned!

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Just a quick note- I tried the gear handle out, and with your invaluable help DeadMeat, it worked on my first attempt! I wired it up EXACTLY the way you told me to, and the part I would never have figured out on my own is the "Advanced" mode of DCS-BIOS and the two pin line of code, so THANK YOU! Even the gear lights are lighting up great without having to do anything other than wire up PIN B and adding the line of code for the gear light. Unreal. I absolutely love this! Now I'm just waiting for my parts to come in from Amazon to wire up and power the Solenoid, hopefully that's as straight forward as the rest so far. I can't wait to mount this baby to my Monstertech and start slapping the gear up and down... Now I want to do the hook lever like you did too. One thing at a time.

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Sickdog, that's just fantastic!

I know a few folks around here have these gear handles laying around, so hopefully you'll have inspired them to get theirs hooked up as well.

Link to comment
Share on other sites

  • 2 weeks later...

After a little hiatus from my project I'm back at it and good news to report- I went through a lot of struggling (and many times I almost begged for help here), but I figured out with your great help from earlier DeadMeat.

 

One of the issues I had was a problem loading the Control-Reference.html in Microsoft Edge after editing the F-18 LUA file, until I figured out I need to load it in Google Chrome (or maybe anything other than Edge) to work. Then I finally saw the addresses for the WOW functions in the control refference, plopped them into my sketch and passed that hurdle.

 

The next issue (for anyone getting help reading this) was I didn't ground the Mosfet power switcher to the Arduino board... so I was getting intermittent issue with the WOW function powering the downlock solenoid. Once I got that wired properly, it worked pretty well with one exception. I'm not sure if it's an issue witht the actual solenoid/gear lever or maybe I'm still doing something wrong, but the first time it tries to energize the solenoid with the aircraft airborne (weight off wheels) the solenoid seems to energize partially (yet I don't hear it) but the downlock is still engaged and I can't retract the gear. If I push down maybe 1/4 the way of the mechanical downlock overide button, I can hear a little buzzing and then the click, and then the solenoid/downlock mechanism works fine for the rest of the flight without pushing down anymore on the override button. The solenoid de-energizes properly when I land/crash/reset the mission and then I have to repeat that partial button press process each time I go weight off wheels again. Kinda annoying, and to defeat it, I have taped down the button partially just enough so the downlock still locks and the gear can still be retracted weight off wheels without me pressing it. Would love to figure out what the problem is but I can live with this.

 

(Edit - forgot to mention that when I plug the 12V wall wart power supply directly into PINs C and D of the cannon plug, the solenoid powers but I have the same issue where I need to press the mechanical down lock override a little (maybe 1/2 way) to get it to unlock, and then the gear can be retracted and extended over and over fine without having to press the down lock override at all, until I unplug the wall wart power, at which point I have to repeat that process just mentioned... so I think it's an issue with the gear assembly/down lock/solenoid itself, and not the code/Arduino/mosfet)

 

(Edit 2 - this tape solution isn't working that well. Now I'm wondering if perhaps I'm not getting enough voltage or amperage to the solenoid, is that possible? I got a power adapter purchased off of Amazon.com that outputs 12V and 500mA. Could that be the problem?)

 

 

 

Thanks again for all your help DM, and I'll post a video when I'm all done mounting it. On that note, I've been using wires with female ends connected to the back of the cannon plug connections... seems to work fine, no need to solder anything. Any issues with that or is it better to solder to the pins?


Edited by Sickdog

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

(Edit 2 - this tape solution isn't working that well. Now I'm wondering if perhaps I'm not getting enough voltage or amperage to the solenoid, is that possible? I got a power adapter purchased off of Amazon.com that outputs 12V and 500mA. Could that be the problem?)

 

Thanks again for all your help DM, and I'll post a video when I'm all done mounting it. On that note, I've been using wires with female ends connected to the back of the cannon plug connections... seems to work fine, no need to solder anything. Any issues with that or is it better to solder to the pins?

 

Not sure what the problem is though 0.5A supply could be cutting it close, but to be sure you could measure the resistance over the coil and see what it will draw. I measured 40 ohms I think (0.3A at 12VDC) on mine. There could be a current spike when you turn it on that exceeds your supply, but I'm not sure that's actually an issue on DC solenoids in the first place..

 

More likely the problem is voltage and wear/friction. The solenoid is meant to work at 28V as the chart on the lever says, so 12V is really at the lower end of where it'll actually actuate. Combine that with possible mechanical friction in a used piece of hardware and well you see why you might need a little more to get it going.

 

I had similar issues at 12V at first but now it's running fine for some reason, but then it is also a different model. I also run very real Honeywell mag switches (locking and normal action) at 12VDC with no problem even though they're also meant for 28V, so I figured that yours would also work at that voltage..

 

You could try a 24V adapter (easier to find than 28V) which should definitely get you going. Note that the current draw is higher at higher voltages - Hansolo measured 0.65A at 28V on his landing gear lever which is similar to mine. Probably yours will draw similar amps so get a PSU that provides enough.

 

As for the connectors, as long as there's a connection it's fine I guess. You should maybe hot glue them in place so they don't come loose.

Link to comment
Share on other sites

Well, these solenoid normally are 28V 400hz, so 12v is quite low.

In F16 original mag switchs we use 24V activated by a relay, for sim use.

Cheers

 

Well that's bit odd since all the mag switches I have, including one on an F-16 harness and on on a Huey panel, is marked with 28VDC not AC.

 

I have been running my 7 mag switches in the A-10C pit for over 2 years on 12VDC over MOSFET's and never had any issues;

 

 

 

Cheers

Hans

Link to comment
Share on other sites

 

More likely the problem is voltage and wear/friction. The solenoid is meant to work at 28V as the chart on the lever says, so 12V is really at the lower end of where it'll actually actuate. Combine that with possible mechanical friction in a used piece of hardware and well you see why you might need a little more to get it going.

 

I had similar issues at 12V at first but now it's running fine for some reason, but then it is also a different model. I also run very real Honeywell mag switches (locking and normal action) at 12VDC with no problem even though they're also meant for 28V, so I figured that yours would also work at that voltage..

 

You could try a 24V adapter (easier to find than 28V) which should definitely get you going. Note that the current draw is higher at higher voltages - Hansolo measured 0.65A at 28V on his landing gear lever which is similar to mine. Probably yours will draw similar amps so get a PSU that provides enough.

 

.

 

Thanks so much for the info guys. I’m really not educated in electrical systems other than generators and busses for the plane I fly, so my apologies for dumb questions. But would the power supply you linked from SparkFun that’s 12v 600mA possibly make a difference or should i just go straight for a 24v supply?

 

 

(Edit- would something like this work?

 

http://www.amazon.com/dp/B01EG137I0/ref=cm_sw_r_cp_api_i_oR4JDbQB39JV0

 

Thanks again!


Edited by Sickdog
Added link for possible 24v supply

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Thanks so much for the info guys. I’m really not educated in electrical systems other than generators and busses for the plane I fly, so my apologies for dumb questions. But would the power supply you linked from SparkFun that’s 12v 600mA possibly make a difference or should i just go straight for a 24v supply?

 

 

(Edit- would something like this work?

 

http://www.amazon.com/dp/B01EG137I0/ref=cm_sw_r_cp_api_i_oR4JDbQB39JV0

 

Thanks again!

 

The sparkfun one was just an example (that I haven't tried myself) but if your power supply is bad and doesn't supply what it's supposed to it could explain the problem. I would go for at least 12V 1A supply though to be sure.

 

I haven't seen anyone else with your gear lever so we don't actually know if it is possible to stick with 12V, so moving up to 24V could make sense. Of course since the gear lever is *used* there could be a mechanical problem that we wont solve with higher voltage so bear that in mind

 

The adapter you linked to has some pretty bad reviews, so maybe spend like 5 bucks more and get something like this https://www.amazon.com/SHNITPWR-100V-240V-Converter-Transformer-5-5x2-5mm/dp/B07Q29CD7J/ref=sr_1_4?keywords=24v+wall+wart&qid=1569747130&sr=8-4 note that this one has a 5.5x2.5 mm plug but looks like it comes with the female connector that fits..

Link to comment
Share on other sites

The sparkfun one was just an example (that I haven't tried myself) but if your power supply is bad and doesn't supply what it's supposed to it could explain the problem. I would go for at least 12V 1A supply though to be sure.

 

I haven't seen anyone else with your gear lever so we don't actually know if it is possible to stick with 12V, so moving up to 24V could make sense. Of course since the gear lever is *used* there could be a mechanical problem that we wont solve with higher voltage so bear that in mind

 

The adapter you linked to has some pretty bad reviews, so maybe spend like 5 bucks more and get something like this https://www.amazon.com/SHNITPWR-100V-240V-Converter-Transformer-5-5x2-5mm/dp/B07Q29CD7J/ref=sr_1_4?keywords=24v+wall+wart&qid=1569747130&sr=8-4 note that this one has a 5.5x2.5 mm plug but looks like it comes with the female connector that fits..

 

Great! Once again, thanks so much for your help DM! I’ll try that one and report back in a couple days when it arrives.

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Ok. Getting tired of me yet? :) I'm about ready to just give up as the solenoid down lock certainly isn't a deal breaker if I can't get it to work, I'm just happy to have the functioning gear lever with LED's lit up with DCS. But... I'd absolutely love to get the solenoid working properly. So here's the deal....

 

I got the 24V adapter from Amazon that you linked for me, and sure enough plugging straight away into the cannon plugs energized the solenoid and released the gear down lock with no problem (as opposed to the wimpy 12V that needed some mechanical help). Great. So, next I hooked it all up... the gear lever, power supply, and SparkFun MOSFET Power Control Kit to my Lafvin Nano running DCS-BIOS. I used the Sparkfun wire diagram as a reference, which shows a common ground for the power supply and the Arduino board. Aside from some issues with the MOSFET (seems like I have to wiggle the wires on the power side a little to make it work, despite what appears a pretty good soldering job I did putting it together, not sure what the deal is there), once I had wiggled the wires just right it was working great in DCS with WOW switching and everything. But... maybe 20 minutes in or so I began to smell faint burning.... UH-OH. I unplugged everything right away, nothing was melted or burnt but the Lafvin Nano card was scorching hot. Yikes. The card still works but I figured I better come to the experts before I try plugin in that 24V again.

 

I'm guessing I'm an idiot for assuming the Nano can have a common ground with the 24V power supply, does that sound like an issue? Any ideas on how I can hook this 24V up without burning down my house? :)

 

Thanks again for your time and patience dealing with a complete electrical putz here, I may not know much about it but I feel like I'm learning a lot and really enjoying this project.

 

 

***

EDIT- I just noticed that I somehow overlooked the 10K resistor that came with the Sparkfun Mosfet kit, I still need to solder that onto the mosfet. Could that possibly be related to my problems?

***


Edited by Sickdog
update to my mosfet issues

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Another Update:

 

Ok, so I soldered the 10K resistor onto the Mosfet, and I've cleaned up the wiring a little by making sure everything is either soldered together or securely pinned in place on gear lever and the Lafvin Nano.

 

No more smoking or overheating of anything when all plugged in (maybe I had a brief short when I smelled the burning, I had a lot of wires all over the place)... so that's good.

 

But here's the latest strange behavior: With everything plugged in, DCS-BIOS CMD running, and in game initially, the downlock is functioning properly. As soon as I go weight off wheels, the solenoid energizes and I can retract the gear. Great! But then when I land/crash/restart, the solenoid isn't de-energizing and therefore I can continue to raise the physical lever while virtually on the ground in the F-18. What's weird is I know at one point during this project I could hear the solenoid de-energize when I crashed/landed/escaped out of the pit. I'm not sure what's going on now. Here's my code in the sketch and some photos that might show what my setup looks like for better understanding.

 

#define DCSBIOS_DEFAULT_SERIAL

#include "DcsBios.h"

byte NoseWow = 0; //weight on wheels - check if variable needs to match unsigned int
byte RightWow = 0;
byte LeftWow = 0;

/* paste code snippets from the reference documentation here */

//---Check for WoW
void onExtWowNoseChange(unsigned int newValue) {
   if (newValue == 1){
     NoseWow = 1;
   }
   else {
     NoseWow = 0;
   }
}

DcsBios::IntegerBuffer extWowNoseBuffer(0x74cc, 0x0200, 9, onExtWowNoseChange);

void onExtWowRightChange(unsigned int newValue) {
   if (newValue == 1){
     RightWow = 1;
   }
   else {
     RightWow = 0;
   }
}

DcsBios::IntegerBuffer extWowRightBuffer(0x74cc, 0x0400, 10, onExtWowRightChange);

void onExtWowLeftChange(unsigned int newValue) {
   if (newValue == 1){
     LeftWow = 1;
   }
   else {
     LeftWow = 0;
   }
}

DcsBios::IntegerBuffer extWowLeftBuffer(0x74cc, 0x0800, 11, onExtWowLeftChange);

DcsBios::LED landingGearHandleLt(0x7478, 0x0800, 4);
const byte gearLeverPins[2] = {2, 3};
DcsBios::SwitchMultiPos gearLever("GEAR_LEVER", gearLeverPins, 2);


void setup() {
 DcsBios::setup();
 pinMode(5, OUTPUT); //Output for solenoid control

}

void loop() {
 DcsBios::loop();
 
 
 if (NoseWow == 0 && RightWow == 0 && LeftWow == 0){ //all wheels off the ground
   digitalWrite(5, HIGH); //activate solenoid to retract downlock
 }
 else {
   digitalWrite(5, LOW); 
 }
}

IMG_4283.thumb.jpg.048ca3db20f5d958fb2ac5eae2ded3d7.jpg

IMG_4284.thumb.jpg.640ae1170d6a60b1e84504086146a804.jpg

IMG_4288.thumb.jpg.88486e4db844cb2d73bc13fb62331d27.jpg

cquVpw-5.jpeg.jpg.64dcac4c2089645dfd1496d3e55701a4.jpg


Edited by Sickdog
Added code from sketch

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

Well, we're getting somewhere with this thing :)

 

I'm not sure why the solenoid doesn't pop back off upon landing/restart though. I'm not an electronics expert but I wonder if the MOSFET has trouble turning all the way off. Code is the same as I have so I think we're looking at a hardware/wiring issue.

 

We gotta be careful about not shorting things or electrocuting ourselves here, but perhaps try energizing the coil as normal (take off, no WoW), then manually pull the signal wire from the arduino (which is like sending the LOW signal in code). The mosfet should turn off and the coil de-energize.

 

Depending on what happens there could be a grounding problem - a loose connection - or a circuit problem (mosfet incorrectly wired) but I just can't tell from your pictures, sorry.

Check your connections (especially your soldered common ground wires), connections on the Arduino, dupont wires in the screw terminals on the 24v supply (these are notoriously loose)..

Link to comment
Share on other sites

Well, we're getting somewhere with this thing :)

 

I'm not sure why the solenoid doesn't pop back off upon landing/restart though. I'm not an electronics expert but I wonder if the MOSFET has trouble turning all the way off. Code is the same as I have so I think we're looking at a hardware/wiring issue.

 

We gotta be careful about not shorting things or electrocuting ourselves here, but perhaps try energizing the coil as normal (take off, no WoW), then manually pull the signal wire from the arduino (which is like sending the LOW signal in code). The mosfet should turn off and the coil de-energize.

 

Depending on what happens there could be a grounding problem - a loose connection - or a circuit problem (mosfet incorrectly wired) but I just can't tell from your pictures, sorry.

Check your connections (especially your soldered common ground wires), connections on the Arduino, dupont wires in the screw terminals on the 24v supply (these are notoriously loose)..

 

Thanks DM, I really appreciate your sticking with me on this, despite my obvious lack of electrical knowledge! So I tried what you suggested regarding pulling the signal wire from the Arduino and sure enough, it stays energized. I've even switched from the Lafvin Nano back to my original Elegoo Uno and bread board with new wires to isolate some variables and same results. Interestingly enough, the only way power is cut to the solenoid is if I pull the negative lead from the power supply to the breadboard. If I pull any of the other common ground wires, the solenoid stays energized. I've also switched between different power supply female connections and disassembled/reassembled the wiring multiple times with no change in results, so I think I'm left with one possibility... either a faulty or improperly wired mosfet. I've got some new ones on order (different brand but still Logic Level: Cylewet 6Pcs RFP30N06LE Logic Level N-Channel Power Mosfet TO-220 Power Control DIY Kit for Arduino (pack of 6)CYT1069) from Amazon.

 

I'm wondering if I just fried this current Mosfet somehow and it's shorting out, seemed like it was working fine in the beginning, minus the lack of voltage from my 12V for the solenoid. Stay tuned for more updates, I think I'm getting close to success (or failure)!

 

In the mean time, just got my first 3D printer setup, so looking forward to building some parts to go along with this new gear handle. I've officially begun spiraling down the Rabbit Hole!

TM Warthog, Oculus Rift, Win10...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...