Drakeshoot Posted February 2, 2024 Posted February 2, 2024 Hi all, I’m planning on building my first button box, the Weapons Control Panel & extras for the upcoming F-4E. This means I need rotary encoders with push (weapons select, stores jettison etc), a couple of rotary potentiometers (bomb release interval and probably course & heading knobs), some on-on switches (master arm and CW Interlock), some on-on-on switches (nose-tail fusing switch) and a pair (on)-on-(on) switches for AFCS and Alt hold. I appreciate the last pair are magnetic in the real jet but sometimes they don’t engage in the F-14 due to me being out of parameters so I’d like a return to centre so I can repeatedly send “on” signals rather than having to manually cycle the switch to keep in sync with the cockpit. In order to achieve this, I’ve got a arduino and a bunch of switches, pots and rotaries in the post but I’ve already hit my skill limit. I don’t know how a circuit works, I can’t solder and I can’t code. I’m going to have to learn these things, which is fine, I’m looking forward to it, but I do need someone to idiot check me at this point. I'm pretty sure the Arduino UNOs I ordered (got a pair just in case one was DoA) won’t have enough pins to manage all of these inputs so I’m going to get a Mega. Can I bolt 2 UNOs together instead with a single USB out, or is that a level of complexity I don’t want to be messing with yet? I found Circuito.io with an auto wiring tool which is massively helpful in making me think about wiring up (don’t forget, I haven’t got a clue), it doesn’t have many switch options though, is there a similar tool with more input options? Am I approaching this in the right way? Is there anything I’m missing? Thanks for taking the time to read this, I’m very excited, but also utterly incompetent so any advice would be gratefully received.
No1sonuk Posted February 3, 2024 Posted February 3, 2024 (edited) The first thing to think about is that the Uno and Mega can't work like game controllers over USB (also called HID or Human Interface Devices) without reprogramming the base code of the USB interface device - IF the Arduino you have has a reprogrammable interface device. If you're new to coding, I'd suggest NOT doing that. You CAN use those devices with DCS-BIOS, though. DCS-BIOS is an interface system for Arduinos and ESP32s to interface with DCS. It's aircraft-specific, though, and relies on the aircraft being included and updated by the developers (who are not employed by ED). That's generally a few days behind DCS updates. Oh, and no - you can't bolt 2 Arduinos together with a single USB out. But with a USB hub, you can use multiple Arduinos. For what you want, you might be able to use a Leo Bodnar BU0836X. This has 32 digital inputs (encoders use 2 each) and 8 analogue inputs (pots, etc.). It'll show up as a game controller in Windows and DCS with no coding, other than using the Bodnar encoder configuration program. If you still want to go the Arduino route without DCS-BIOS, a Leonardo or Pro Micro have the correct USB interface devices for use as a HID. The Leonardo is usually compatible with Uno form factor shields, and the Pro Micro is similar to a Nano, but not the same size. Firstly, you need to determine exactly how many inputs you need of each type: Encoder = 2 digital inputs each (3 including the push) Pot = 1 analogue input each Switch = 1 digital input per on position Once you have that list, you can decide which device(s) to use, and how. Hope that helps for a start. EDIT: Also, I just looked at Circuit.io - It doesn't do things the way I would. For example, it uses "active-high" switches, which need external pull-down resistors. The Arduinos have built-in pull-up resistors for "active-low" switches... Edited February 3, 2024 by No1sonuk Looked at Circuit.io and added comment 1
Bucic Posted February 4, 2024 Posted February 4, 2024 I think in essence we are asking similar questions. rrr F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
Drakeshoot Posted February 6, 2024 Author Posted February 6, 2024 Fantastic, thank you both. I’ve decided, based on your feedback to break down my bloated, mission-creep hell project into a number of smaller sub-projects. the first one will be just the weapon release controls for the F-4 and will be based on the Uno via DCS Bios (it’s in the post, might as well use it for something), the second will be a more “utility” box based on a Pro Micro (ordered) for it‘s USB simplicity and consist of course & heading pots, tacan rotaries and AFCS switches which will be useful across most modules. I’ll probably do the latter first as the simpler of the two. Thanks again, your comments have really helped solidify the vague, ephemeral concepts that were so exciting into a series of concrete steps.
Bucic Posted February 6, 2024 Posted February 6, 2024 Sooner or later you're going to face the problem of insufficient number of pins and shift registers as the solution. Please ping me if you start incorporating any. It may be you're ahead of me with your project and I'd appreciate some pointers as well. F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
No1sonuk Posted February 8, 2024 Posted February 8, 2024 Just to make sure, you need to start with this version of DCS-BIOS, _NOT_ the "Hub" version: https://github.com/DCS-Skunkworks And this is a decent start-up video:
No1sonuk Posted February 8, 2024 Posted February 8, 2024 Just noticed there's no "F4" on the DCS-BIOS compatability list. It'll have to be added after release for the Uno/DCS-BIOS combination to work for it. The Pro-micro operating as a game controller would work straight away, though.
98abaile Posted February 8, 2024 Posted February 8, 2024 (edited) On 2/2/2024 at 1:58 PM, Drakeshoot said: Hi all, I’m planning on building my first button box, the Weapons Control Panel & extras for the upcoming F-4E. This means I need rotary encoders with push (weapons select, stores jettison etc), a couple of rotary potentiometers (bomb release interval and probably course & heading knobs), some on-on switches (master arm and CW Interlock), some on-on-on switches (nose-tail fusing switch) and a pair (on)-on-(on) switches for AFCS and Alt hold. I appreciate the last pair are magnetic in the real jet but sometimes they don’t engage in the F-14 due to me being out of parameters so I’d like a return to centre so I can repeatedly send “on” signals rather than having to manually cycle the switch to keep in sync with the cockpit. In order to achieve this, I’ve got a arduino and a bunch of switches, pots and rotaries in the post but I’ve already hit my skill limit. I don’t know how a circuit works, I can’t solder and I can’t code. I’m going to have to learn these things, which is fine, I’m looking forward to it, but I do need someone to idiot check me at this point. I'm pretty sure the Arduino UNOs I ordered (got a pair just in case one was DoA) won’t have enough pins to manage all of these inputs so I’m going to get a Mega. Can I bolt 2 UNOs together instead with a single USB out, or is that a level of complexity I don’t want to be messing with yet? I found Circuito.io with an auto wiring tool which is massively helpful in making me think about wiring up (don’t forget, I haven’t got a clue), it doesn’t have many switch options though, is there a similar tool with more input options? Am I approaching this in the right way? Is there anything I’m missing? Thanks for taking the time to read this, I’m very excited, but also utterly incompetent so any advice would be gratefully received. Always start with the design requirements, design the panel first. Decide exactly what you want to include or exclude; decide the layout and what compromises you're willing to make (you don't need true to life panels in a non true to life gaming setup), THEN decide what hardware you need. For now the coding part seems like the biggest hurdle because you've never done it before, but really once you understand it it's more tedious than hard. It's A LOT easier to change the code after the fact than it is to have to redesign and rebuild the panel though. Design the panel first. As to your stated idea, as an example, here's what I'd do: If it were me, looking at the real panel, I'd ditch the instrument brightness knob and move the fuse selector switch lower in order that everything can fit on a rectangular panel. If I didn't have one I'm working on already, I'd include a switch for the landing gear lever where the AoA dial would be. Since I play in VR exclusively, I've no need for the LED indicators, so I'd use cheaper switches with custom caps; this avoids having to buy or design/make specialised buttons and also means I can avoid having to wire or program any LEDs; this also means I wouldn't require DCS-BIOS, so I could make it a generic (albeit oddly laid out) button box. Next, because rotary encoders are a pain to code outside of DCS-BIOS, I'd need to decide if I wanted to use them for most of the knobs (making it more generically useful) or not. Assuming I wanted to keep some sense of immersion, I'd use 12 position and 8 position rotaries for the qty selector and weapon selector knobs, the AWRU knob could be a potentiometer but I'd be specifically looking for one with 270 degrees of rotation (which is most cheap ones). The delivery mode knob has a centre push but the label implies it's only for jettisoning nuclear weapons; I'd have to ask if that functionality is even in the game, because if not I could be using a 16 position rotary pined for 13 positions instead (NOTE: 16P rotaries are expensive, so in reality I'd probably use an encoder anyway, but for this example we'll assume a rotary). The only knob that would give me a headache would be the selective jettison knob. It's an 8 position rotary using 7 positions, but the issue is the need for a centre push. I've done it before on another panel with an encoder (with push), but what if I wanted to make it more realistic instead? For arguments sake, let's assume I'd found a way to use a rotary instead. With the hardware figured out, we can work out what inputs we need. We need two analogue inputs (one for the AWRU knob and one for the dimmer next to the pylon indicators). The two position switches only need 1 input (since the off state can also be coded for or just setup in game), similarly the 3 position switches only need 2 inputs. This gives 19 digital inputs plus 2 for the landing gear lever I specified earlier (I used a 3P switch in mine), so 21 digital inputs so far. Now comes the question how many digital inputs would we need for the rotaries? By my count it would require 39, giving us a total of 50 digital inputs required. With 50 digital inputs and 2 analogue inputs (and no outputs) we can now decide what controller to use. With that many digital inputs, we'd need an arduino mega (54 digital inputs available), knowing that we could now design the enclosure. This would also be the simplest to wire and program. However since I've already got experience with coding multiplexers, I could use 3X 16 channel multiplexers and reduce that pin count to 8 digital pins and 2 analogue, meaning I can now use a pro micro instead. Now let's assume I'd selected encoders for the delivery mode knob and the sel jett knob. That's 16 less inputs required and one gained for the nuclear jettison; leaving us with 35 digital inputs. The problem is that encoders don't work well if at all with multiplexers, meaning we need 4 pins wired directly to the board. So 31 inputs using 2 multiplexers and 4 directly connected inputs means I would need 10 digital pins and 2 analogue pins. If I replaced all the rotaries with encoders, I'd have 21 inputs I'd still need 2 multiplexers for and now 8 digital inputs straight from the board, which equates to 14 digital inputs and 2 analogue. If I weren't using encoders I'd need 29 digital pins, so I would need something bigger than a pro micro. EDIT: ...and then I found out 5 of those buttons were just lights. I can't be bothered to change the above text now. Edited February 8, 2024 by 98abaile 2 1
Drakeshoot Posted February 10, 2024 Author Posted February 10, 2024 World class responses, thanks guys. It isn’t the learning that’s the hard part, but rather figuring out what I need to learn. Knowing what I don’t know. This has all been enormously helpful.
98abaile Posted February 11, 2024 Posted February 11, 2024 In the vein of knowing what you don't know, if you do use encoders with arduino code instead of DCS-BIOS, make sure you know what the interrupt pins are for your chosen board (0, 1, 2, 3, 7 for a pro micro) and make sure you keep them for encoder use only. As I said, in my experience programming encoders in arduino is a pain and I'm only just getting to grips with my own project that uses encoders, everything else works fine. Some encoders send 1 pulse per click, some send 2 pulses and some even send 4 and you have to code around them if you don't want multiple button presses with each click. But yes, general workflow is figure out all the functionality you need (including limitations like space, and what compromises you're willing to make) and lock that down first, then figure out the switch requirements, then the hardware requirements. Also don't be afraid to ask questions or for assistance.
Recommended Posts