6

I'd like to make my Raspberry Pi a little more compact by moving a USB device inside the box, since there's so much empty space in there. I thought I could make this reasonably flexible by running two wires on the underside from one set of USB pads to, say, the serial port TxD and RxD pins. The neighbouring +5V and GND pins could supply USB power. Then I could attach pin headers to a USB device and plug it onto the top side. And then when it turns out it's a stupid idea, I don't have to resolder anything to put it back how it was :) I get that this assumes the GPIOs can be programmed not only to be floating but also to not have any significant impedance attached to them. I have no idea if that's a reasonable assumption.

So two questions:

  • Is it likely to work?
  • Is it likely to explode?
3
  • 1
    If the goal is to get an internal (to the case) USB port. You may be able to use one of the add on USB hubs designed for the Pi Zero. Some of these use pogo pins to connect to the USB pins on the Pi Zero, You could remove the pogo pins and solder to your Pi's USB pins as you suggest. I believe this will work. Having said that this seems like a lot of work for minimal gain. Commented Oct 12, 2016 at 14:15
  • 1
    If you're really really keen to do this and, per Dmitry Grigoryev's answer below, are prepared for some unexpected results relating to very low-quality connections and noise, I'd just hot glue a 4-pin header straight onto the board and run the necessary connections to it. There should be room on the back side of the USB connector modules for 4 pins if you have (perfectly understandable) jitters about gluing to the PCB.
    – goobering
    Commented Oct 12, 2016 at 14:58
  • Depending what "the box" is made from (it at least has a lot of "empty space"), you could screw and/or glue a jack to that, and then just use a four pin connector to the board so you can detach the pi when need be. You can possibly salvage such a connector from an old PC if you happen to know where there are some lying around; they are used to attach the front USB jacks. If not just go ask in a small computer store where they do repairs.
    – goldilocks
    Commented Oct 13, 2016 at 10:59

1 Answer 1

8

While this might work with some low speed devices, it's a bad idea for two reasons:

  1. While you might be able to reprogram GPIO pins to high impedance state, that would only work until you reboot. For the time from power on to the moment your scripts disable the pins, you have potential for overcurrent conditions between USB and GPIO. This might be solved by putting resistors between the two, which may in turn have significant effects on USB communication.

  2. USB 2.0 uses high-frequency signals (about 0.5 GHz) and requires careful signal routing. GPIO pins aren't designed to run at such frequencies, so PCB traces attached to them don't respect routing constraints. As a result, USB signals will get all sorts of artefacts (spikes, reflections etc.) which will probably prevent USB 2.0 devices from working. The same may be true for wires you solder, if you're not careful.

EDIT: to clarify about USB voltage levels, USB 2.0 Specification, section 7.3.2 "Bus Timing/Electrical Characteristics" says that voltage on data pins driven HIGH must be between 2.8 and 3.6 V, which should be generally compatible with 3.3V voltage levels of GPIO.

4
  • @goldilocks As I read the question, the OP wants to route signals from hardware USB controller to GPIO connector, not to implement USB via GPIO. Commented Oct 12, 2016 at 17:10
  • Right you are! Anyway, I guess that makes it slightly less infeasible...or not. I would just run the wires through one of the mounting holes to the top of the board and add a dedicated connector there, there's no reason to use the GPIOs at all.
    – goldilocks
    Commented Oct 12, 2016 at 17:36
  • One potential advantage is that GPIO pins are solidly soldered and would survive many more connects/disconnects than a hand-made connector. Unfortunately, potential electrical issues outweigh this benefit with a large margin. Commented Oct 13, 2016 at 7:26
  • 1
    Yeah, that second point in particular occurred to me, but I don't have enough experience to say how silly the idea is. Pretty silly, is the conclusion. I'll make do with a slightly less robust approach. Commented Oct 13, 2016 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.