Here's what I would like to do: after I load code into my Arduino UNO, I would like to then use the Arduino's hardware USB port for something else (I will be powering the Arduino with a separate power supply after loading code).
The data pins for the USB port that I was originally going to install myself for a project wire up to digital data pins 4 and 5. So my question is: can I use the Arduino's USB port? ...instead of providing a new USB port that I was going to install myself, just use the Arduino's and route it to digital pins 4 and 5 (or actually,... maybe just change my pin code to the location of said USB port?). If so, how ?
No, the arduino Uno's USB data pins are connected to the on-board serial adapter, which in turn communicates with the '328p using the hardware serial port on pins 0 and 1
What do you hope to do by connecting data pins of a USB port to the '328p? It does not have USB support. Even chips that do have to have the USB connected to specific, dedicated USB data pins, not just any old pin on the chip.
I have a code that inputs a PS2 keyboard's output,... I happen to have a PS2 keyboard that has a USB cabled output. I will need to do less to my project box (it houses the arduino) if the hardware USB port of the Arduino shares duties in this regard. If it did work... I would simply use an adapter from USB A to USB B.
I wonder if I used a dremmel tool to erase(destroy) the traces if I could solder up the pin routes accordingly. They aren't used after programming I would assume.
On that note... I wonder what would happen if I soldered up to it "without" destroying the traces... maybe it would function anyway(?) It probably wouldn't even read the PS2 info coming in (?)
It saves time all round if you actually say what you are doing and why.
From my point of view it looks like you haven’t a clue as to what you are doing nor why you are doing it. I can tell this from the way you ignore the very good advice you have already received.
I meant no offense... and I very much appreciate the input. I agree,.. knowing how to properly frame a question here is a lot of the trick (though the best way is not always obvious to me). I think I got my answer with the first response. All I wanted to know was if I could re-purpose the data input jack once the sketch is loaded (which happens to be a USB B type port). The answer is,... I cannot "tell" the arduino to do that. So if I still want to re-purpose it for another use, I have to come up with a way to hard wire it. Whether that means de-soldering it and turning it upside down and super-gluing it onto the board (so that I then have access to the pins on the jack),... or somehow destroying the traces on the board so that I can run wires instead... then I was musing that if I just soldered in the wires without destroying the traces... maybe the receiving part of the chip would ignore that there was weird data going on at the port... because assumably it is looking for a sketch to upload (and the data going on there wouldn't be sketch-like).
You're right that I am not all-knowing... but experimenting is a lot of the fun. My sketch already works... If I ruin one $6 board trying to re-purpose the data input jack it's not the end of the world
PS: I bought your book Grumpy_Mike. Thanks for the work that you do!
Jim_J:
So if I still want to re-purpose it for another use, I have to come up with a way to hard wire it. Whether that means de-soldering it and turning it upside down and super-gluing it onto the board (so that I then have access to the pins on the jack),... or somehow destroying the traces on the board so that I can run wires instead...
None of that can possibly work.
The Tx and RX pins of an Atmega 328 microchip are internally connected to the USART. The USART cannot be re-routed to any other pins. Read the Atmega 328 datasheet if you need confirmation.
Why not use an Arduino Mega which has 3 spare HardwareSerial ports?
Thanks,... I'm trying to keep this UNO small (and I already have a box with ports cut out to the Arduino UNO dimensions). That's why no Mega.
You say none of this can work,... but I don't see why I can't desolder the jack and turn it upside down and use it separately from the Arduino. Once the sketch is loaded the jack is no longer needed
I'm not sure I have made it clear what I am trying to do (if so, I apologize for my lack of clarity)
To do what you want without a MEGA is possible with SoftwareSerial, but it won’t be anything like USB, unless you add another chip/shield.
USB is not ‘serial’ as you know it, USB is a semi-intelligen, negotiated, and enumerated interface to carry other protocols.
Once the USB ‘channel is in place, a ‘serial’ channel (or x many other types) can be implemented ‘over’ the USB.
In your case a keyboard often uses what’s called an *HID interface over a USB channel#.
None of these are ‘serial’ in the sense of a PS2 keyboard or RS232 commection. For the Arduino to handle these communications they use an FTDI or other chip to perform the protocol conversion.
This is exactly what the chip attached to pins 0/1 does.
If you want a USB host, you need a different type of USB interface that understands and negotiates this host side of the USB link.
Again,... thank you to everyone that responded. I very much respect the knowledge here!
I wanted to report that this worked... and I didn't even have to flip the jack or try to disrupt the traces on the board. I think this works because the PS2 info coming in probably doesn't resemble sketch language,.. so the chip ignores it and let's me use this jack for another purpose.
Now that I have adapted the PS2 keyboard's plug... when plugged in it now receives it's power through this jack... and it's data is transferred to digital pins 4 and 5 because of the wires I added. The only hitch is that I have to hit the reset button after power up to make it work (I''m going to wire a remote push button switch up for that). See picture for how the wires are soldered (I'm attaching one, hopefully it comes through)...
I’ll go with posts #5 & 7
What you wanted, described, and what we discussed with you are poles apart.
Grumpy_Mike was the closest in #5
Your description and understanding of the problem are yours alone.
I agree wholeheartedly... “the PS2 info coming in probably doesn't resemble sketch language”
"I'll go with posts #5 & 7 What you wanted, described, and what we discussed with you are poles apart."
I think some knowledgeable people saw the word USB and went off on a tangent. I was only talking about using the Port (..and before I soldered, wondered if there was a way to do this internally). From there it became like a game of "telephone".
Please feel free to read my original post
"what you described" ... it wasn't
"what we discussed" ... i didn't (I even tried to discourage that avenue of talk)
I think this could be useful information for someone down the road, so I'll leave it. I don't really get the sensitivity and defensiveness. I've been appreciative and nice
so i apologise for misunderstanding your poorly expressed question.
At some point the subject should have been updated to -
REROUTING ARDUINO’S USB CONNECTOR TO OTHER PINS FOR A DIFFERENT PURPOSE
This is a perfectly reasonable question, despite the intended goal of ignoring a connector ‘standard’. ‘Ports’ are subtly different.
Now that’s over.
Be careful of how you use the pins/voltages, so they don’t go anywhere unexpected. Luckily they’re all 5V tolerant, so shouldn’t cause any issues.
Thank you lastchancename. You are absolutely correct. That would be a far better subject header. I'll see if I can fix it (or if someone else can, please do)
Also, thank you for the additional cautions. I will observe them, according to my level of knowledge and ability
It just needs more clear nail polish to stick the wires down to the board and protect the metal parts from corrosion. The industry calls this "conformal coating" but I buy it in the ladies' makeup aisle.
"It just needs more clear nail polish to stick the wires down to the board and protect the metal parts from corrosion. The industry calls this "conformal coating" but I buy it in the ladies' makeup aisle."
Hey, thanks for this tip. I will do just that. (back in the day I used to use clear nail polish to repair speakers, never thought of using it for this though).
I'm sure there is some sensible reason why a standard USB connector is used for a non-USB purpose but I can't for the life of me understand why a much simpler connection is not made direct to pins 4 and 5 with some "DuPont" connectors.
At some time in the future someone is going to connect a standard USB cable to that socket and to a PC - it may even be the OP.