I bought today an Arduino Uno R3, and I'm looking forward to make it an HID device. I have seen many projects using a serial USB type B port. As I want to build a little gamepad, I would like to use the smaller USB mini type B port to achieve similar results. Looking it up did not seem to bring significant results.

Am I missing anything? Do I have to use a serial port similar to the one used by Arduino or can I reproduce the project using the aforementioned port?

  • Is it an Uno or an Uno R3? Sep 15 '15 at 20:50
  • 1
    The connector is just a connector. They carry the same signals - 5V, GND, D+ and D-. By the way, how do you intend to make your Uno a HID device? And what does the connector (which is soldered to the board) have to do with it?
    – Majenko
    Sep 15 '15 at 20:50
  • According to this video - youtube.com/watch?v=RoG_-9lAnSI - it can be done with the use of a serial port and a few other components It is an Uno R3
    – Glitched
    Sep 15 '15 at 20:53
  • 1
    Ah - software bit-banged USB. Nasty. Much better off re-programming the 32U4 chip to do proper USB.
    – Majenko
    Sep 15 '15 at 21:09
  • I could be interested in such a method, what could it mean? Would i still be able to program it like a normal Arduino?
    – Glitched
    Sep 15 '15 at 21:11

It sounds like you are going to be attempting software "bit-banged" USB. That, while possible, is severely frowned upon, especially when you have the resources to do it properly at your fingertips.

In answer to your question, yes, you can use a USB mini B connector. It is no different to a USB B connector except it is much smaller and contains one extra pin - USBID - which you can completely ignore (it's only used on USB On-The-Go devices).

USB is quite a heavy protocol to do in pure software - it won't leave much "room" for you to do much else. Better would be to re-program the ATMega16U2 chip that is used for the current USB interface. You will need some form of hardware programmer for it - you can use another Arduino Uno, and once done you won't be able to directly program the ATMega328P chip through the USB, so you would need some other method for connecting that (external USB serial adapter cable, or another Arduino), but the ATMega16U2 chip is specifically designed to work with the USB. Offloading the USB portion of your project onto that chip and using the serial interface that is already wired up to communicate commands and instructions to/from the ATMega328P would be a much more powerful (and reliable) system. There's plenty of tutorials and links around to show you how to reprogram that chip.

  • i actually only wanted to know if it was possible to use the USB mini connector. I can see now that this setup is not the best solution for sending keypresses (or input in general) to a computer, but i'm okay with it for now. I am still a newbie so reprogramming the chip may be a bit over my capabilities, so for a better implementation of my project i will look into buying an Arduino Due, Leonardo, or something else, depending on my needs. The answer is therefore accepted.
    – Glitched
    Sep 15 '15 at 21:31
  • It's an ATmega16U2 on the Uno, @Majenko. See Arduino / Genuino UNO.
    – Nick Gammon
    Sep 15 '15 at 21:34
  • @Nick I always get them mixed up. I know it changed from the R2 to the R3 and I never remember which it changed from / to. I though it went from 16U2 to 32U4 but maybe it went from 8U2 to 16U2.
    – Majenko
    Sep 15 '15 at 21:37
  • Yep I think it went from a 8U2 to a 16U2. I can never remember, either, I always have to look it up. :)
    – Nick Gammon
    Sep 15 '15 at 21:40

As an alternative to Majenko's suggestion you can implement Virtual USB as described at Virtual USB Keyboard. You just need:

  • 3 resistors
  • 2 zener diodes
  • a bit of wire
  • a suitable USB socket

The advantage is you haven't modified your Uno's USB chip (the ATMega16U2) so you can continue to upload sketches in the normal way.

The disadvantage is that the software USB may be more flaky than a hardware-implemented one.

Personally I don't like reprogramming my ATMega16U2 because I may as well have used one of the chips with a ATmega32U4 chip on it in the first place (like the Micro) which is designed for easy reprogramming.

  • That solution is the one i found to be the easier. I already linked to a video in one of my comments above.
    – Glitched
    Sep 15 '15 at 21:53

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.