I'm trying to use V-USB library to emulate a keyboard using Arduino Nano but because of precaution, I don't want to use it's built-in USB port.
My idea is to add another USB port so I cant power my device with the new USB port and use free digital pins as input/output of the new USB serial port in V-USB project.
What circuit I should use and how to add extra USB port to Arduino Nano.
-
By far the easiest way would be to buy a second Nano and connect the two together.Andrew– Andrew2016年12月16日 11:54:03 +00:00Commented Dec 16, 2016 at 11:54
-
@Andrew of course it's easiest way but I care about the cost of the project!joware– joware2016年12月16日 11:54:59 +00:00Commented Dec 16, 2016 at 11:54
-
1The circuit diagram for connecting V-USB read.pudn.com/downloads194/sourcecode/embed/911688/…Gerben– Gerben2016年12月16日 13:57:01 +00:00Commented Dec 16, 2016 at 13:57
2 Answers 2
USB is deceptively simple. The underlying protocol is very complex. So a complete answer to your question requires some USB background.
USB is divided into 2 types. USB Hosts and USB Devices. We are not concerned about USB Hosts here. USB Devices only need to know about their own functions / features. If they are a serial port device, like the FTDI chip on the Arduino Nano, they only need to "speak" basic USB protocol and the serial CDC USB protocol. If the USB Device was a keyboard, it only needs to know the basic USB protocol and the HID USB protocol.
In order to offer up a USB port the Arduino Nano uses an FTDI chip FT232RL. This chip supports a Serial Port USB Device. It does not appear to support HID USB Devices. So your decision to use V-USB is necessary not because of power but because the Arduino Nano's built in USB port supports a protocol other than USB CDC.
What circuit I should use and how to add extra USB port to Arduino Nano.
The circuit suggested is on the V-USB web page appears to contain the necessary information:
Of course you will have to do some research into V-USB software to see which are the appropriate pins to use on your Arduino Nano.
-
The OP wants to use V-USB!Gerben– Gerben2016年12月16日 13:57:58 +00:00Commented Dec 16, 2016 at 13:57
-
I see what you mean. I'll edit my answer. Thanks.st2000– st20002016年12月16日 14:29:24 +00:00Commented Dec 16, 2016 at 14:29
-
Since Arduino Nano have internal oscillator, can I setup only left side of the circuit?joware– joware2016年12月17日 13:41:37 +00:00Commented Dec 17, 2016 at 13:41
-
My understanding is that USB is very picky about frequency. Perhaps this is the reason that the V-USB web page included the external crystal. However, the V-USB web page does say: "Can be clocked with 12 MHz, 15 MHz, 16 MHz 18 MHz or 20 MHz crystal or from a 12.8 MHz or 16.5 MHz internal RC oscillator.".st2000– st20002016年12月17日 14:29:54 +00:00Commented Dec 17, 2016 at 14:29
You can use a USB host mini module for the Arduino NANO and the USB Host Library r2.0 enter image description here
You can implement a keyboard with this...