Combine two USB HID devices into one

Discussion in 'Embedded Systems and Microcontrollers' started by Wrath, Jun 26, 2010.

  1. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Hi I would love some help with a project I came up with

    I been doing some research for the past few days trying to work out a way of combining the data from two HID devices into one eg. a gamepad and a mouse or two joysticks etc. so it appears as its one device.
    I want to be able to configure and remap the buttons/axis relitively easily. I was thinking this would be done via a 'man in the middle' setup, like a USB dongle that would have 2 USB inputs for devices and a USB output to plug into a computer or console. for ease of use it should be powered by the USB VCC and be programable via pluggin it into the USB port of a PC.

    Is it possible to merge the data from two sources together and relay it to a PC/Console with a single HID discriptor? what hardware is needed?

    My electronics knowledge is somewhat limited as this will be my first foray into microcontrollers but I am eager to learn and any info will be appreciated.

    Thanks
     
  2. sceadwian

    New Member

    Jun 1, 2009
    499
    37
    There's no need to do this, HID devices have to be configured by software, and there's no reason the software can't use two devices so there's no need for a man in the middle, simply map whatever you want your software to use from the devices attached to the system. If you hunt around the net long enough I'm sure you can find HID mapping software as well in case you want to adapt this to existing software.

    This isn't a project to get your feet wet with, working with USB is not a walk in the park, especially if in your case you think you want to implement both host and device controllers. I'd say bugger it all and use the right software on the PC to begin with and you should be all set.
     
  3. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    What about consoles. you can't change the software. I want to be able to use the console controller with another device like a mouse or a joystick with full control of key maps and axis. essentially tricking the console into thinking its a controller plugged into the usb port but it can be what ever HID or combination of HIDs I choose.

    is it possible to do this with hardware and firmware?

    sorry I didn't really outline my project well in the first place now that I read it.
     
  4. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Well that makes a big difference.

    Maybe you should tell us exactly what you want, and we can tell you the best way to go about it.
     
  5. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Basically im thinking off a intergrated USB host and client circuit that recieves the data from two HID devices where it can then be modified (buttons remapped etc.) via firmware and then placed under a single HID class discriptor sent out through the client hardware as if it were one USB HID device to the console.

    Well at least I think thats how to go about it! with a host and client together. HIDs ---> Host/client --->console

    I know the HIDs convert the anologue signal from the ases, buttons etc. into a digital stream and send it to the host so do I have to convert back to an analogue signal input for the microcontroller or is it possible to just modify the digital data and just 'repackage' it under the one HID descriptor

    I hope someone understands me, I don't even know if I do anymore:confused:
     
  6. sceadwian

    New Member

    Jun 1, 2009
    499
    37
    Take a look at the Viniculum USB modules, that might be your best bet, They support host and slave USB connections and have a built in micro controller to write firmware. You'd have to go through the learning curve of the hardeware and even worse the learning curve of creating USB connections, but since you're limiting yourself to HID compliant devices it's possible, just a lot of work.


    http://www.vinculum.com/
     
  7. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    I have been doing alot of research into USB and HIDs thankfully there is alot of info on this subject and it doesn't seem to difficult for the HID side of things. I do have some programming knowledge and I feel confident of being able to sort out the firmware.

    The issue is with the hardware. I don't know which direction to take or the best way to get two USB hosts and a slave onto a single circuit the simplest and most reliable way

    I read all the info on the vinculum modules and they sound like a step in the right direction with the two intergrated USB ports. I was thinking I could setup both ports as hosts to recieve data and output through one of the I/O pins but would I then have to send it to another MCU to act as a slave or can I output from the vinculum chip as a slave with some firmware trickery?
     
  8. sceadwian

    New Member

    Jun 1, 2009
    499
    37
    That's what I'm not sure of, the Viniculm only has two ports, but I don't know what you can do with a hub, I don't know what it's device limitations in software are. If you want more than what a single Viniculm can offer it's easy, use two, or more. The MCU portion supports modern high speed interfaces so you could have multiple modules talking to each other, but you'll really have to get your hands on a module and sit down and play with coding it. Try starting off with a simpler mapper, one HID in (host), one HID out (slave) and remap the original signal, doesn't have to 'do' anything just an exercise to familiarize yourself.

    From what little research I've done on USB the Viniculum modules are as easy as you're going to get, a single module won't put you back much and there are plenty of resources on Viniculums website about programming and setting up the existing firmwares for basic functionality, you can take it as far as you want from there. If I'm not mistaken the inbuilt MCU on the Viniculum modules are on par with most modern micro controller architectures so writing your own firmware with the resources they supply is probably your best bet to start with. It's going to be a LOT to take in though.
     
  9. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Well I like a challenge! As long as it can actually be done and not require a huge complex cuircuit I'm willing to put the time and effort in.

    I did plan on getting a development board and starting out small to learn the basics of generic USB HID I just need to know which direction to go in hardware wise. I was looking at Audrino boards.

    One thing that concerns me with the vinculum is drivers. I have had problems installing FTDI drivers before. Will a viniculum chip support a plug and play HID device for plugging into a console?
     
  10. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    To read your devices you'll need two host capable ports, and an additional port to act as a device for your PC.

    Sounds to me like you might have better luck writing a software layer on your PC that performs the task.
     
  11. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    I don't want to run the system through a PC, I want to just be able to plug the device into the console and the 2 HIDs into the device and away you go.

    I was thinking of looking into setting it up as a USB hub but does a hub receieve data that can be read or does it just pass on the data streams to the pc?

    Would it be possible to use a viniculum, setup with the 2 USB ports as hosts to provide enumeration to the devices, recieve the data streams then output the data from both devices by SPI or UART to a microcontrller where the buttons etc. Can be remapped and then sent out as a single slave?
     
    Last edited: Jun 28, 2010
  12. nickelflipper

    Active Member

    Jun 2, 2010
    280
    35
    Here's a forum post about combining a joystick and gamepad on the host from a Microchip viewpoint. No doubt similar conversations going on with other USB chip vendors.

    When it comes to USB, I am happy to be a consumer of the technology:).
     
  13. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Ok can someone tell me if this setup will work:

    a vinculum VDIP2 board with the two USB ports set as hosts to recieve data from two HID devices, the data then outputed via the I/O bus to a microcontroller where the firmware combines the data from the two devices under a single device descriptor then sends it on to a vinculum VNC1L chip which is setup as a USB slave and it talks to the console as if it where one generic HID device.

    Am I getting close?
     
  14. sceadwian

    New Member

    Jun 1, 2009
    499
    37
    uhh... the circuit will likely end up having more complexity than you're comfortable with =) Believe me you will put dozens or hundreds of hours into this.
     
  15. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Obviously I'm simplifying the circuit alot but I'm just trying to work out how it can be done and just looking for a little guidance from some more experienced minds.

    Is it possible with that hardware setup or am I going about it the wrong way?
     
  16. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    Yes, you can do as you've described.
    You appear determined to make the hardware approach your approach. Go for it.
     
  17. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Thanks GetDeviceInfo for the response!

    The only reason I'm going with the hardware approach is because I'm interfacing with a console so I won't be able to do anything software wise. Which is why Im also concerned about the vinculum being able to support a generic HID class ie. Joystick and it working in the console PnP. I havnt been able to confirm this yet.
     
  18. sceadwian

    New Member

    Jun 1, 2009
    499
    37
    Wrath
    http://www.vinculum.com/
    It's text searchable on Viniculums main page..
    And that's not the most modern version of the chip.
    If it uses USB you can do it, you just have to put the effort forward to learn how to write the code on the firmware side of the Viniculum.
     
  19. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Ok I'm going to give it a go. I've been researching non stop for a few days now and I now have a general understanding of where I'm going with this. I will do a couple of smaller USB projects first to get a grasp of it. Any recomendations for development kits?

    Oh and I was looking at combination devices. From what I have read it's a USB device with one address but with 2 endpoints. Can I use this for what I Want to achieve?
     
  20. Wrath

    Thread Starter New Member

    Jun 26, 2010
    17
    0
    Im just drawing up a some schematics as we speak. what microcontroller will be best suited to this task?
     
Loading...