# Voltage Isolation Help, Please

1. Feb 27, 2012

### msj08

Hi, I am trying to design a circuit to keep my microcontroller safe from any sudden voltage spikes. Here is a picture of my circuit. The ac source on the left represents the Ac main voltage from the house @ 120V 60Hz stepped down to 2.5v 60Hz. The 28k resistor on the right represents the internal resistance of the microcontroller.The maximum voltage into the adc would be 10V in the μA current range.

The purpose of this circuit is to have the microcontroller read in the voltages with its onboard adc.

Right now, i am not exactly sure what the "correct" output waveform from the opto would be. I was expecting a sine wave at both the emitter and collector. The Blue waveform is Voltage taken at the emitter, green at the collector, and the sine wave is taken at the source.

Can someone please comment on my circuit design/outputs and suggest ways to make this a viable solution? Any suggestions are welcome! I am an undergrad with much still to learn! Thank You.

2. Feb 27, 2012

### vk6kro

The bias conditions seem to be wrong for these components.

If you go to the "edit simulation cmd" section and choose "DC sweep", you can sweep V1 and determine the correct DC offset for it by looking for the linear area in the graph. Sweep from -20 V to +20 V in 0.1 V steps.

The DC offset is set in the properties of V1 which you get to by right clicking on the component (as you did to set up the sinewave).

I notice that your opamp seems to have a protective diode in it across the LED, and this may explain the half wave rectifying effect.

Your micro would probably need 0 to 5 volts as its input, so that negative supply might produce negative output unless you set up the bias correctly.

3. Feb 28, 2012

### jim hardy

Note output frequency is double input frequency, as if signal were full wave rectified.

Note collector and emitter are both at supply rails in vicinity of input zero crossing.

Circuit is doing just what it should - transferring current from whichever of its input LED's is forward biased to output phototransistor. When input is too near zero to make either LED conduct no transfer occurs, of course.

Are you trying to use the optoisolator as a linear device that reproduces your input signal? You might get away with it by reducing input drive and adding some DC bias so you're only using one of the input LED's .

However, what you have looks to be reproducing the peaks better than i would have imagined it could. Just it inverts half of them.

I learned something here - thanks !

4. Feb 29, 2012

### msj08

Thanks Vk6 and Jim for the responses. We were able to come up with a solution through adjusting the DC offset and bias, thanks to your suggestions.

5. Feb 29, 2012

### jim hardy

Would be interesting to apply a triangle wave drive and see what kind of linearity the thing has...

6. Mar 4, 2012

### Mike_In_Plano

Opto-isolators are inconsistent, sensitive to temperature, and age. Thus, they are not well suited for communicating precision analog signals.
There is a category of off-the-shelf amplifiers that are suited to this task: Isolation Amplifiers. Generally, you also need a 2kv isolated DC-DC converter to power the AC supply. Ti, Analog Devices, and Linear Technology are good places to hunt for this type part.
Transformers are an easier way of obtaining voltage and current readings without hazard. Cheap voltage transformers do tend to distort the waveform, but one made to rectify from 230V will be less prone to error at 120 (air conditioners often use 230V - 24V).
Current transformers are also straightforward. They perform better with lower output voltage (lower output load resistor), which means you'd probably want an op amp to produce a useable signal level.

Best of luck,

- Mike

7. Mar 4, 2012

### cmb

Why the opto? Why not just read this stepped down 2.5VAC and put a, say, 3.3V TVS across it? I presume that'll keep your micro safe?

Sorry, I don't understand the problem you seem to feel needs solving.

8. Mar 4, 2012

### Mike_In_Plano

Bad, bad, very bad idea to connect to AC directly. UL devotes entire chapters on ways to NOT do this, and the NEC would never accept it either. People get hurt this way and equipment gets destroyed.

9. Mar 5, 2012

### cmb

I was assuming a 'stepped down' 2.5V would have gone through a transformer, so no direct connection (else I'd have expected to read '2.5V from a voltage divider - is there any other way)?

Well, if not through a transformer, then that'd be the better way for isolation - use a small transformer with a 'dumb' resistive load (and the TVS) on the other side. I am not at all convinced an opto isolator is likely to give any particularly useful discrimination of voltage applied to the internal LEDs.

10. Mar 5, 2012

### Mike_In_Plano

Sorry, cmb. I'm becoming more impulsive in my old age...