Jump to content

an Arduino USB HID controller, composite USB controller


overpro

Recommended Posts

Overpro, maybe my setup isn't working correctly. With a wire connected from Pin 30 to Pin 38 (with the Diode and switch in place on breadboard) i get the Button 1 light on the CVP Joystick #2, i can move the Row wire (#38 all the way down to Pin 53 and get to Button 16 on the display. I move the wire from Pin 30 to Pin 31 and repeat with wire from Pin 38 to Pin 53 and i get Button 17 to Button 32...but that's it. I get no response from the rest of the column pins to activate the Button lights on the CVP Joystick #1 (the one showing the Axis sliders). I have GOT to be doing something wrong...

 

Hi azreark1, are you using the Microsoft Windows joystick configurator to check the button status? It can only shows first 32 buttons of the joystick, you can check the button in DCSW or Xplane or SVMapper(http://forum.sukhoi.ru/attachment.php?attachmentid=70479&d=1173468799)

overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro

Link to comment
Share on other sites

I copied this article for the new Wiki.

Overpro...hopefully you can make changes and update it as appropriate.

http://deadfrogstudios.com/warthogpit/index.php?title=Turning_a_single_Arduino_Mega_into_2_USB_Joystick_Controllers

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Thanks for the reply Overpro, I'll give that a go. Not sure of the specs, I'll take apart the panel and see if I can make anything of it.

 

cheers

 

Peter

 

Hi Overpro

 

The updated code definitely helps, it improves both my troublesome encoder as well as smoothed out the ones that were working ok.

 

The troublesome encoder is Model 288T232R161A2 (http://www.leobodnar.com/shop/index.php?main_page=product_info&cPath=75&products_id=191)

 

There was still some quirks with it, even after the code update, so I'd got brake and removed them from the prebuilt panel, so no urgency at all to fix, as I've now got an operational panel using smaller encoders.

 

Thanks again for your work on this, its awesome.

 

Cheers

 

Peter

Link to comment
Share on other sites

  • 1 month later...

Hi OverPro

 

Is there an possibility of a firmware version that reports more joysticks with only 32 buttons. Just discovered FSX only reads the first 32 buttons of a stick.

 

Update 16 June - hold that thought, just discovered Linda which looks to provide a way of getting FSUIPC to recognise buttons above 32.

 

Cheers

 

Peter


Edited by bnepethomas
Link to comment
Share on other sites

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

Some WAY noob questions so please be patient. Right now I'm using a Brydling board so my limitations are that I can't hook any encoders, indicators, or segmented LCDs to it. I have 0 (ZERO) programming experience but from what I've read here on the forums, all of these functions can be programmed into a MEGA board or two. I am very good at performing instruction to task type of work so should I just buy a couple of Arduinos and jump in? All of my panels are built using Reactorone's templates and I have 5 of them wired up with diodes. Do I really need to know how to program or can I just follow the instructions here and end up with a working cockpit?

John


Edited by Thick8

Asus ROG C6H | AMD Ryzen 3600 @ 4.2Ghz | Gigabyte Aorus Waterforce WB 1080ti | 32Gb Crucial DDR4/3600 | 2Tb Intel NVMe drive | Samsung Odyssey+ VR | Thrustmaster Warthog | Saitek pedals | Custom geothermal cooling loop with a homemade 40' copper heat exchanger 35' in the ground

Link to comment
Share on other sites

  • 2 weeks later...

No answer? prying minds and all...

Asus ROG C6H | AMD Ryzen 3600 @ 4.2Ghz | Gigabyte Aorus Waterforce WB 1080ti | 32Gb Crucial DDR4/3600 | 2Tb Intel NVMe drive | Samsung Odyssey+ VR | Thrustmaster Warthog | Saitek pedals | Custom geothermal cooling loop with a homemade 40' copper heat exchanger 35' in the ground

Link to comment
Share on other sites

  • 1 month later...
I have followed this tutorial on flashing my Arduino R3 to turn it into a "USB Joy", but the article doesn't explain how the hex works, it's just for granted.

 

The .HEX is the "firmware" that turn the Arduino into "USB joystick controller".

 

If the .HEX write succeeded, then unplug the USB cable (and programmer cable if used) and plug again with only USB cable.

 

The Windows should detect and install the new device using his native HID drivers, and in Control Panel > Games Controllers (joy.cpl) the new "joystick" will be shown.

 

You can make your won .HEX, writing the code and after copile then in .HEX format.

 

Sokol1

Link to comment
Share on other sites

@ thick8,

that is exactly what i am doing, I am in the same boat as you and I just got a couple of arduino boards and a led matrix board and now I am trying to work out how to get dcs to talk to arduino and vice versa. sometimes frustrating sometimes not but fun anyhow.

AMD A8-5600K @ 4GHz, Radeon 7970 6Gig, 16 Gig Ram, Win 10 , 250 gig SSD, 40" Screen + 22 inch below, Track Ir, TMWH, Saitek combat pedals & a loose nut behind the stick :thumbup:

Link to comment
Share on other sites

  • 3 weeks later...
Thanks for the reply Overpro, I'll give that a go. Not sure of the specs, I'll take apart the panel and see if I can make anything of it.

 

cheers

 

Peter

Hi Overpro

 

Bit of an update to the 'missing' pulse with Rotary encoders. I'm pretty sure the problem is to do with the length of the pulse sent from the Arduino with a rotary. As it is only as for a short cycle (ie the transition of the rotary encoder), the code only sends a pulse for one loop of the code. When I checked out the Pete Bodnar joystick interface, he has options for the length of the pulse send to windows. I found the game caught more of the turns after winding out the timer on the Pete Bodnar card.

 

Cheers

 

Peter

Link to comment
Share on other sites

Hi Overpro

 

Bit of an update to the 'missing' pulse with Rotary encoders. I'm pretty sure the problem is to do with the length of the pulse sent from the Arduino with a rotary. As it is only as for a short cycle (ie the transition of the rotary encoder), the code only sends a pulse for one loop of the code. When I checked out the Pete Bodnar joystick interface, he has options for the length of the pulse send to windows. I found the game caught more of the turns after winding out the timer on the Pete Bodnar card.

 

Cheers

 

Peter

Hi Peter,

 

Thanks for the information,

 

Regarding the pulse send to windows, actually the encoder's pulse is not send to Windows directly, instead, arduino main chip - ATMEGA2560 will try the best to capture the pulse from encoder and do some sanitization to judge a CW /CCW rotate, once a valid CW / CCW rotate is recognized the arduino board will send the USB report to Windows, so the pulse length has nothing to do with the USB report, I believe the code still missed some pulses generated from encoder.

 

Anyway, let me have some try to see if I can make some improvements on this. I will PM you with my updated code.

overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro

Link to comment
Share on other sites

Hi Peter,

 

Thanks for the information,

 

Regarding the pulse send to windows, actually the encoder's pulse is not send to Windows directly, instead, arduino main chip - ATMEGA2560 will try the best to capture the pulse from encoder and do some sanitization to judge a CW /CCW rotate, once a valid CW / CCW rotate is recognized the arduino board will send the USB report to Windows, so the pulse length has nothing to do with the USB report, I believe the code still missed some pulses generated from encoder.

 

Anyway, let me have some try to see if I can make some improvements on this. I will PM you with my updated code.

Thanks Overpro, if you want to test something, try have the code 'hold' the button down for 80mS or so, the games seem to better recognise that as opposed to a short button 'press'.

 

Cheers

Peter

Link to comment
Share on other sites

Thanks Overpro, if you want to test something, try have the code 'hold' the button down for 80mS or so, the games seem to better recognise that as opposed to a short button 'press'.

 

Cheers

Peter

 

Hi Peter, many thanks for your effort on testing this, I think I have understand the point and uploaded the code to github,

The arduino code was changed, no firmware change for ATMega16u2.

please have a try when you are free.

 

https://github.com/calltherain/ArduinoUSBJoystick/commit/0f7146c27b83f465fafaaf6b1d35ad45ab0cb2b1

overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro

Link to comment
Share on other sites

  • 4 weeks later...
Hello freinds.

 

I can't connect cable to pin. buttons are inactive. how to do connect cable. May you help me please?

 

Use a soldering iron? Sorry, but without more information about your specific setup and your background in electronics your question is almost impossible to answer.

 

Your question sounds a bit like "I can't turn the key in the ignition. My car won't start. How do I turn the key?" and we don't know whether you have lost the key, can't find the keyhole at all, can put the key in the ignition but it's stuck so it does not turn, or maybe your car does not have an ignition key at all and uses a start code instead...

 

If you tell people what steps you tried and in what ways they failed (what did you expect, what happened instead) and then ask a specific question, you are much more likely to receive an answer.


Edited by [FSF]Ian
Link to comment
Share on other sites

Read first and #8 posts where all is explained.

Pin config on Mega2560

Pin 22~37 are row pins and 38~53 are column pins, you might need to build a keyboard matrix by your self, Row 0~3( pin 22,23,24,25) is reserved for rotary encoder, you need to wire the common pin of the rotary encoder to mega2560 22~25, and wire the A, B pin on the encoder to 0,1 or 2,3 or 4,5 ..... column pins ( mega2560 38,39 or 40,41 ..... )

You need to wire, for example, pin 26 to pin 38 to use a push button, and you don't need resistors but an 1n4148 Diode to avoid ghosting problems.
Link to comment
Share on other sites

Read first and #8 posts where all is explained.

You need to wire, for example, pin 26 to pin 38 to use a push button, and you don't need resistors but an 1n4148 Diode to avoid ghosting problems.

 

 

Hi icemaker

 

 

 

I have followed your writings,

 

i had connect pin 30 to pin 38 and light buton 1 on cvp joy#2 >> everything is normal

 

but,

 

i had connect pin 22 to pin 38 on cvp joy#1 light button 1 and 2. and x / y axis distorted.

 

is this a problem? or i need use rotary encoder for cvp joy#1?

 

attachment.php?attachmentid=106828&stc=1&d=1415226655

 

another problem is,

 

x - y axis dont work . i had connect like this pict. but dont work

 

AnalogReadSerial_BB.png

1.jpg.6a73fd1b0dadda2dba8e56339a84ae30.jpg

Link to comment
Share on other sites

  • 4 weeks later...

Will this work with an Arduino Uno R3 ?

( with less inputs, obviously )

---------------------------------------------------------

PC specs:- Intel 386DX, 2mb memory, onboard graphics, 14" 640x480 monitor

Modules owned:- Bachem Natter, Cessna 150, Project Pluto, Sopwith Snipe

Link to comment
Share on other sites

  • Recently Browsing   0 members

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