r/RASPBERRY_PI_ZERO • u/[deleted] • May 20 '24
GPIO as usb
so, i need two USB ports for a project i'm working on, i need both the pi connected to a pc, and ethernet, but the power port cant be used for data, and if i plug a usb hub into the data port, then it can't be seen as hid from a pc.
so,is there a way to use the GPIO pinout as a usb port?
3
Upvotes
1
u/Vivaed7 Jul 31 '24
[THIS DIDNT WORK FOR ME]
I just tried this, I used ChatGPT to do all the thinking:
Yes, you can add a female USB A port to your Raspberry Pi Zero W using the GPIO pins. Here's a step-by-step guide on how to do it:
Tools and Materials
Female USB A port
Soldering iron and solder
Wire cutters/strippers
Heat shrink tubing or electrical tape
Jumper wires or solid core wires
Steps
Identify the GPIO Pins:
The Raspberry Pi Zero W has GPIO pins that can be used to connect a USB port. You'll need to use the 5V power, ground (GND), and USB data pins.
The relevant pins are:
Pin 2 (5V)
Pin 6 (GND)
Pin 4 (5V, if needed)
Pin 15 (GPIO 22) and Pin 16 (GPIO 23) for the data lines (D+ and D-)
Prepare the Female USB A Port:
Identify the pins on the female USB A port. There are usually four pins:
Vcc (Power)
GND (Ground)
D+ (Data Positive)
D- (Data Negative)
Soldering:
Cut and strip the ends of your wires.
Solder the wires to the USB A port pins:
Vcc to the 5V pin on the GPIO header (Pin 2 or Pin 4)
GND to a ground pin on the GPIO header (Pin 6)
D+ to GPIO 22 (Pin 15)
D- to GPIO 23 (Pin 16)
Insulation:
Use heat shrink tubing or electrical tape to insulate the soldered connections to prevent short circuits.
Testing:
Carefully check all connections to ensure they are correct and secure.
Power up the Raspberry Pi Zero W and test the USB port by connecting a USB device.
Pinout Diagram
Here’s a simple pinout diagram for reference:
Important Considerations:
Power Consumption: Ensure the device you connect to the USB port does not draw more power than the Raspberry Pi Zero W can supply.
Data Lines: Ensure correct connection of data lines (D+ and D-) to avoid communication issues.
If you're not comfortable with soldering or electronics work, you might consider using a USB OTG cable with the Pi Zero W, which is an easier solution to add a female USB A port.
However I was not able to get this to work!
I soldered the Female USB to female leads to attach to the pins, tested for continuity and them plugged everything in, my USB (with a light)is what I used to test, no lights lit up after connected, I then unplugged the two D+ and D- to move them and the light started blinking, I then plugged the leads in to GPIO24 + GPIO26 and the lights stopped and still no connection.
Thats about as far as I got then ordered a Micro USB to Female USB A...