overpro Posted November 25, 2013 Posted November 25, 2013 (edited) This is an arduino Mega2560R3 based USB joystick controller, I have successfully made it as a composite USB device , that means one arduino = two usb joystick controller, the reason to do this is DCSW only recognize 128 keys per USB joystick controller. If we have 2 then there will be 256 keys program your Mega2560 download Arduino IDE from arduino.cc and download the arduino sketch from here: https://github.com/calltherain/ArduinoUSBJoystick/tree/master/arduinoopen the .ino file in Arduino IDE and upload it to your mega2560. program the USB firmware The 2nd step is to program the USB firmware, you need to use Atmel Flip: http://www.atmel.com/tools/FLIP.aspx Download and install flip, you need to make your Mega2560 enter DFU mode: with your mega2560 plugged, just simply shortcut the 2 pins momentarily at here: Windows will recognize it as a new device, and you need to manually install the driver by using this file: C:\Program Files (x86)\Atmel\Flip 3.4.7\usb\atmel_usb_dfu.inf After the driver is installed, run Flip and select the chip type: ATmega16u2 then Open the USB port ( ctrl + u, click OPEN ) and load the usb controller firmware, see attached cvpJoystick YYYY-MMM-DD.zip file. ====1HID with 256 buttons is also available==== If you want a single joystick with 256 buttons please use this firmware instead. http://forums.eagle.ru/showpost.php?p=2522938&postcount=142 But note that most of the Flight sims doesn't support such a joystick. FSUIPC is the only one which has been confirmed works good for now. ---------------------------------------------------------------- Click "RUN" button at the lower left corner and it only takes 1 second to program the chip. Unplug and replug your mega2560 and you are good to go. If you want to make it back to a normal Mega2560 then repeat the above step but load the original mega2560 USBSerial firmware from here: https://github.com/arduino/Arduino/tree/master/hardware/arduino/firmwares/atmegaxxu2/arduino-usbserial Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex 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 ..... ) Known Issue The firmware might have some issue and if you encounter any problem please provide your comments on github or at this thread. github.com/calltherain/ArduinoUSBJoystick http://forums.eagle.ru/showpost.php?p=1934885&postcount=5 If you want to build the firmware by yourself you need a Linux machine. License The code is released to Public Domain Source Code https://github.com/calltherain/ArduinoUSBJoystick I hope you enjoy it. ps. this firmware is inspired by Darran's project: Arduino UNO Big joystick HID firmware: http://hunt.net.nz/users/darran/weblog/15f92/ with out Darran's code I will never make this work. Thanks Darran. --------------------------------- Firmware compilation instruction --------------------------------- This is a simple instruction to guide you compile the firmware in ubuntu. 1. Make sure you have these packages installed on Ubuntu build-essential avr-libc c-compiler make you can use this command to install these packages: sudo apt-get install avr-libc c-compiler make build-essential 2. download the firmware source code from github cd ~ git clone https://github.com/calltherain/ArduinoUSBJoystick.git 3. download LUFA library cd ~/ArduinoUSBJoystick wget https://lufa-lib.googlecode.com/files/LUFA-130901.zip unzip LUFA-130901.zip -d LUFA 4. by the end of step 3, you should get a folder structure like this: now go to /ArduinoUSBJoystick/firmware/cvpJoystickTest/ and execute make the compiled binary is cvpJoystick.hex, you can use FLIP to flash it into your Mega2560's atmega16u2 chip under it's DFU mode. --------------------------------------------- Flash the original firmware to your Atmega16u2 --------------------------------------------- If you are unable to go to DFU mode it's possible that the firmware within your Atmega16u2 doesn't have a proper bootloader code within bootloader section in the flash. You will need an USB ISP programmer to flash a correct firmware. I attached a working version firmware (atmega16u2.zip) which includes a proper bootloader here just incase you can't find one. connect your USB ISP programmer to the atmega16u2 ISP pins, you might need some Dupont Line to do this. There are many ISP programmer software available out there, I personally use Progisp.exe, downlod atmega16u2.zip and extract it to .hex file, load it into progisp.exe and flash it, all done.cvpJoystick 2013-Nov-29.zipatmega16u2.zip Edited November 2, 2015 by overpro title change 1 overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
Hansolo Posted November 25, 2013 Posted November 25, 2013 Oustanding job Overpro :thumbup: Thanks for sharing Cheers Hans 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album
don_sangria Posted November 25, 2013 Posted November 25, 2013 Outstanding work! thank you very much for sharing! Looking forward to see your setup and any further progress on your project! Best Regards Adrian
agrasyuk Posted November 25, 2013 Posted November 25, 2013 Looks good. Thanks for sharing! Anton. My pit build thread . Simple and cheap UFC project
overpro Posted November 26, 2013 Author Posted November 26, 2013 (edited) Known issue: Issue#1 ( Fixed ): after several hours, the button ID might drift to a new position, for example, the button 1 press might be changed to button 57 press. I'm still investigating the issue, it might be caused by the RingBuffer manipulation in the USB firmware. update: if Computer sleep (STR) and resume, the button id will drift. update: Submitted a fix on github and updated the compiled .hex file in the main post. Issue#2 (Fixed on 2013-Nov-29 ) With the controller attached, the computer will be blocked at POST, unless unplug it then computer will continue to boot: The fix: The HID report will send to host only if the button status changed or the defined idle time has elapsed. Issue #3 (Fixed on 2013-Nov-28 ) The Row8 ( digital pin 29) key scan code has an issue. It's a bug in arduino sketch. https://github.com/calltherain/ArduinoUSBJoystick/blob/e091929ceb7bc5b7a2c39cb4fb719003b74b1e05/arduino/CVP_JoystickController/CVP_JoystickController.ino Now fixed. Edited November 28, 2013 by overpro overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
overpro Posted November 26, 2013 Author Posted November 26, 2013 (edited) If you have programmed your MEGA2560 yesterday please flash the USB firmware back to normal MEGA2560 and reprogram the arduino sketch by downloading the sketch from github page. And use the latest USB firmware in the top post. Some error were fixed. Edited November 29, 2013 by overpro overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
Hobnob Posted November 26, 2013 Posted November 26, 2013 This looks great and just what i was looking for, im trying to make the two MFCD's for the warthog, although i dont quite understand how i would wire this up, could you maeby post a picture or explain the physical connection of the buttons to the board? :) also can it support the 48 buttons needed for 2 mfcds?
overpro Posted November 27, 2013 Author Posted November 27, 2013 This looks great and just what i was looking for, im trying to make the two MFCD's for the warthog, although i dont quite understand how i would wire this up, could you maeby post a picture or explain the physical connection of the buttons to the board? :) also can it support the 48 buttons needed for 2 mfcds? This diagram is borrowed from MJoy16 document, the schema is almost identical, except we have 16 rows and 16 columns, and Row 1~4 are reserved for rotary encoders. Please note that the diode is 1N4148, and this is REQUIRED to eliminate the ghost effect. If you just want to perform some basic test, just wire the button's two pin to row / column pin: Please note the row 5 ~ 16 should be used for button / toggle switch. or you can test your rotary encoder as well, please note Row 1~4 are used for rotary encoder. 1 overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
Quip Posted November 27, 2013 Posted November 27, 2013 How can you have more than 32 buttons per DirectX controller??
Hansolo Posted November 27, 2013 Posted November 27, 2013 (edited) Brydling is giving an explaining it in this post/thread: http://forums.eagle.ru/showpost.php?p=1922754&postcount=14 Cheers Hans Edited November 27, 2013 by Hansolo Wrong post 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album
usul Posted November 27, 2013 Posted November 27, 2013 Nice work What is your encoder? With FLIP, I can't load the cvpArduinotest-131126. i7 12700F - Gigabyte Z690 UD - RTX 4070 - 64Go RAM DDR4 - WINWING F16EX - VPC MongoosT-50CM3 - Pro Flight Switch Panel - Pro Flight Radio Panel - Pro Flight Multi Panel - TQ6+ - 4 x FIP - Thrustmaster TPR - TrackIR 5 - 3x Winwing MFD with 3 displays HDMI 8" - VPC Controle Panel - VPC Rotor TCS Plus Base -VPC Hawk 60 Collective Grip - StreamDeck - Ecran 34" curved"
overpro Posted November 28, 2013 Author Posted November 28, 2013 Nice work What is your encoder? With FLIP, I can't load the cvpArduinotest-131126. Hi usul, you need to extract cvpArduinotest-131126.zip, and use flip to load the extracted file: cvpArduinotest.hex, Flip will report "HEX file parsed". overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
usul Posted November 28, 2013 Posted November 28, 2013 Hi overpro and thank you I try it but Flip send me this message : cannot open file Other thing : im looking for encoders as yours. where do i find them? i7 12700F - Gigabyte Z690 UD - RTX 4070 - 64Go RAM DDR4 - WINWING F16EX - VPC MongoosT-50CM3 - Pro Flight Switch Panel - Pro Flight Radio Panel - Pro Flight Multi Panel - TQ6+ - 4 x FIP - Thrustmaster TPR - TrackIR 5 - 3x Winwing MFD with 3 displays HDMI 8" - VPC Controle Panel - VPC Rotor TCS Plus Base -VPC Hawk 60 Collective Grip - StreamDeck - Ecran 34" curved"
overpro Posted November 28, 2013 Author Posted November 28, 2013 Hi overpro and thank you I try it but Flip send me this message : cannot open file Other thing : im looking for encoders as yours. where do i find them? Well, this is weird, I haven't had this issue before. Are you using Flip 3.4.7 build 112? Regarding the rotary encoder, it's just the normal type: 20 pulse per round, like this: http://www.ebay.com/itm/20pcs-lot-12mm-Rotary-Encoder-Switch-W-Keyswitch-HQ-New-free-shipping-/261299009115?pt=LH_DefaultDomain_2&hash=item3cd6a2765b overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
usul Posted November 28, 2013 Posted November 28, 2013 (edited) Yes, i'm using flip 3.4.7 build 112. I don't understand either I'm going to try with another computer. Thank you for the link Edited November 28, 2013 by usul i7 12700F - Gigabyte Z690 UD - RTX 4070 - 64Go RAM DDR4 - WINWING F16EX - VPC MongoosT-50CM3 - Pro Flight Switch Panel - Pro Flight Radio Panel - Pro Flight Multi Panel - TQ6+ - 4 x FIP - Thrustmaster TPR - TrackIR 5 - 3x Winwing MFD with 3 displays HDMI 8" - VPC Controle Panel - VPC Rotor TCS Plus Base -VPC Hawk 60 Collective Grip - StreamDeck - Ecran 34" curved"
usul Posted November 30, 2013 Posted November 30, 2013 Hi overpro With your new file, it is working very well! Thank you very much i7 12700F - Gigabyte Z690 UD - RTX 4070 - 64Go RAM DDR4 - WINWING F16EX - VPC MongoosT-50CM3 - Pro Flight Switch Panel - Pro Flight Radio Panel - Pro Flight Multi Panel - TQ6+ - 4 x FIP - Thrustmaster TPR - TrackIR 5 - 3x Winwing MFD with 3 displays HDMI 8" - VPC Controle Panel - VPC Rotor TCS Plus Base -VPC Hawk 60 Collective Grip - StreamDeck - Ecran 34" curved"
overpro Posted November 30, 2013 Author Posted November 30, 2013 Hi overpro With your new file, it is working very well! Thank you very much Good to know :) overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
Trueno Posted December 2, 2013 Posted December 2, 2013 Thanks for share this but i can´t convert my MEGA 2560 into DFU mode, I touch both pins but this back to the normality
overpro Posted December 3, 2013 Author Posted December 3, 2013 Thanks for share this but i can´t convert my MEGA 2560 into DFU mode, I touch both pins but this back to the normality Hi Trueno, here is a detailed instruction from Arduino.cc website: http://arduino.cc/en/Hacking/DFUProgramming8U2 You might want to check this first. overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
Trueno Posted December 4, 2013 Posted December 4, 2013 Thank you over!!!!! I will post some of my ideas later Thanks again
sifhanar Posted January 17, 2014 Posted January 17, 2014 Thanks for the info in this thread. I am new to the simpit building and would like to follow this route to build my first panel. I am Ok with the software side of things but ignorant with the hardware side. How would I wire switches to the arduino? If someone could point me in the right direction I would be obliged. Examples of how to wire a switch or a button in simple terms would be great. Thanks.
overpro Posted January 18, 2014 Author Posted January 18, 2014 Thanks for the info in this thread. I am new to the simpit building and would like to follow this route to build my first panel. I am Ok with the software side of things but ignorant with the hardware side. How would I wire switches to the arduino? If someone could point me in the right direction I would be obliged. Examples of how to wire a switch or a button in simple terms would be great. Thanks. Hi Sifhanar Please have a look at the message at 8th floor : http://forums.eagle.ru/showpost.php?p=1935590&postcount=8 1 overpro = I'm not good at Nintendo Mario and always get "Game over" pretty fast, so over~~pro
don_sangria Posted January 18, 2014 Posted January 18, 2014 Hey overpro! Thank you very much for your nice instruction! its a really amazing solution and pushed me to continue on my simpit! Is there also a possibility to connect analog inputs, as potentiometers? Best Regards Adrian
sifhanar Posted January 18, 2014 Posted January 18, 2014 Hi overpro, thanks for your reply. I did look at the diagram but unfortunately my knowledge of electronics is severely limited. I was hoping someone could point me in the direction of an idiots guide on how to connect to the device. The only electronics construction I have done is to build kits that have instructions showing me where to place components on a board! Thanks
Recommended Posts