Electronics > Projects, Designs, and Technical Stuff
Rotary switch electronic alternative
(1/1)
teddyng:
Are there any simple alternative to a rotary switch that can be control via software and not a physical turn. The only alternative I can think of is a series of relays, but for a SP8T for example would require a 7 relays.

Just a bit of context, I am trying to make a USB switch that will switch 1 USB between devices. Those devices only take a USB input to flash the software on it. See picture for an example setup.
Ian.M:
So you are looking to duplicate the functionality of a Uniselector only with modern parts.

SP8T requires only three cascaded relays, one SPDT selecting between the poles of a DPDT, in turn selecting between the poles of a 4PDT.  You can do DP8T with only four relays - DPDT -> 4PDT ->  2x 4PDT (coils paralleled).  Both cases need a three bit binary control signal and three drivers for the relay coils. However it is questionable whether it would work reliably for USB 2.0 due to the stray capacitance, impedance discontinuities and crosstalk.

Electronic switching USB 2.0 is fairly difficult due to the low on resistance and low capacitance required not to compromise the signal, so general purpose 1:N analog switch ICs are unlikely to work.  There are some dedicated USB 2.0 switch ICs, but you'll need a minimum of a two layer PCB with ground plane and impedance controlled traces, and the capability to reflow leadless SMD packages to use them.  Take a look at https://eu.mouser.com/Semiconductors/Switch-ICs/USB-Switch-ICs/_/N-7590j if you think you can handle that

Assuming the USB fllasher utility is capable of working through a USB hub with a single target device connected, and the  target is bus powered, why not hack a USB hub to add control of  the power to each port.  Best case it may already contain port power control ICs you can hack into, or worst  case you'll have to add a P-MOSFET in the Vbus feed to each downstream port.  If you enable power to one port at a time, only one target will enumerate even if all the other ports have targets physically connected.  Any hardware hacker who  has progressed past the 'burnt fingers' stage should be able to convert a seven port USB hub to add six port power control, with six P-MOSFETs and an Arduino Nano to control them hard-wired to the seventh port.
MosherIV:
The switch arrangementmay not work as you expect.
When the switch is changed, the current host attached will detect the usb device removal.
The next host will detect device connection.
In addition, there is not protection from switching while a data transfer is in progress.
teddyng:

--- Quote from: MosherIV on May 12, 2020, 12:51:46 pm ---The switch arrangementmay not work as you expect.
When the switch is changed, the current host attached will detect the usb device removal.
The next host will detect device connection.
In addition, there is not protection from switching while a data transfer is in progress.

--- End quote ---

This is not a concern for me, the flash image is small so it will take less then half a minute to read to the device flash, and any switching would be controlled by some code in time with the device upgrade commend, so I will just put a 5 mins delay between each device. I am more concern if this will actually work, I would probably be using cascaded DPDT for this method as Ian mentioned below.


--- Quote from: Ian.M on May 12, 2020, 11:28:24 am ---So you are looking to duplicate the functionality of a Uniselector only with modern parts.

--- End quote ---

Yes basically, I need to change the switching remotely so normal rotary switch won't work, or I can attach a motor on to it.


--- Quote from: Ian.M on May 12, 2020, 11:28:24 am ---SP8T requires only three cascaded relays, one SPDT selecting between the poles of a DPDT, in turn selecting between the poles of a 4PDT.  You can do DP8T with only four relays - DPDT -> 4PDT ->  2x 4PDT (coils paralleled).  Both cases need a three bit binary control signal and three drivers for the relay coils. However it is questionable whether it would work reliably for USB 2.0 due to the stray capacitance, impedance discontinuities and crosstalk.

--- End quote ---

I am thinking about DPDT setup as well, it seems to work for 4 output using SPDT only, just need to make it to 8 output and see how reliably it is. DPDT setup will probably increase crosstalk then SPDT, I can isolate DATA+ and DATA- if I design the layout correctly. DPDT I would be puting them straight in together.


--- Quote from: Ian.M on May 12, 2020, 11:28:24 am ---Electronic switching USB 2.0 is fairly difficult due to the low on resistance and low capacitance required not to compromise the signal, so general purpose 1:N analog switch ICs are unlikely to work.  There are some dedicated USB 2.0 switch ICs, but you'll need a minimum of a two layer PCB with ground plane and impedance controlled traces, and the capability to reflow leadless SMD packages to use them.  Take a look at https://eu.mouser.com/Semiconductors/Switch-ICs/USB-Switch-ICs/_/N-7590j if you think you can handle that

--- End quote ---

PCB side of things I can handle, but the problem is picking the right IC. I was thinking CD4066 and 74HC4051 but there's about 100 ohms resistant, but I can get some bus switches which are basically the dedicated usb switch IC you are talking about.


--- Quote from: Ian.M on May 12, 2020, 11:28:24 am ---Assuming the USB fllasher utility is capable of working through a USB hub with a single target device connected, and the  target is bus powered, why not hack a USB hub to add control of  the power to each port.  Best case it may already contain port power control ICs you can hack into, or worst  case you'll have to add a P-MOSFET in the Vbus feed to each downstream port.  If you enable power to one port at a time, only one target will enumerate even if all the other ports have targets physically connected.  Any hardware hacker who  has progressed past the 'burnt fingers' stage should be able to convert a seven port USB hub to add six port power control, with six P-MOSFETs and an Arduino Nano to control them hard-wired to the seventh port.

--- End quote ---

I will have a look into this, but you are right, hacking a usb hub would be easier. I am not sure if the USB hub will work, I am flashing a linux zimage at the bootloader stage so it might not recognize the hub. I will give it a try

My alternate method is to make multiple of pi zero as USB with network share. This requires one pi zero per devices. I am planning around 20 devices, so it just seem a bit wasteful and also need to power 20 extra usbs (as I need it to run strightaway from startup so can't use power from device). The flashing only occurs once a week as well.   :-\ https://magpi.raspberrypi.org/articles/pi-zero-w-smart-usb-flash-drive

Thanks for all the suggestions
Navigation
Message Index
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod