[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself


View post   

File: 873 KB, 1301x651, 517ed3fcce395f991d000000.png [View same] [iqdb] [saucenao] [google]
1478806 No.1478806 [Reply] [Original]

I want to switch a USB input between two devices. What kind of switch do I need? Is a four pole double throw like pic related sufficient for USB2.0? What about 3.0?

>> No.1478811

Or you could just plug and unplug the cable between devices. No, this switch wouldn't work for for 2.0 speeds and I doubt it will even transfer at full speed (12Mb).

If you're trying to share a flash drive between two devices, don't. Rethink your strategy for why you think you need to.

If you're trying to share a keyboard or mouse, get a cheap USB KVM switch

>> No.1478814

>>1478811
Current use would be switching a keyboard. I just like doing stuff myself and dont want to wait for a KVM from china.

Would the change in resistance or shieldi g hinder transfer speed?

>> No.1478817

>>1478814
You could try a demultiplexer

>> No.1478822

>>1478811
>No, this switch wouldn't work for for 2.0 speed
Bullshit. USB 2 is surprisingly resilliant. I've torn up cables, separated the pair, removed the shield, and put data lines through switches without getting any packet errors. Using a switch like that will probably work fine.
For usb3 I wouldn't bet on it.

>> No.1478826

>>1478806
USB 3 uses 9 pins.

>> No.1478829

>>1478826
So that would need a 9pdt? What resistance should be workable for 3.0 without data loss?

>> No.1478836
File: 555 KB, 1251x1077, notsogood.jpg [View same] [iqdb] [saucenao] [google]
1478836

>>1478829
use a couple of these 8ghz 1A relays

https://www.mouser.com/ProductDetail/Omron-Electronics/G6K-2F-RF-V-DC12?qs=sGAEpiMZZMt%2fATQILEa77eao%252b8NMbkdWiXlch57axuM%3d

>> No.1478838

>>1478829
If you're gonna buy a 9 pole switch, you can spend an equal or less amount on a KVM from Amazon and wait the same amount of time for results that don't look like a roody-poo cobbled them together

>> No.1478842

>>1478838
So what's inside a KVM? Multiplexer?

>> No.1479153

>>1478806
Use a hub. Chinese kvms suck look at bb electronics.

>> No.1479165
File: 775 KB, 887x1496, 20181011.jpg [View same] [iqdb] [saucenao] [google]
1479165

>>1478842
Nothing lol

>> No.1479175

>>1478826
>not keeping the power and ground lines connected
There's 2 grounds and 1 Vcc, so either 6PDT or 7PDT. A couple of FETs in series would probably work instead though, just have one toggle switch (or even a reed switch right close to the outside so it's invisible) and an array of transistors, potentially all in one IC. Relays sound like a pain, but mainly because of the bulk to them. I'm not sure about USB 2.0's + and - data lines, if one is send only and the other is receive only then you could get away with only 2 FETs, same with 3.0's 4 data pins.

I was planning on doing this with a flash drive and putting it inside my computer mouse with a reed switch, haven't got around to doing it yet though. Mainly because the reed switch needs my magnet to be way too close to have it on the other side of a plastic wall. Using a tilt sensor instead might be a better option, since I'll not be using a mouse upside down. I have a laptop and prefer the trackpad, for not gaming, so losing mouse capability is no issue.

>> No.1479261

https://www.ebay.com/itm/UGREEN-USB-3-0-Sharing-Switcher-4-Port-USB-Switch-Selector-Fr-PC-Scanner-Printer/152554940836?epid=10024055666&hash=item2384fba9a4:g:pkIAAOSwZKBZH9cf

>> No.1479310

>>1478838
>roody-poo
that's vintage

>> No.1479846
File: 498 KB, 300x222, 1528191813437.gif [View same] [iqdb] [saucenao] [google]
1479846

>>1479175
USB D+ and D- can be pulled high or low from either end of the wire, and also have pull-ups and pull-downs on each end depending. there are real bus switch ICs that could (and probably should) be used, e.g. 74CBT3257. the USB 1.1 spec is very educational as to what OP is in for
also a break-before-make is required that lasts long enough for the host to recognize that the old device is gone and that it needs to configure a new device
finally some devices/hosts might get into unusable states if a device doesn't lose power and thus reset between connection cycles. disconnecting VBUS might be needed in that case
try a Hall effect switch?

>>1478829
>USB 3.0 without data loss
c ~= 300 mm/ns. high-speed serial lanes are picky about their picoseconds (think 300µm) and about impedance discontinuities, especially if they are more than one pair wide. if you've not done high speed circuit design before, you got a lot of reading to do

>> No.1479853

>>1479846
Hall sensor sounds like the way to go, at least more than a mercury tilt switch. Do too much quick movement with a tilt switch and my PCB might suddenly be covered with a blob of liquid metal, which would be less than beneficial.

Know anything about the differences in speed (and subsequent PCB design) from USB 1 and USB 2?

>> No.1479877

>>1479853
the spec mandates 90 ohms characteristic impedance of the D+/D- pair, and you would set the width and spacing along the corresponding pcb traces according to the dielectric constant of the substrate you're using and ground plane distance (there are calculators, fortunately). of course you'd keep them as short as reasonably possible
also, only 0.635mm of length difference is allowed between the two signal traces/lines for USB high-speed (480Mbps). if you limit the devices to full-speed (12Mbps) and low-speed (1.1Mbps), cable skew is specified as 400ps max (a few inches), so it'd have to be kind of an old flash drive
a stripped-down hub buried in there may not be a bad strategy to consider, if you have room. then your Hall switch merely needs to control power to the flash drive via MOSFET or whatever and not even worry about controlling the HID mouse function's data lines