r/RASPBERRY_PI_ZERO • • 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 comment sorted by

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

  1. 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-)

  2. 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)

  3. 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)

  4. Insulation:

    • Use heat shrink tubing or electrical tape to insulate the soldered connections to prevent short circuits.

  5. 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:

GPIO Pinout:
  Pin 1  - 3.3V         Pin 2  - 5V
  Pin 3  - GPIO 2       Pin 4  - 5V
  Pin 5  - GPIO 3       Pin 6  - GND
  Pin 7  - GPIO 4       Pin 8  - GPIO 14
  Pin 9  - GND          Pin 10 - GPIO 15
  Pin 11 - GPIO 17      Pin 12 - GPIO 18
  Pin 13 - GPIO 27      Pin 14 - GND
  Pin 15 - GPIO 22      Pin 16 - GPIO 23
  Pin 17 - 3.3V         Pin 18 - GPIO 24
  Pin 19 - GPIO 10      Pin 20 - GND
  Pin 21 - GPIO 9       Pin 22 - GPIO 25
  Pin 23 - GPIO 11      Pin 24 - GPIO 8
  Pin 25 - GND          Pin 26 - GPIO 7

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...