Options for isolating SPI bus - Page 1
Forum section: electronics / beginners

author: bitshift
author_rank: Regular Contributor
timestamp: September 11, 2015, 11:37:23 am
content: 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?

author: tszaboo
author_rank: Super Contributor
timestamp: September 11, 2015, 11:42:37 am
content: 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.

author: kony
author_rank: Regular Contributor
timestamp: September 11, 2015, 12:43:35 pm
content: 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).

author: bitshift
author_rank: Regular Contributor
timestamp: September 12, 2015, 02:57:30 pm
content: Thanks for the suggestionsNow to do some learning and figure out which option will be best

author: mikerj
author_rank: Super Contributor
timestamp: September 12, 2015, 09:41:23 pm
content: Quote from: bitshift on September 11, 2015, 11:37:23 amDo you need to run the SPI bus at high clock speeds?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 12, 2015, 11:26:13 pm
content: 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

author: obiwanjacobi
author_rank: Super Contributor
timestamp: September 13, 2015, 05:28:42 am
content: Why not isolate the mains with a good 1:1 transformer? You hardly need any current, so it can be small...

author: bitshift
author_rank: Regular Contributor
timestamp: September 13, 2015, 06:10:32 am
content: Quote from: mikerj on September 12, 2015, 09:41:23 pmNot really, 1Mhz will be acceptable.Quote from: T3sl4co1l on September 12, 2015, 11:26:13 pmIt'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?Quote from: obiwanjacobi on September 13, 2015, 05:28:42 amTo what extend could this affect the voltage measurement?

author: krish2487
author_rank: Frequent Contributor
timestamp: September 13, 2015, 06:50:30 am
content: 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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 13, 2015, 07:12:56 am
content: 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

author: bitshift
author_rank: Regular Contributor
timestamp: September 13, 2015, 07:47:35 am
content: 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 ofthisschematic.What safety issues are being dealt with by having the isolated analog and digital sections?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 13, 2015, 08:15:11 am
content: 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

author: Rolo
author_rank: Regular Contributor
timestamp: September 13, 2015, 09:04:55 am
content: 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.

author: bitshift
author_rank: Regular Contributor
timestamp: September 13, 2015, 11:22:17 am
content: Quote from: T3sl4co1l on September 13, 2015, 08:15:11 amThanks for the explanationIn 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?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 14, 2015, 12:41:52 am
content: 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

author: Jeroen3
author_rank: Super Contributor
timestamp: September 14, 2015, 05:44:32 am
content: Quote from: bitshift on September 13, 2015, 11:22:17 amYour debugger?

author: rs20
author_rank: Super Contributor
timestamp: September 14, 2015, 05:53:52 am
content: 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.