USB isolation schematic - Page 1
Forum section: electronics / projects

author: teslinius
author_rank: Regular Contributor
timestamp: July 30, 2022, 08:34:55 pm
content: I have a stm32 uc am i am using DP/DM pins for usb communication. But i want to make it isolated. I don't want to use specific ic's because they're too expensive for my taste. So i have come up with a circuit using optocouplers and isolated DC/DC converter. So my question is would this circuit work?

author: ataradov
author_rank: Super Contributor
timestamp: July 30, 2022, 08:51:07 pm
content: Apart from a non-functional idea of the schematic, PC817 has a cut-off frequency of 80 kHz. Even USB LowSpeed uses 1.5 MHz signalling. No, this will not work at all.It is virtually impossible to do optical isolation for USB using traditional LEDs. The best you can do is laser link with modulated signals. But this is far more complicated than ADuM isolator.

author: Benta
author_rank: Super Contributor
timestamp: July 30, 2022, 08:56:46 pm
content: Quote from: teslinius on July 30, 2022, 08:34:55 pmI think you'll find that optocouplers up to the task are far more expensive than the required ICs.

author: NiHaoMike
author_rank: Super Contributor
timestamp: July 30, 2022, 09:03:00 pm
content: Probably the cheapest option would be to use something other than USB, especially if the bandwidth requirements are low. For example, Wifi using an ESP32.

author: Benta
author_rank: Super Contributor
timestamp: July 30, 2022, 09:10:21 pm
content: Dunno which STM32 the OP is using, but if it's got Ethernet, RJ-45 sockets with integrated isolation/magnetics are dirt cheap. Needs a TCP/IP stack of course, but I'm certain that it's in the STM32 library.

author: ataradov
author_rank: Super Contributor
timestamp: July 30, 2022, 09:15:00 pm
content: Quote from: Benta on July 30, 2022, 09:10:21 pmYou don't need a stack for point to point communication. And if you are replacing USB, that's what you would need.But you also would need Ethernet PHY, which is just an overkill. ADuM4160 is $12 and solves all the problems in one small package.

author: Benta
author_rank: Super Contributor
timestamp: July 30, 2022, 09:56:18 pm
content: Well, as the OP has no further information for us...let's keep guessing.

author: Nominal Animal
author_rank: Super Contributor
timestamp: July 31, 2022, 10:00:15 am
content: If one uses the cheap Chinese PCB services,LCSC has ADuM3160BRWZ-RLfor < $7 USD, andJLCPCB for their assembly servicefor < $6 USD. Those are around the same price Mouser sells them in full reels, so I believe they're genuine parts.(I've used the cheap USB LS (1 Mbit/s) and FS (12 Mbit/s) isolators based on ADuM3160 datasheet and an isolated DC-DC converter off eBay for ~ $10 USD, and they've worked just fine for me – I use them to isolate my computer from my microcontroller projects and fumbling that might otherwise endanger the USB bus hardware on my computer. They do usually have a dip switch to select the speed, and will not work for HS (480 Mbit/s).)

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 31, 2022, 06:49:10 pm
content: One thing for sure is that the OP's solution won't work for a number of reasons. The bandwidth is just one of them. There are others.As it is, the bidirectionality nature of USB wouldn't work properly either (think of what happens when direction must change). And, not to talk about the required detection of specific pull-ups and pull-downs according to the USB spec.Yes, using a dedicated IC is the simplest way of achieving this. But we know nothing about the OP's project, and it's quite possible that isolating at another level than USB may be the better answer here. So we definitely need to know more to give the "best" solution, but again the proposed one was definitely never going to work.

author: teslinius
author_rank: Regular Contributor
timestamp: July 31, 2022, 09:26:19 pm
content: Thanks for the replies, i don't need any high speed communication, max 9600 bits per second, just for the uc to send a few parameters. So speaking from the hardware level of the circuit, why wouldn't the circuit work?

author: Benta
author_rank: Super Contributor
timestamp: July 31, 2022, 09:37:32 pm
content: Quote from: teslinius on July 31, 2022, 09:26:19 pmAnswered in reply #1.

author: ataradov
author_rank: Super Contributor
timestamp: July 31, 2022, 09:38:44 pm
content: You can't just have 9600 bps. That's not how USB works. It would still go 1.5 MHz or 12 MHz.To begin with, USB uses 3.3v signaling and you are using 5 V on the right side.Then USB is a bidirectional bus with a permanent pull-up resistor on D+ or M- (depending on the FS or LS mode). So, there is no way your circuit can reliably detect direction of the transfer. Your optocoulpers will just fight each other.

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 31, 2022, 09:45:28 pm
content: Quote from: teslinius on July 31, 2022, 09:26:19 pmAs said above, that's not how USB works. So, nah.Still a bit unclear what your circuit is, but from the statement above, we can suppose that you have a MCU that implements some USB connection, and which in turn implements some UART for communicating with some other device. Then, it would appear, as I suggested earlier, that isolating at the UART level here would be much easier and less expensive. Unless of course there are other interfaces to the MCU that would need to be isolated as well. So, just consider that.

author: teslinius
author_rank: Regular Contributor
timestamp: August 13, 2022, 11:03:17 pm
content: Oh ok now i understand, but something like this, to do the isolation between the ch340 and the uc would work right?, but then the supply would have to be separate, the device would have to be powered from external supply, and the ch340 from usb, except if i use a isolated converter, then i could make it work when the usb is plugged in, but it's only for low current.

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 13, 2022, 11:18:49 pm
content: Yes you got it right, and yes, you'll need a separate, isolated power supply for the isolated side. But you would have needed that as well if you had isolated at the USB level, so this requirement is there however you handle this. Benefit is that in this case, the MCU can be powered from USB, and the isolated power supply will only have a few mA of current to deliver.There are several ways of implementing this. If you have no available isolated power supply (keep in mind that a dedicated power supply for the isolated side needs to be *isolated* from the USB side, so you can't use just any solution: for instance, many AC adapters are not properly isolated from "earth", and the USB side is usually not either (unless you're for instance strictly plugged in a laptop which is on battery only with AC unplugged), so there you'd break the isolation.So you either need a properly isolated AC adapter, or you can also power the isolated side from batteries if it's convenient, or you can alternatively (probably best but can be a bit more expensive) use an isolated DC/DC converter to power the isolated side from the USB VBUS. There are many such converters out there, and if you only need a few mA of current, you can find them relatively cheap. Another alternative is to get rid of optocouplers and the DC/DC converter and use a digital isolator such as in the ADuM series with "ISOpower" - those handle the isolation of digital signal and generate an isolated power supply all in a single chip. For instance the ADuM5201 which would be a right fit here. Overkill in terms of bandwidth, but it's only a few bucks and will replace two optocouplers+a, isolated DC/DC converter, so I guess it should be cheaper.

author: sam[PS]
author_rank: Contributor
timestamp: August 22, 2022, 02:17:43 pm
content: The cheapest solution i can envision is to isolate at another level. I mean use another uC to manage the USB communication, that one will not be insulated, and then use a simpler/much easier to insulate communication protocol to communicate with your stm32/main uC. Both rs232 or SPI would be good candidate there. You can run those at low speed allowing for the use of cheap optocoupler. The overall solution could be made for <3$ worth of component so that might be it. However if you value your time, and the commercial dedicated component can be purchased for 7$, you will need a big volume to make up for the price of extra engineering time. Off the shelf solution exist for a reason.Just my 2cts...