# Using Op-Amp for attenuation to give input to sound card

I want to do analysis of main voltages(220/50Hz) in MATLAB. I want to visualize the harmonics and the change of the wave effect with Inductive and capacitance load. I have expeience in Digital electronics and little knowledge of analogue electronics.

I looked for this circuit from xoscope but this circuit is made for voltages less then 150 volts. I want to attenuate 220 voltages

is it possible? What would be the possible solution for this type of problem. How op-amp can help me in this problem?

and what are the maximum output voltage limitation to give input to sound card? I think max 1 volt but what are possible ranges? -1 to 1 or 0 to 1? I am little confused and fear to test with my sound card without authentic suggestion. Is there some good tutorial or some recomended study material with precisely bound to this topic?

This question may seem basic but I am asking this because I am not sure about my experience of sound card and I cannot afford to burn my sound card with making some circuit which I do not know what it does. Thanks

• Appropriate input level for sound cards: electronics.stackexchange.com/questions/76010/… Someone else will have to help you with the buffer, though I expect that a modification of the circuit you linked to would work - might even be OK as is, but wait for someone with more experience with power line voltages to give you some pointers.
– JRE
Nov 20, 2014 at 14:06
• The circuit you linked is not an attenuator at all, it's a x1/x10 amplifier. Its inputs are protected to withstand +/-150V, but it can't measure such voltages. Nov 20, 2014 at 14:24
• @JRE Thanks for your quick reply. I am also wondering does the diods in the circuit I linked will clip my input wave? as most back to back doiodes do. If so then how would I be able to get full wave? and If not then why are they used? Nov 20, 2014 at 14:25
• @DaveTweed if it is not the case then how can that circuit be used for sound card oscilloscope? oscilloscopes are supposed to measure power line voltages as well. I am very confused about the point to start. Thanks Nov 20, 2014 at 14:28
• @DaveTweed axplained it. The diodes clip the signal if the voltage is too high. Seems it isn't an attenuator at all, but rather a circuit to protect your sound card fromm over voltage. You would also need an attenuator as Olin Lathrop says.
– JRE
Nov 20, 2014 at 14:29

All you need is a resistor divider. You have ±310 V and want to get that down to around ±1 V. You therefore want to attenuate by about 300 in voltage. A 30 kΩ resistor in series with the power line and 100 Ω to ground should do it theoretically.

However, you also need to look at some real world issues. 100 Ω is a good value for the second resistor because that will basically be the output impedance of the divider. If you decide to pick that, then the other resistor needs to be around 30 kΩ. That by itself is not a problem, but you can't just solder down a 0805 30 kΩ resistor.

First, consider the power dissipation in that resistor. (220 V)²(30 kΩ) = 1.6 W. That would require a "2 W" power resistor. Another issue is the voltage standoff capability of the resistor. It will have to be able to handle peaks up to 310 V, so should be rated for 350 or 400 V.

One way to achieve this is to put several smaller resistors in series. That both spreads out the power dissipation and reduces the voltage across each. Three "1 W" 10 kΩ resistor rated for 150 V or more in series will do nicely.

Keep in mind that the input to this circuit will have lethal voltages. Make sure that this divider is well insulated. For example, you could put all the resistor at the end of a line cord with only the attenuated output coming out, then wrap everything in layers of electrical tape.

• This is one solution to this problem but not practical. Obviously first point that comes to mind is to use a voltage divider but this is not the case here. AS this input has to be supplied to computer's Sound card. so to use just a simple divider could be very harm and also could generate extra noice(may be) As my main point is to make this circuit is for power line noise analysis so it will not be the case in just using simple voltage divier Nov 20, 2014 at 14:33
• Also I am looking for best solution for this type of problem. and also as question sugest to use Op-amp as an attenuator. Nov 20, 2014 at 14:38
• @Abdul: None of the reasons you give against using a voltage divider make any sense. You have to make sure the grounds are connected correctly, but there is no reason the result can't be connected to the sound card line input. You say it would cause harm, but give no justification for that. Nov 20, 2014 at 14:40

You should use an isolation amplifier or a potential transformer for this kind of application. For an isolation amplifier you may need a (safely) mains-isolated supply (some modules have a DC-DC converter built-in) and a voltage divider on the input. You might need a divider on the output for optimal accuracy.

For a potential transformer you'll need a voltage divider on the output to get proper sound card levels.

The optimum design would depend on the specifications (accuracy, bandwidth) and expected production volume.

The circuit should be hi-pot tested for breakdown voltage to ensure safety (of people and of the computer it's connected to). Connecting the mains directly to a sound card (inadvertently or deliberately) is liable to lead to a smoking charred motherboard, even if differential voltage is divided down because one side of the PC should be grounded, and if it isn't (some laptops) then it could kill if someone touches (say) an ethernet port shield or other piece of metal that is connected to chassis ground on the PC.

• Thank you so much. That was the points which were not clear in my mind. could you please also refer me to some isolation amplifier circuits Nov 20, 2014 at 21:46
• Try parametric search at Digikey- you an find ones from a few dollars up to \$200 or so, depending on what you need. HP (now Avago) has some inexpensive ones that require a DC-DC converter as well. Nov 20, 2014 at 21:48