Author Topic: Options for isolating SPI bus  (Read 5115 times)

0 Members and 1 Guest are viewing this topic.

Offline bitshiftTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: za
  • Too much to learn, too little time
Options for isolating SPI bus
« on: September 11, 2015, 11:37:23 am »
Hey guys,

I have a circuit that measures mains voltages using a resistor divider into an ADC. The SPI bus from the ADC needs to be isolated from the microcontroller. One way to do this is to use expensive high speed optocouplers.

Are there any other options for isolating the ADC?
« Last Edit: September 11, 2015, 11:43:36 am by bitshift »
"It’s all fun and games until an innocent opamp gets hurt!" - Dave Jones
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7388
  • Country: nl
  • Current job: ATEX product design
Re: Options for isolating SPI bus
« Reply #1 on: September 11, 2015, 11:42:37 am »
Digital isolators from AD/TI/Silicon labs. Be careful with the propagation delay.
Or put a micro on the ADC side, and you can push through data on a single channel isolation.
 

Offline kony

  • Regular Contributor
  • *
  • Posts: 242
  • Country: cz
Re: Options for isolating SPI bus
« Reply #2 on: September 11, 2015, 12:43:35 pm »
Alternative is sigma-delta modulator and optocoupler, somtetimes integrated in one package such as this one: http://www.avagotech.com/products/optocouplers/industrial-plastic/isolation-amplifiers-modulators/sigma-delta-modulators/acpl-c797. Plenty other manufacturers make them too.

Only downside is, that MCU side processing is not as trivial as reading out a register (but not that much harder anyway).
 

Offline bitshiftTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: za
  • Too much to learn, too little time
Re: Options for isolating SPI bus
« Reply #3 on: September 12, 2015, 02:57:30 pm »
Thanks for the suggestions  :-+ Now to do some learning and figure out which option will be best
"It’s all fun and games until an innocent opamp gets hurt!" - Dave Jones
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: Options for isolating SPI bus
« Reply #4 on: September 12, 2015, 09:41:23 pm »
Hey guys,

I have a circuit that measures mains voltages using a resistor divider into an ADC. The SPI bus from the ADC needs to be isolated from the microcontroller. One way to do this is to use expensive high speed optocouplers.

Do you need to run the SPI bus at high clock speeds?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Options for isolating SPI bus
« Reply #5 on: September 12, 2015, 11:26:13 pm »
If it's not medical, you might consider simply using larger resistors.

I believe resistors over a few megs draw little enough ground current that it can be considered galvanically safe.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline obiwanjacobi

  • Frequent Contributor
  • **
  • Posts: 988
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Options for isolating SPI bus
« Reply #6 on: September 13, 2015, 05:28:42 am »
Why not isolate the mains with a good 1:1 transformer? You hardly need any current, so it can be small...
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline bitshiftTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: za
  • Too much to learn, too little time
Re: Options for isolating SPI bus
« Reply #7 on: September 13, 2015, 06:10:32 am »
Do you need to run the SPI bus at high clock speeds?

Not really, 1Mhz will be acceptable.

If it's not medical, you might consider simply using larger resistors.

I believe resistors over a few megs draw little enough ground current that it can be considered galvanically safe.

Tim

It's not medical, its for a small device that measures the mains. I would just like to prevent a surge from making it through to the micro and attached LCD/buttons. Would this method involve just putting large resistors in series between the ADC and micro?

Why not isolate the mains with a good 1:1 transformer? You hardly need any current, so it can be small...


To what extend could this affect the voltage measurement?
"It’s all fun and games until an innocent opamp gets hurt!" - Dave Jones
 

Offline krish2487

  • Frequent Contributor
  • **
  • Posts: 500
  • Country: dk
Re: Options for isolating SPI bus
« Reply #8 on: September 13, 2015, 06:50:30 am »
Or to add to what obiwanjacobi suggested.


Use a step down transformer such that 230 on mains == 3.3/5V or whatever on the secondary.
Then you can be a little cavalier on the requirements of the isolation, since the ADC never sees high voltage.
Any opto should to.


Basically replace the resistor divider network with a step-down isolation transformer of the same voltage scaling ratio.

If god made us in his image,
and we are this stupid
then....
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Options for isolating SPI bus
« Reply #9 on: September 13, 2015, 07:12:56 am »
One rub for the transformer isolation method is, you want a part with particularly high inductance (low magnetizing current) and low winding resistance.  Leakage should be low as well.

What's so hard about that?  Essentially all the small (< 10 VA?) transformers are bank wound construction, which have very high leakage; they're also made with high resistance.  This allows them to have shitty regulation (20% for the better ones) and short circuit tolerance (impedance limited, class 2 safety or whatever).  The efficiency is poor, but in the small size, it doesn't matter much.

A proper potential transformer, if you can find one, has all these characteristics in the right range, and rated in the datasheet.  But expect to pay for it.

PTs and CTs are most common for industrial application, so you may even have a hard time finding one small enough.  CTs at least are useful enough on their own to be available for smaller applications at reasonable prices (under $5 for something like the present application, I think).

When you measure the line with resistors, you do need a sufficient voltage capacity, yes.  This can be afforded by stacking several resistors in series, or using higher power rated parts.  I'd recommend using two 0.5W or 1W through-hole parts (per side), or three or more SMT chip resistors (preferably 1206, but 0805 have pretty much the same voltage rating).

Curiously, resistors down to 0603 are available with surprising voltage ratings (up to 10kV).  But they can only be used in potted assemblies, as you might guess.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline bitshiftTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: za
  • Too much to learn, too little time
Re: Options for isolating SPI bus
« Reply #10 on: September 13, 2015, 07:47:35 am »
I think my understanding of why it's a good idea to isolate is dodgy. I'm going to take a step back, please bear with me. I'm designing a wattmeter based off of this schematic.

What safety issues are being dealt with by having the isolated analog and digital sections?
"It’s all fun and games until an innocent opamp gets hurt!" - Dave Jones
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Options for isolating SPI bus
« Reply #11 on: September 13, 2015, 08:15:11 am »
Well if it goes nowhere (there's no external connector or interface indicated), absolutely none of that nonsense is even needed; it can all be line referenced, in which case a single ended measurement is sufficient for voltage (which is essentially what they're doing, as the CH1 input is referenced to a fixed voltage reference, not a true differential input -- the pair of 1M resistors ensures the AGND section will be floating at some fraction of line voltage), and a shunt resistor can be used for current (no CT needed at all!).  Which is what almost all of them do, because it's cheap.

If you want the option for connecting programmers/interfaces/etc. to it, you'll need isolation, but it may be worth considering isolation on those instead.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Rolo

  • Regular Contributor
  • *
  • Posts: 206
  • Country: nl
Re: Options for isolating SPI bus
« Reply #12 on: September 13, 2015, 09:04:55 am »
I'm using this optical SPI interface to control a switching powersupply. It has common, low cost parts. I'ts based on an application note from Freescale Semiconductor to isolate the programming interface for microcontrollers. I do not know the maximum speed, but the specs from the optocouplers should give an indication. It will do 1 Mhz I think.



 

Offline bitshiftTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: za
  • Too much to learn, too little time
Re: Options for isolating SPI bus
« Reply #13 on: September 13, 2015, 11:22:17 am »
Well if it goes nowhere (there's no external connector or interface indicated), absolutely none of that nonsense is even needed; it can all be line referenced, in which case a single ended measurement is sufficient for voltage (which is essentially what they're doing, as the CH1 input is referenced to a fixed voltage reference, not a true differential input -- the pair of 1M resistors ensures the AGND section will be floating at some fraction of line voltage), and a shunt resistor can be used for current (no CT needed at all!).  Which is what almost all of them do, because it's cheap.

If you want the option for connecting programmers/interfaces/etc. to it, you'll need isolation, but it may be worth considering isolation on those instead.

Tim

Thanks for the explanation  :) In light of this I'm going to skip the isolation as nothing will be connected to it while the device is on. Just for educational purposes, if you did say have a USB interface, how would the isolation actually protect you?
"It’s all fun and games until an innocent opamp gets hurt!" - Dave Jones
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Options for isolating SPI bus
« Reply #14 on: September 14, 2015, 12:41:52 am »
USB is a grounded protocol and must have the shield, ground, supply and data pins all referenced to both circuit grounds (directly connected, in the case of shield and ground).  So for dongles (e.g., a plug in flash drive), it's a matter of safety (the ground shield could be touched by fingers).  For computers, it's basic functional necessity (if the machine is grounded, what happens when you plug it into a mains-referenced USB shield? ;) ).

Traditional 2500VAC (3750 peak) isolation is then required.  If the isolated side is safety grounded, basic type insulation can be used.  If not, reinforced is necessary.  (Basic vs. reinforced refers to the number of layers of insulation between conductors.  Reinforced requires at least two layers, so that partial failure cannot expose a user to mains voltage.)  In the above example, mains frequency transformers provide isolation (which should always be reinforced, for this type of product); normally, a small SMPS (with reinforced insulation in the transformer) would serve this purpose, or a DC-DC converter module with similar ratings.

Noteworthy that Ethernet is a data protocol that IS isolated: but, it's only designed to withstand ground loop, modest transients, and ESD.  With a 1500V rating (and typically functional or basic insulation), it is insufficient to provide mains isolation. 

Isolation example: http://www.haloelectronics.com/products/lan/ethernet/discrete-transformers/10base-t/
I should imagine a 100BASE-T version is possible, but geez, this is already about the only thing that shows up in a search.  I expect this kind of part is a very rare thing indeed.

Tim
« Last Edit: September 14, 2015, 12:48:29 am by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Options for isolating SPI bus
« Reply #15 on: September 14, 2015, 05:44:32 am »
In light of this I'm going to skip the isolation as nothing will be connected to it while the device is on.
Your debugger?
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Options for isolating SPI bus
« Reply #16 on: September 14, 2015, 05:53:52 am »
For a similar project, I used a ADUM3481 (or similar) magnetic isolator for the SPI protocol, and and ADUM6000 series to power the hot side. Very elegant looking, but fairly expensive.

The returning signal was significantly phase shifted on the way back, but nothing that couldn't be fixed by changing the CPOL/CPHA settings on the MCU's SPI peripherial.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf