Emulating a specific USB device

Hi,
I am looking to emulate a specific USB device using an Arduino Uno (with 16u2).
The device I am looking to emulate is the ETC progamming wing (a user interface for controlling a theatrical lighting software), and I am looking to be able to use an Arduino to emulate the rotary encoders on this device. I have found that Amy Worrall has done a similar project using a Teensy and posted about the process on youtube and her github.

The part I am struggling with is making the Arduino (specifically the 16u2 chip) appear in windows as the programming wing. Amy did this by creating new USB device descriptors for her Teensy, but I haven’t found a way to replicate this for the 16u2.
I have been looking at LUFA as that seems to be the simplest way to go about this, but i’ve not made much progress.

I was thinking that I would be able to replace the firmware on the 16u2 to make it appear as the programming wing in windows. I would then use the 328p on the arduino to send serial messages via the 16u2 to my PC to emulate the USB messages sent by the real programming wing.

Is what I am attempting possible, or should I just buy a teensy and use Amy’s code?

Depends. Teensy has native usb device class drivers but I don’t know the ETC device what class it is under, do you know? HID keyboard? HID custom? Other? So if it’s a custom HID class device, then all the Teensy HID device drivers are pretty much useless, except as templates for your own driver. If you’ve looked at LUFA and didn’t faint at its scale of code, you’re either a pretty good programmer or oblivious of its massive scale or both.

I took a look at Amy’s repo. She defined an HID boot keyboard class for emulating the ETC, with a rather standard HID report descriptor. I think if I were to do this myself, transplanting the code from teensy to UNO (I’d rather use Leo or Micro), it would take me several days of hard work. I would recommend a Leo because you get the more powerful MCU and easy connection to it. Use your UNO to program the leo. It’s perfect. I’m not too familiar with teensy’s USB device stack so I would have to first understand how Amy emulated the thing before I can start doing the same on Leo.

If you want something quick you should get a teensy.

If this is a potentially commercial project, try it like it’s for your own learning until you can’t move forward anymore, even with forum help and find professional help. I’m one of those who have some years developing USB host and class stacks. I can provide some free pointers to you on the forum.

If this project is entirely for your own learning and you don’t care how much time you spend, you should first familiarize yourself with USB descriptors, then some transfers and packets, while you dissect Amy’s code. Then you can transplant the idea to leo. My recommendation is to go with Arduino IDE 1.6.5-r5 where usb is simple and gut everything else until you’re happy. Been there and done that. It’s a lot of work and learning. Once you can fully understand the bold line in my reply, you’re really in a good spot to make the transplantation.

Some reference to get you started:
https://www.beyondlogic.org/usbnutshell/usb1.shtml

1 Like

Hi,
Thanks for your reply,
I am not a particularly good programmer so I am definitely underestimating the scale of LUFA, my only experience with it so far has been modifying the mocoLUFA library to show a custom name.
I was hoping that there might just be some library or example somewhere where I could copy across the values from Amys repo to suit my needs, but it appears that there isn’t.
I only mentioed the uno, as I would be able to make a custom PCB with the 16u2 chip on it, and then ideally use any other MCU, perhaps even a few in paralel, as I am hoping to end up with a lot of keys/faders/encoders, which wouldn’t all fit in the IO of an uno, but perhaps a mega.

It looks like I would just be better off with a teensy, i’ll keep trying to find a way to make it work on an uno for now though.

Also, I’m not planning on making this project commercially available, it’s just for my own use.

Then I think teensy is the way to go. Do with Teensy 4.1 so you have a lot of pins to start with already. Then you could use a MEGA2560 if you want, but make sure you have a logic level shifter so the 3.3V Teensy can talk with the 5V MEGA2560.