Isolating USB for Programmable Power Supply - Page 1
Forum section: electronics / projects

author: radian
author_rank: Contributor
timestamp: August 26, 2013, 09:25:07 pm
content: Hi all. I'm working adding programmability to Dave's original PSU design. I'm stuck on how to get around isolating USB from the PC host and the actual power supply. I'm a bit worried that powering motors and whatnot could cause damage to the USB port (through the ground line perhaps?). One thing to note is that I'm looking for a through hole solution.My first thought was some sort of optocoupling on the USB signal lines directly to the microcontroller, but I haven't found many solutions out there (at least for a reasonable price in a DIP package). Another thought was to convert USB to UART in a seperate chip (AVR running V-USB and powered from USB) then optocouple the data lines from this chip to the primary microcontroller - but I think UART still requires a common ground? The last thought was to convert USB to I2C, but being a bi-directional protocol makes this rather tricky to optocouple.What would be the best approach to take here? Is there an option that I've overlooked?

author: mwilson
author_rank: Contributor
timestamp: August 26, 2013, 09:31:50 pm
content: I happened across this Maxim app note a couple weeks ago when I was considering a project that would have required isolation of USB data. I've only skimmed it, but it does appear to cover "why it's hard" (bidirectional nature of signals, and native USB speeds are too fast for most optos) and offer a solution. Essentially you communicate with your USB interface via SPI, which is easy to isolate, and the USB protocol scales its speed down appropriately:http://www.maximintegrated.com/app-notes/index.mvp/id/3891

author: radian
author_rank: Contributor
timestamp: August 26, 2013, 09:51:36 pm
content: I came across that note as well. Initially I tossed the idea as I was set on using an ATtiny85 microcontroller (8-pin DIP) as the USB to UART/I2C/SPI converter via V-USB, but then I learned that V-USB requires one edge driven interrupt (INT0) which inconveniently is populated by one of the SPI channels on the ATtiny. I've read that it's possible to implement V-USB with a pin change interrupt, I'll have to give that a go. Or I suppose I could upgrade to a larger microcontroller, but the next size up is I believe 14 or 16 pin.Perhaps isolating SPI is the best route to go. Fairly trivial to implement.

author: ConKbot
author_rank: Super Contributor
timestamp: August 26, 2013, 10:07:17 pm
content: A pair of optos would take care of the common ground issue with a UART. I have a RC/hobby battery charger that has an opto-isolated usb interface. Its a bus powered USB-UART chip, 2 optos, and 3 output lines (RX, TX, and gnd, but gnd is isolated from USB ground) all in a little heat-shrunk PCB.If interfacing your device with UART is easy, then adding in the optos should be fairly easy too.

author: mariush
author_rank: Super Contributor
timestamp: August 26, 2013, 10:10:41 pm
content: You should have a look at Adum3160 or Adum4160.Here's a ready made usb isolation board with adum4160 :https://www.circuitsathome.com/wp/wp-content/uploads/2010/10/USB_Isolator_r10.pdfOnly the bottom circuit is important, the one at the top is just a buck regulator to output 5v on the usb.

author: Selectech
author_rank: Regular Contributor
timestamp: August 26, 2013, 10:33:12 pm
content: I've used a few of these on projects and around the bench. Worked with everything I tried with them.http://electronics-shop.dk/usb-isolator

author: ve7xen
author_rank: Super Contributor
timestamp: August 26, 2013, 10:34:30 pm
content: The ADuM series do a bang-up job of it. However it's really overkill and relatively expensive. For this low-bandwidth application I would just have an 'earthy' board that is ground referenced and implements USB. Cross the isolation boundary with cheap optocouplers; a UART at a slow-ish baud rate is probably the easiest thing to do.You could easily use V-USB on a 'tiny45, but only with software UART (so low rate), but for this application that's probably fine. Look at AVR-CDC, they also have more featureful implementations for 'tiny2313 or a megaAVR. You can probably take it verbatim unless you want to implement your own USB device and not use the CDC class. This can probably be all through-hole if you want.Or you could just buy an FTDI chip or a Microchip MCP2200 or whatever USB-UART chip you prefer (or a dev board for same) and add the optos.

author: Harvs
author_rank: Super Contributor
timestamp: August 26, 2013, 10:48:48 pm
content: As you've already worked out, always pick the simplest interface to isolate in the chain unless there's a compelling reason not to.Check out the Si84xx series of digital isolators.http://www.digikey.com.au/product-search/en/isolators/digital-isolators/3736104?k=si84Yes they're all SMD, but for about $1 you can get a bi-directional 1Mb/s isolator that'll allow you to simply pop it in the UART lines and forget about it. No need to get your transfer speed down to a crawl.

author: radian
author_rank: Contributor
timestamp: August 27, 2013, 12:25:58 am
content: UART on the ATtiny gets a bit tricky. USI doesn't support full duplex so trying to get bi-directional communication would be tedious. I've seen those adum chips, but they are surface mount unfortunately. I'm also trying to stay away from pre-build devices/board.I would have went the FTDI route but they don't sell the chips in a DIP package. Unsurprisingly there aren't many solutions for DIP USB devices (aside from PICs, which I'm now just starting to play around with), so pairing the ATtiny + V-USB seemed like the most cost effective solution. USB to I2C/SPI/etc for around $1? Yes please.I've read up on AVR-CDC, but I went for custom drivers approach (libusb) which did the trick nicely and can be paired with PyUSB in a host application. Once I get it all up and running I'll write up a blog about it all in case anyone is interested (warning, few months down the road).

author: ve7xen
author_rank: Super Contributor
timestamp: August 27, 2013, 12:34:58 am
content: Why are you so insistent on DIP? Nobody makes that stuff anymore, so you shouldn't be surprised when you make it a requirement and you can't find a good solution. The FTDI parts aren't the easiest packages (which is why I mentioned MCP2200), but SMD isn't that difficult, and if you want to avoid it you shouldn't be averse to the idea of using breakout boards or you're cutting yourself off from most of the hardware that's out there.V-USB will probably work with SPI on 'tiny2313 if you want to do it that way, none of the standard V-USB pins interfere with SPI, though really I think the standard USB UART is the better option. Less lines to isolate and you can use anything to drive it, even a dumb terminal program, without requiring your control application.

author: lgbeno
author_rank: Frequent Contributor
timestamp: August 27, 2013, 01:56:37 am
content: Agree 100% the absolute easiest to implement is a USB to uart bridge chip with one of the silabs isolators.FT230X -> SI8421ABShould learn how to at least solder TSSOP & SOIC for some street cred. If you are really against it. Consider a cable like this and then you can find some TH opto and connector....http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf

author: radian
author_rank: Contributor
timestamp: August 27, 2013, 02:45:37 am
content: SMD is the past, through hole is the future!All jokes aside, I have nothing against SMD, I'll get there in time. I haven't made a PCB before, so I think it'll be nice to ease into it with through hole components. I'll need a bit more gear for SMD (microscope, etc). Plus, I find there's something therapeutic and ultimately satisfying about plugging in components into a breadboard and connecting them hundreds of leads in chaotic fashion. Any else?

author: free_electron
author_rank: Super Contributor
timestamp: August 27, 2013, 01:45:47 pm
content: Quote from: radian on August 27, 2013, 02:45:37 amSo is integrated circuits. Vacuum tubes are the future ! Really forward looking people actually already live in caves, wear bearskin and have reduced superfluous language to ook-ooh. They are so advanced they dont need electronics at all !Usb-ftdi/silabs/microchip uart-optocouplers-cpuChepar than the adum solution....