Author Topic: USB isolation schematic  (Read 4814 times)

0 Members and 1 Guest are viewing this topic.

Offline tesliniusTopic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: nl
USB isolation schematic
« on: July 30, 2022, 08:34:55 pm »
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?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Re: USB isolation schematic
« Reply #1 on: July 30, 2022, 08:51:07 pm »
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.
Alex
 
The following users thanked this post: tooki

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7187
  • Country: de
Re: USB isolation schematic
« Reply #2 on: July 30, 2022, 08:56:46 pm »
I don't want to use specific ic's because they're too expensive for my taste.
I think you'll find that optocouplers up to the task are far more expensive than the required ICs.
 
The following users thanked this post: tooki

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9793
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: USB isolation schematic
« Reply #3 on: July 30, 2022, 09:03:00 pm »
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.
Cryptocurrency has taught me to love math and at the same time be baffled by it.
Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
BTC: 18813fu8LQEdDwH9YLM1ABed3XwCfeSeFi
 
The following users thanked this post: tooki

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7187
  • Country: de
Re: USB isolation schematic
« Reply #4 on: July 30, 2022, 09:10:21 pm »
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.
 
The following users thanked this post: tooki

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Re: USB isolation schematic
« Reply #5 on: July 30, 2022, 09:15:00 pm »
Needs a TCP/IP stack of course
You 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.
Alex
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7187
  • Country: de
Re: USB isolation schematic
« Reply #6 on: July 30, 2022, 09:56:18 pm »
Well, as the OP has no further information for us...
let's keep guessing.
 
The following users thanked this post: tooki

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: USB isolation schematic
« Reply #7 on: July 31, 2022, 10:00:15 am »
If one uses the cheap Chinese PCB services, LCSC has ADuM3160BRWZ-RL for < $7 USD, and JLCPCB for their assembly service for < $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).)
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17828
  • Country: fr
Re: USB isolation schematic
« Reply #8 on: July 31, 2022, 06:49:10 pm »
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.
 
The following users thanked this post: tooki, Nominal Animal

Offline tesliniusTopic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: nl
Re: USB isolation schematic
« Reply #9 on: July 31, 2022, 09:26:19 pm »
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?
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7187
  • Country: de
Re: USB isolation schematic
« Reply #10 on: July 31, 2022, 09:37:32 pm »
So speaking from the hardware level of the circuit, why wouldn't the circuit work?
Answered in reply #1.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Re: USB isolation schematic
« Reply #11 on: July 31, 2022, 09:38:44 pm »
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.
Alex
 
The following users thanked this post: tooki

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17828
  • Country: fr
Re: USB isolation schematic
« Reply #12 on: July 31, 2022, 09:45:28 pm »
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?

As 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.
 
The following users thanked this post: shakalnokturn

Offline tesliniusTopic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: nl
Re: USB isolation schematic
« Reply #13 on: August 13, 2022, 11:03:17 pm »
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.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17828
  • Country: fr
Re: USB isolation schematic
« Reply #14 on: August 13, 2022, 11:18:49 pm »
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.

 

Offline sam[PS]

  • Contributor
  • Posts: 46
  • Country: fr
Re: USB isolation schematic
« Reply #15 on: August 22, 2022, 02:17:43 pm »
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...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->