Jump to content

an Arduino USB HID controller, composite USB controller


overpro

Recommended Posts

I think I answered my own quesiton going through the posts again. makes sense that a button matrix would be the point to get all the available 256 inputs. But before I spend all that time soldering I am going to work up a fritzing example to make sure I have my head around how to build this matirx correctly using the diagram someone posted in the first few pages. I am not so good at diagrams I am a much more visual person. Again Thanks for everyones responses It is VERY much appreciated.

Link to comment
Share on other sites

Have I got the right Idea on how this works? Especialy with the on-off-on toggle. i figured an on-Off toggle would be similar to a button. just did a kinda 4x4 matrix. since I didnt want to spend time making a 16x16 if I was doing something incorrect.

 

cRg3Hg9.png

Link to comment
Share on other sites

Have I got the right Idea on how this works? Especialy with the on-off-on toggle. i figured an on-Off toggle would be similar to a button. just did a kinda 4x4 matrix. since I didnt want to spend time making a 16x16 if I was doing something incorrect.

 

 

 

cRg3Hg9.png

 

 

 

Hi bacon8tor, not sure about that have not got to the matrix stage yet...

 

Cheers

Glyn

Link to comment
Share on other sites

Hi, Bacon

Glad you mannaged to resolve it! I had the same problem at first: the Mega I bought did not have that pins fo DFU mode, so I had to buy a new (original one) with that feature implemented.

Second thing: the matrix you posted looks right, except the fact that the on-off-on will work better if you plug the row to the 21 to 24 pin (the 4 first lines. blue red yellow and black).Otherwise, the button will stay on all the time. These are for"rotary encoders or similar". Besides thar, I think the rest is OK!

Again, if I can help, feel free to ask.

Saca111

Link to comment
Share on other sites

About the "movement" you said, if you uploaded the sketch to the Arduino with the "axis" option on, you will need to short all the 8 first analog pins (the ones set for the potentiomenters) to ground (in whatever ground pin available). If you don´t plan on using axis, just upload the sketch with the last lines "commented", but with the DFU gate of yours, I would go for connecting all analogs to ground.

What you describe is a"ghost effect", from the analog pins.

Saca111

Link to comment
Share on other sites

after my upload is done I get this, is it normal?

thanks

 

 

F:\Documents\Arduino\ArduinoUSBJoystick-master\arduino\CVP_JoystickController\CVP_JoystickController.ino:16:1: warning: 'typedef' was ignored in this declaration

 

typedef struct joyReport_t {

 

^~~~~~~

 

Sketch uses 3526 bytes (1%) of program storage space. Maximum is 253952 bytes.

Global variables use 492 bytes (6%) of dynamic memory, leaving 7700 bytes for local variables. Maximum is 8192 bytes.

Link to comment
Share on other sites

  • 2 weeks later...

Hi, Aunty.

Actually, I don't remember the messages the arduino IDE gives back after upload, but I don't think it's normal.

Did U changed something in the sketch itself? Looks like a " typo"error. This declaration is in the 3d line of the actual sketch, make sure the "{" has it's according "};" three lines underneath.

Try downloading again the arduino sketch and upload it again.

If not, try a different IDE version, or maybe is a "board uodate" (a function inside the IDE) that has to be done or undone...

Anyway, I will be doing a new joystick next week, so I'll be able to check this out.

Hope it helped.

By.

Saca111

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi everyone! First and foremost thanks to overpro for all the info and software!

 

 

So far I've managed to make the Arduino to work and recognize the button push. I'm a total noob but a friend of mine who knows how to handle electricity will make the matrix for me.

 

I have two questions:

 

1) Does this software support 3way ON-OFF-ON switches and will I be able to use it as 3 possitions? (let's say for example for the 3 possitions in F18 flaps)

 

2) Does this software need potentiometers or rotary digital encoder for the axis? I want to use the rotaries for COM volume and a few more things, and I don't know which is the one I need with this software (currently I have in possession rotary digital encoder, but I don't mind ditching them and getting the needed ones)

 

Thanks!

Link to comment
Share on other sites

Rotary encoders need a lot more coding to get them working sweetly. They are best used (IMO) as controllers for functions allowing increase/decrease level (instrument lighting, volume level) rather than axes. Pots are easier to use and better suited to axes. DCS allows either/both for many functions. I have wired up 5 on-off-on momentary switches in my buttonbox array, so for any control allowing an up or down increment they work fine, eg: FLIR in Hornet, Dispensor switch, flaps, the middle off button will remain passive with momentary switches which DCS prefers as they are more like standard joystick switches.

Link to comment
Share on other sites

We are using them as increase/decrease for COM volume and such, nothing too fancy so no axes are needed, but I don't know if this software allows the use of digital rotary encoder or not.

 

Also, I know that what you said (On-Off-On) using only the two ON states is already taken into account, but I don't know how could I make the software to read that Off state as a button press

 

Something like: If ON1 and ON2 are off, then virtually press button 2.

Link to comment
Share on other sites

Also, I know that what you said (On-Off-On) using only the two ON states is already taken into account, but I don't know how could I make the software to read that Off state as a button press

.

 

You can do this editing DCS LUA files, adding commands for OFF state of switches, see pined topic about in this forum section.

 

Or use a 3rd part keymapper software with "key on press" and "key on release", eg. Joystick Gremlin, JoyToKey...

 

BTW - LYNX CUB firmware for (some) Arduino already have this function in the code - send a momentary press in ON and in OFF state of toggle switches, hence don't need additional software, see relatives topics.

Link to comment
Share on other sites

We are using them as increase/decrease for COM volume and such, nothing too fancy so no axes are needed, but I don't know if this software allows the use of digital rotary encoder or not.

I have 4 rotary encoders now working really nicely, in a matrix wiring button board, using code adapted from a race sim button box build.

It all works fine in DCS - 32 buttons, 4 rotaries, but I had to edit the code to work with my Teensy 2.0 board. I'll share the code used if its any use to you, its the only code I managed to give good stable rotary encoder results with.

Link to comment
Share on other sites

You can do this editing DCS LUA files, adding commands for OFF state of switches, see pined topic about in this forum section.

 

Or use a 3rd part keymapper software with "key on press" and "key on release", eg. Joystick Gremlin, JoyToKey...

 

BTW - LYNX CUB firmware for (some) Arduino already have this function in the code - send a momentary press in ON and in OFF state of toggle switches, hence don't need additional software, see relatives topics.

 

THanks for the great answer!

 

I'm afraid that I can't find that pinned post of editing DCS LUA files, I see DCS-BIOS, Helios, etc but nothing about it. I'm interested in that approach so if you don't mind, would you point me in the right direction?

 

I kind of think software was capable of flanking actions editing some lines (I'll check it later tonight) but if neither LUA editing or software editing becomes fruitfull, now I know that Joystick Gremlin or JoyToKey might do the trick!

 

LUNX CUB as far as I could find is not suited for my needs, as it's only prepared for few switches and no rotaries (I have a total of 14 3 position switches, 2 buttons and 5 rotary encoders) but I'll check the .ino to see if there's something I can use from it

 

 

I have 4 rotary encoders now working really nicely, in a matrix wiring button board, using code adapted from a race sim button box build.

It all works fine in DCS - 32 buttons, 4 rotaries, but I had to edit the code to work with my Teensy 2.0 board. I'll share the code used if its any use to you, its the only code I managed to give good stable rotary encoder results with.

 

Thans for the offering!! It might be one solution to just scrap the Mega board and go with another one as long as it's with is no larger than mega one or I'll just have to re-design everything.

 

My needs are:

- 14 Switches (so equivalent to 28 buttons there)

- 2 Buttons

- 5 Rotary digital encoders with push function (so a total of 15 buttons I guess?)

 

That means I need a total of 45 connections for all my needs I guess? My friend is the one who knows how the electricity and electronic part works but he's been too busy last week with work for us to speak about this little proyect of ours, that's why we went with Mega board... but maybe I'm missing something out and I can use either the same Teensy board as you or other option.

 

If you think that your board and with that firmware/software is what I need, I would be really grateful for your help! :)

Link to comment
Share on other sites

My bad-the info to edit is not dcs lua but in E:\Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\Ka-50\Input\ka-50\joystick\default.lua file.

(Obv. example for KA-50 module)

The Teensy board (and Micro Pro) are tiny, 35 x 18mm so should give you no issues with limited space. The coding works using a button matrix, so if you want 32 switches you dont need 32 separate wires and one ground, you arrange the switches in rows and columns like a keyboard is wired, 6 columns and 5 rows gives you 30 buttons and you only need a wire for each row and each column; 6 + 5 = 11. The youtube build video explains it really well.

Link to comment
Share on other sites

Hi again Deliverator.

I made a fast schematic on how I vould connect the gear you want.

Take not that I haven't put all the switches nor the rotarys, I made an example on how they should go...

Also:

* I suggest you connect all the "columns" via a diode (1N4148), with the negative( the side with the strip) pointing towards the button, not the board. 1 Diode per button. Consider the extrem connections of the switches/rotarys a button.

* Set as much "Rows" an "column" buttons in serial as you can, so you will save a lot on wiring, and that's is a good advice, believe me!

* In the example, I only connected the bare minimum for your needs. For more connections, simply follow the logic of the circuit. If you don't see the logic, just tell me and Il be glad to help.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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