Lately I've been fooling around with a project for my Microsoft Sidewinder Force Feedback Pro Joystick. I've found out that there is a project currently for it built for the Teensy 2.0. On the page for the Teensy 2.0 there is a link for an Arduino Library for the very same project that was (I guess) converted. There isn't much documentation for it, and I don't think there is much progress being made on it anymore. However when I grab the files and try to upload it to my Arduino Uno it spits out an Unsupported device. Doing some digging around I found where it shows what devices are supported in the includes.h.. Which happen to be

#if defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__)
 #define __AVR_AT90USBX2__
#elif defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
 #define __AVR_ATmegaXU4__
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
 #define __AVR_AT90USBX6__
 #error "Unsupported device"

Which ends up being the red arduino, arduino micro, arduino leonardo, and I think a few teensys.

What I want to know is if you can upload this code onto a UNO. I'm not really wanting to purchase a teensy just to check if this will work or not.

  • 1
    You can try removing the #error line and see what happens.
    – BrettAM
    Mar 19 '15 at 23:35
  • No that won't work
    – zmo
    Mar 20 '15 at 23:24
  • @BrettAM Actually that was the first thing I tried lol. Its trying to verify what Arduino I am uploading to. Which if I change the board in the arduino software it will compile and attempt to upload. However will ultimately fail. Mar 23 '15 at 1:49

The code won't work as a traditional project when uploaded on an Uno, because the Uno does not talk directly to the Host, it only speaks UART.

But good news is that the Uno uses another atmega chip, an Atmega8u2 on the older models or Atmega16u2 on the others. That IC handles directly the USB connection with the host on behalf of the Atmega328. And that code below is actually (close enough) support for that IC:

#elif defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
 #define __AVR_ATmegaXU4__

That means you should be able to upload the code (or a similar one) on that 'frontend' IC, so it acts as a HID device, and connects to the main 328 for any I/O you might need.

To do the upload on that other chip, you can use an ISP programmer on the 6pins header close to USB, or you can use the DFU programmation mode over USB.

I'm sorry for not giving external references or code, but I'm answering from my phone!

Edit: after a short browse over the code, it's definitely possible to implement that using an uno, but you'll need to split the code between the two chips: the USB interface to behave like ah HID device and the main I/O chip to talk midi, and implement comms between both.

Edit #2:

Here's a few resources that might help to work out USB and Midi using Arduino, but it looks like none is a cooked in USB on atmegaXu2 to Midi on atmega328:

And if you're not at ease with AVR development, it's gonna be HARD. You'd better get a teensy2 or a leonardo where that code should compile and work with little effort.


  • It's actually a '16U2, not a 4. Mar 21 '15 at 1:09
  • I have no problem with working with DFU as I have played around with UnoJoy before (like I said to someone elses post I tried converting the signal coming out of my RC Receiver to something I can use over UnoJoy, but was having issues with that) However I'm not nearly skilled enough to go through the entire code to split everything up and recode as needed. I might just have to go ahead and get the teensy2. Mar 23 '15 at 1:53
  • That's a sensible choice, you might otherwise take a leonardo (based on the atmega32u4) that should be compatible (maybe with very minor changes, like for the pins) with the code.
    – zmo
    Mar 24 '15 at 13:20

That program will make the arduino board act like a keyboard to the PC it's plugged in. This can't be done on the Uno, since it doesn't have USB support.

  • 1
    It actually can, given you change the atmega16u2 firmware for one that makes it behave like a keyboard.
    – zmo
    Mar 20 '15 at 23:22
  • @zmo you are correct. It's however quit involved, so I chose not to mention it.
    – Gerben
    Mar 21 '15 at 16:37
  • @Gerben Its not that involved, as I've played around with UnoJoy which makes everything quite simple. I tried messing around with it to convert PWM from my RC Receiver so I can use it in games, but that's a whole other issue I'm having. Mar 23 '15 at 1:48

Generally, the differences between the different chips are mostly: amount of memory (sram, eeprom), number of pins (analog, digital, pwm), numbering of pins, and hardware support for protocols (serial, SPI, 2 wire etc)

In this case, you would have to go through the code wherever you find #IFDEF __AVR_AT90USBX2__ or #IFNDEF __AVR_AT90USBX2__ and the others - you would need to work out what it is doing differently for each, and work out how you would do the same thing on the Arduino Uno (which runs on an Atmega328).

  • I believe it defines what each pin is, what they do, and how they will be bound to the device. Which I would have to go through everything for the Uno's chips. Mar 23 '15 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.