Put simply, my goal is to combine an Xinput (xbox) controller and Optical mouse and have them function as a single device, disguised as the Xinput controller.
The way I'm thinking of doing this is by having both the controller and mouse connect via USB to the microcontroller, then have the microcontroller translate the mouse input into joystick+bumper+trigger input (and additional buttons if any side buttons are present), then export said input to the computer to function as an in-game controller.
Imagine holding the controller in your left hand, thumb on the joystick and finger(s) on the trigger/bumper, with the mouse in your right hand as you normally (or maybe not due to left-handedness) would.
I have an idea of the algorithms needed for this, but I simply need to know if such a thing would be possible with Arduino, and if so what controllers I should start looking at. I'm fairly new to Arduino and my only real experience was a small 'DIY robot kit' I had when I was a kid. Any assistance would be much appreciated.
A simplified diagram is attached to show the general idea of what I'm talking about.
Technically a lot is possible. The question is often how easy it is to implement. My suspicion is that you do not currently have the skills to do this with an Arduino.
You would need to create a USB HOST device. This is NOT done very often in the open source community, because the HOST is usually a device with an application processor running an operating system with virtual addressing e.g. Windows, Linux. These devices have drivers running that few people need to understand. They just work.
Then you need to use that information and create a USB device class that acted as one of the original USB devices with added functions.
What might work is to connect both devices to a computer (PC or Raspberry Pi). Then write a program that would take the input from the drivers and send the information to an Arduino that creates a USB device. There would be an additional delay that may stop you from having fun with this solution.
Why do you want to do this in the first place? You can connect a mouse and a controller to the PC directly.
Technically a lot is possible. The question is often how easy it is to implement. My suspicion is that you do not currently have the skills to do this with an Arduino.
You would need to create a USB HOST device. This is NOT done very often in the open source community, because the HOST is usually a device with an application processor running an operating system with virtual addressing e.g. Windows, Linux. These devices have drivers running that few people need to understand. They just work.
Then you need to use that information and create a USB device class that acted as one of the original USB devices with added functions.
What might work is to connect both devices to a computer (PC or Raspberry Pi). Then write a program that would take the input from the drivers and send the information to an Arduino that creates a USB device. There would be an additional delay that may stop you from having fun with this solution.
Why do you want to do this in the first place? You can connect a mouse and a controller to the PC directly.
Thank you for the explanation, and yes I do quite believe this is out of my skill range, at least for now. As for why I wish to do this, there are a few games that I play that have both mouse and controller support, but you can only use one at a time. My goal with this was to allow me to use the nice fluid movement of the controller while still being able to use the precision of the mouse. Unfortunately, one of my fears with this concept is latency, which may reduce the effectiveness of this solution, but may simultaneously act as a means of balancing its potential advantages it would have if used in a competitive setting. And to clarify, I do not intend to have an upper hand or edge against those in a competitive setting, I wish to simply have the best of both worlds while being able to still play comfortably.
johnerrington:
As the input to the computer is USB why cant you just use a usb hub?
I forgot this was a thing, so I very much appreciate you reminding me this was an option!