Controls box for Virpil Desk Mount (Arduino) - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 04-21-2018, 09:38 AM   #1
Karon
Member
 
Karon's Avatar
 
Join Date: Apr 2009
Location: London - UK
Posts: 511
Default Controls box for Virpil Desk Mount (Arduino)

This thread is about Arduino and how easy is to create a control boxes fitted with whatever type of control you want: push-buttons, momentary buttons, 2/3 way switches, rotary encoders, etc.
I've promised in the Vipil T-50 thread that I was going to open this thread like a month ago but never had time (or, probably, I've just forgot )


Virpil Desk Mount is a massive piece of metal. It's heavy, big and.. empty. In my strugge to avoid using the mouse at all costs, I thought it'd be cool to convert the empty area inside the Desk Mount and add some controls there. I though about using a 8/16 bits microcontroller since I've worked on them for a decade, then I found Mr Arduino. A quick research and google suggested me this video.. Eureka!
https://www.youtube.com/watch?v=Z7Sc4MJ8RPM

That video is the perfect place to start: it was easy to understand, it has both the source code and the libraries. The idea is to configure Arduino I/O pins as inputs and use them to control a wide range of switches and buttons by means of a button matrix. Moreover, it also supports rotary encoders. The sketch linked in the video doesn't support potentiometers.

PLANNING
Since the control box is for DCS I decided to use momentary-switches. I have a Saitek TPM which mounts 9x 2-way non-momentary switches and I had to use DCS Bios in order to make them work (I reckon Black Shark 1 hardly digested non-momentary buttons, I don't know if 2.5 / 1.5.x are different) and emulate a keyboard. Hence I went for momentary switches + 4 encoders.
By using this firmware, Arduino is seen by windows as a gaming peripheral, not different from any other commercial joystick. It allows for direct mapping in DCS without the necessity of emulating the keyboard (this also mean no additional programs running in background)!

BOXES DETAILS
I have built two control boxes, one is held into Virpil's desk mount for their MongoosT-50, the other box is a radio/lights controls box with 6 rotaries. Unfortunately when I moved abroad I didn't carry all my DIY stuff with me, so I had to buy everything again. If you have a drill, soldering iron, wires, boxes and screws you have already saved a good amount of money.

“Virpil’s” control box is fundamentally a copy-paste of the video aforementioned. I have modified the wiring and added two standard pushbuttons + a few 3-way momentary switches because I didn’t like push-buttons encoders here. Software-wise, it’s basically the same. It has:
- 9x 3-way momentary switches;
- 4x rotary encoders;
- 6x standard momentary buttons.

The second box's wiring is even simpler, having a smaller matrix (3×3→9 buttons). It mounts:
- 4x rotary encoders;
- 2x rotary encoders + push buttons;
- 3x standard momentary buttons;
- 3x 3-way momentary switches.

PICS
NOTE: I'll add some decent pics later on. These are low quality, quite old and the encoders caps were still missing.

"Controls Column"
Soldering!



(the only pic with caps atm)


"Radio Box"
NOTE: I don't have proper tools to cut the plastic and the result is far from ideal. Any way, as long as it works, I'm happy
This pic was still WIP, I was waiting for the delivery of caps and the last 3-way momentary push-button.


Complete setup



MAPPING
I've linked a couple of my setups in this post: https://forums.eagle.ru/showpost.php...postcount=1963
Those configs are actually quite old, I have ordered Virpil's Throttle and I'm waiting for its delivery (it will take ±40 days at least, unfortunately) before changing them. Unfortunately the Shark has some poor controls options by default (I'll get a beer to whoever manages to add some more via lua!) and the Harrier is still WIP.
As already mentioned, Arduino is seen by windows and DCS as any other gaming device. You can assign controls right into the Controls Options menu in-game. No other programs or keyboard emulators are required.
__________________
KEEP CALM AND AUTOROTATE
Virpil T-50 • TM TWCS Throttle • CH Pro Pedals • TIR 4 • TM MFDs • Saitek Quadrant • CH MFP • 2xArduino CB -- waiting for Virpil's Throttle!

132nd Virtual Wing - 696th vSquadron
VCB: ArmA3 British Army Light Infantry platoon
A3/DCS youtube channel: ArmA3 streaming + DCS nonsense
Arduino controls box forum thread
Karon is offline   Reply With Quote
Old 04-22-2018, 07:27 AM   #2
Barefoot Bandit
Member
 
Barefoot Bandit's Avatar
 
Join Date: Dec 2016
Location: SYD/SIN/SFO/MNL (long story)
Posts: 269
Default

This is an awesome post. I've not yet started messing with Arduino, how long did it take to get a grip on programming? I've done C+/++, Cobol in my 20's (about 15 years ago now), so not totally clueless with programming, but otherwise, starting form scratch.

I'm ordering the table mounts for just this purpose, though still working out how I'll actually mount them in my simpit (seems easier than designing a whole new mount setup).

Thanks for the head start with the link, BTW...

Z...
Barefoot Bandit is offline   Reply With Quote
Old 04-22-2018, 08:49 AM   #3
mr_mojo97
Senior Member
 
mr_mojo97's Avatar
 
Join Date: Sep 2011
Location: East Ayrshire, Scotland
Posts: 1,152
Default

Is this something you’ll be producing to sell? It looks fantastic and for people like me who have none of your experience and programming skills would be a godsend. Cheers
__________________
MSI M5 z270 | Intel i5 7600k (OC) 4.8GHz | MSI GTX1080ti Gaming X 11Gb | 250gb Samsung 850 Evo SSD | 500gb Samsung 850 Evo SSD (DCS and OS) | 250Gb HDD | 24Gb 2400MHz DDR4 - Crucial Ballistix | Be Quiet Silent Loop 240mm | NZXT H440 case |

Thrustmaster Warthog - 47608 | MFG Crosswinds - 1241 | Westland Lynx collective with Bodnar X board | JetSeat | Oculus Rift CV1 | Windows 10 | VA |
mr_mojo97 is offline   Reply With Quote
Old 04-22-2018, 09:18 AM   #4
Karon
Member
 
Karon's Avatar
 
Join Date: Apr 2009
Location: London - UK
Posts: 511
Default

If you use the sketch made by the guy I've linked (maybe give him a +1 ) you really don't need anything else. Code is C, as you can see here: https://github.com/AM-STUDIO/32-FUNC...TTON_BOXV2.ino

I have written my own version, changed and adjusted pins and other things such as timers: encoders send an input of 50ms by defaul, it's too long if you aim to controls HUD/HMS/ABRIS brightness for instance. 35 or 40 are a better spot, although the more encoders you have, the higher that timer must be.

You don't need any coding skills though and if need any help, just ask


These are two parts you will probably change if you want more or less buttons or encoders:
Code:
byte buttons[NUMROWS][NUMCOLS] = {
  {0,1,2,3,4},
  {5,6,7,8,9},
  {10,11,12,13,14},
  {15,16,17,18,19},
  {20,21,22,23},
};

rotariesdef rotaries[NUMROTARIES] {
  {0,1,24,25,0},
  {2,3,26,27,0},
  {4,5,28,29,0},
  {6,7,30,31,0},
};
The meaning of those values is in the scruct. Encoders for example are defined by:
Code:
struct rotariesdef {
  byte pin1;
  byte pin2;
  int ccwchar;
  int cwchar;
  volatile unsigned char state;
};
So, the first line of the rotariesdef type var rotaries ({0,1,24,25,0}) is:
0 → first pin soldered;
1 → second pin soldered;
24 → the input sent to the PC when turning counter clockwise;
25 → the input sent to the PC when turning clockwise;
0 → it's status, zero by default.

So, you define that array as {0,1,1,2,0}, it will be:
soldere to pin 0 and 1 of Arduino and seen by DCS and the PC as button 1 and 2 of your peripheral.


This is the definition of the button matrix:
Code:
byte rowPins[NUMROWS] = {21,20,19,18,15}; 
byte colPins[NUMCOLS] = {14,16,10,9,8};
just change the values according to what you have soldered.
Exempli gratia, my radio box uses a 3x3 (total 9 buttons). Values are something like (I don't remember atm but it doesn't matter for the sake of this example):
Code:
byte rowPins[NUMROWS] = {21,20,19}; 
byte colPins[NUMCOLS] = {18,15,14};
The flow of the program is very simple: it's a loop that checks the status of the I/O pins of arduino and send a message via USB to the PC if something changes.


Quote:
Originally Posted by mr_mojo97 View Post
Is this something you’ll be producing to sell? It looks fantastic and for people like me who have none of your experience and programming skills would be a godsend. Cheers
No mate, I don't plan to build and sell them (lack of spare time + lazyness ).
I'm happy to help you though, you really don't any need programming skill (see the top part of this reply).
__________________
KEEP CALM AND AUTOROTATE
Virpil T-50 • TM TWCS Throttle • CH Pro Pedals • TIR 4 • TM MFDs • Saitek Quadrant • CH MFP • 2xArduino CB -- waiting for Virpil's Throttle!

132nd Virtual Wing - 696th vSquadron
VCB: ArmA3 British Army Light Infantry platoon
A3/DCS youtube channel: ArmA3 streaming + DCS nonsense
Arduino controls box forum thread
Karon is offline   Reply With Quote
Old 04-22-2018, 10:38 AM   #5
Hansolo
Senior Member
 
Hansolo's Avatar
 
Join Date: Aug 2012
Location: Denmark
Posts: 1,478
Default

That is a very nice post you have made @Karon What is the push button board you have on the right side on the last picture?
And if I understand the setup correctly it will work with momentary switches/push buttons only since there is no diodes, right?

But great and cheap setup to make some stuff for the pit. Great work Sir.

Cheers
Hans
__________________
Hansolo is offline   Reply With Quote
Old 04-22-2018, 11:17 AM   #6
Weedwacker
Member
 
Weedwacker's Avatar
 
Join Date: Mar 2016
Location: USA
Posts: 107
Default

Quote:
Originally Posted by Hansolo View Post
That is a very nice post you have made @Karon What is the push button board you have on the right side on the last picture?

Cheers
Hans
http://www.chproducts.com/Multi-Func...v13-d-724.html

https://www.youtube.com/watch?v=4JXreeig30M-
Weedwacker is offline   Reply With Quote
Old 04-22-2018, 12:01 PM   #7
Karon
Member
 
Karon's Avatar
 
Join Date: Apr 2009
Location: London - UK
Posts: 511
Default

Yep it's an ancient CH MFP.

@Hansolo: I decided to use momentary switches only, it's a more flexible solution for different modules and I have no issues with DCS. You can use non momentary switches though (I haven't tried but I guess you can modify the firmware in order to have them send a signal for a defined period - such as 50ms).

EDIT:
I'll stress it again: my goal was a flexible, cheap solution independent from 3rd party software (such as DCS bios) because I plan to use it in Il2, Star Citizen and every game that can benefit from additional controls.
__________________
KEEP CALM AND AUTOROTATE
Virpil T-50 • TM TWCS Throttle • CH Pro Pedals • TIR 4 • TM MFDs • Saitek Quadrant • CH MFP • 2xArduino CB -- waiting for Virpil's Throttle!

132nd Virtual Wing - 696th vSquadron
VCB: ArmA3 British Army Light Infantry platoon
A3/DCS youtube channel: ArmA3 streaming + DCS nonsense
Arduino controls box forum thread

Last edited by Karon; 04-22-2018 at 12:40 PM.
Karon is offline   Reply With Quote
Old 04-23-2018, 11:29 AM   #8
NahkaSukka
Junior Member
 
NahkaSukka's Avatar
 
Join Date: May 2013
Location: Kuopio, Finland
Posts: 82
Default

Where did you get those boxes or did you make them yourself? I really love the idea of button boxes integrated into desk mount!
NahkaSukka is offline   Reply With Quote
Old 04-23-2018, 07:39 PM   #9
Karon
Member
 
Karon's Avatar
 
Join Date: Apr 2009
Location: London - UK
Posts: 511
Default

I bought those boxes from amazon but you can get them amost anywhere. IIRC the desk mount is ~70mm wide.
__________________
KEEP CALM AND AUTOROTATE
Virpil T-50 • TM TWCS Throttle • CH Pro Pedals • TIR 4 • TM MFDs • Saitek Quadrant • CH MFP • 2xArduino CB -- waiting for Virpil's Throttle!

132nd Virtual Wing - 696th vSquadron
VCB: ArmA3 British Army Light Infantry platoon
A3/DCS youtube channel: ArmA3 streaming + DCS nonsense
Arduino controls box forum thread
Karon is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 05:19 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.