Output USB HID over data lines instead of serial port. [Leonardo]

Hey I have an arduino leonardo and for a project of mine I need to output mouse HID packets as just a HID device instead of a arduino + HID. Looking into doing this over the serial port seems like it requires modification to the bootloader and that is not something I really want to do at this time, so I was wondering if its possible to use the 32u to output these HID packets over the datalines then connect this to a USB-A Female port to then connect to my computer. My main concern is maintaining a high polling rate as I'm unsure if the data lines can support 1000hz polling. That is assuming I even can do this over the datalines.

Any help on the feasibility of this is appreciated!

The USB bus requires special hardware, data pins are not sufficient.

Find out yourself how quickly a pin can be polled, An UNO reaches 100000Hz sample rate.

DrDiettrich:
The USB bus requires special hardware, data pins are not sufficient.

Find out yourself how quickly a pin can be polled, An UNO reaches 100000Hz sample rate.

That's the entire reason I bought a leonardo as its microprocessor allows for USB packets, surely I can encode HID packets and send them over the data lines, I've also seen people do a similar thing with a teensy.
I more mean sending 7 bytes 1k times a second. I'm sure I can send bits at the clock speed.

A teensy is usually much faster than an arduino if you care to do a speed comparison so it's not a problem with speed but still you need additional hardware to make it work. Even if you just want 7 bytes per millisecond, the data rate at full speed must be 12MHz, which is way over the arduino's capability unless you want low-speed device but still that is 1.5MHz so very little room for error and lots of register operations and interrupts. It will be quite difficult to integrate whatever code you have with such demanding requirement.

Judging from your reluctance to mess with arduino bootloader, you're not very experienced with arduino's details under the hood. If copy-pasted teensy code won't serve you well enough, look to arduino IDE version 1.6.5-r5. I don't have the most accurate account of arduino's software evolution but that version is the last in my arduino IDE versions that does NOT feature a pluggable USB library so it's the latest "simple" USB device class library you can find and hack. If you wish to make arduino appear as a pure HID device to fool a computer into thinking it's just a mouse, you start from there and remove all arduino CDC and keyboard HID code from the core files until only mouse HID code is left. It's a fun journey. Have a USB book handy.

I don't think the OP is understanding that the way a Leonardo is wired up.
The USB connector is ALREADY connected directly to the USB hardware port of the ATmega32u4. The 32u4 does NOT do "USB over the serial port", it simulates (with appropriate software) a serial port over the USB port.
To have the Leonardo show up as some HID device on the PC, instead of a serial port, you just load different software. There are examples that do this - see "File/Examples/09.USB/JoystickMouseControl" for one.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.