Not sure if current opamp module has enough gain #1

Open
synergie7 opened this Issue May 27, 2013 · 4 comments

Projects

None yet

2 participants

Hi Luke,

I'm not an expert, but I modeled the current amplifier in LTSpice and it doesn't appear to have enough gain.

You are using a 0.005 Ohm shunt resistor, so at 10A this will give you 0.05V AC on the SHUNT input to that module.

The feedback 13k / 22k loop appears to give a gain of approx 2, hence the output is 0.1V AC offset to 1.65V

But you appear to need around 1.5V AC offset at 1.65V to get decent resolution on the ADC in the micro-controller.

You appear to need to replace the 13k with something more like 330K to get enough gain.

Also. In LTSpice, the input cap C2 appears to be a bit too low to get full transfer of the voltage across the shunt.
It looks like 330n would be a more appropriate value.

And... I think you need to put something in to prevent the input of the opamp being destroyed by power spikes. (I've blown several opto isolators on mains circuits due to spikes with other equipment turning on and off).

Adding a resistor on the input to C2 may be enough (1k seems to be OK).
Or you could also have 2 back to back diodes after the resistor.

But, as I've said, I'm not an expert, so I may be talking rubbish

Owner

Thanks for the feedback.

This is a preliminary experimental design and hasn't actually been tested,
so your concerns are likely to be quite valid.

It's probably worthwhile to consider increasing the current sense resistor
a bit, maybe 10 milliohms. The limiting factor here is going to be the
power dissipation in that resistor at the highest-case load current.

Currents of 16A or so are not unusual in some high-power domestic
appliances in 120VAC countries such as the United States, and ideally I
wanted to design something for worldwide compatibility. If we suppose that
we design for 20A as the absolute maximum current, then a 10 milliohm
resistor will dissipate 4W which is probably OK.
Yes, that means you'll limit measurement resolution when measuring <10A
typical currents in a 240VAC country, but I think that's an acceptable
price to pay. You're also limiting the resolution when measuring the
voltage signal in a 110VAC country.

Basically, as you understand, the offset and gain in both the voltage and
current analog circuits (well, the divider ratio in the case of the
voltage) should be designed such that under the "maximum possible"
conditions, such as 20A in and say 260VAC in then we get waveforms into the
microcontroller's ADC that are as large as possible without clipping
outside the microcontroller's usable measurement range.

There is also an issue with the capacitive-dropper transformerless power
supply... it's just not practical for this sort of application where we're
trying to supply 100mA or so to run the relay coil, the XBee module (which
is quite a power-inefficient device) and the AVR simultaneously. If you try
and build it you'll likely find that the R14 input resistor in the RC
dropper power supply circuit just has way too much power dissipation and
heat. I think replacing it with a non-isolated high voltage buck switcher
such as the Power Integrations LNK306 is the way to go.

On Mon, May 27, 2013 at 11:14 AM, Roger Clark notifications@github.comwrote:

Hi Luke,

I'm not an expert, but I modeled the current amplifier in LTSpice and it
doesn't appear to have enough gain.

You are using a 0.005 Ohm shunt resistor, so at 10A this will give you
0.05V AC on the SHUNT input to that module.

The feedback 13k / 22k loop appears to give a gain of approx 2, hence the
output is 0.1V AC offset to 1.65V

But you appear to need around 1.5V AC offset at 1.65V to get decent
resolution on the ADC in the micro-controller.

You appear to need to replace the 13k with something more like 330K to get
enough gain.

Also. In LTSpice, the input cap C2 appears to be a bit too low to get full
transfer of the voltage across the shunt.
It looks like 330n would be a more appropriate value.

And... I think you need to put something in to prevent the input of the
opamp being destroyed by power spikes. (I've blown several opto isolators
on mains circuits due to spikes with other equipment turning on and off).

Adding a resistor on the input to C2 may be enough (1k seems to be OK).
Or you could also have 2 back to back diodes after the resistor.

But, as I've said, I'm not an expert, so I may be talking rubbish


Reply to this email directly or view it on GitHubhttps://github.com/lukeweston/SEGPlug/issues/1
.

This email is intended only for the personal and confidential use of the
human(s) named above. If intercepted by an extraterrestrial civilization,
all opinions expressed in this email are my own and do not necessarily
reflect the opinion of mankind as a whole.

Hi Luke,

OK. I hadn't considered 110V e.g US and possibly Japan (which I think can be even lower)

I'm actually going to build the current detector and have bought some 10 milli Ohm resistors (from Jaycar).

So I was going to use different values for the feedback side of the opamp - probably 27k for the voltage divider and 180k for the negative feedback resistor.

I'd also considered the transformerless PSU, as there are issues with using this with the new EU directive on standby power, which now needs to be max 1W and most transformeless units take 2W or 3W due to their inefficiency.

Hence for my tests I'm going to use the internals of a 5V USB switch mode charger.
I've not tested it yet, and it may short out, but I think its probably the best way forward.

BTW. I'm not using an XBee either, I'm using a RFM12B at the moment but I'm hoping to switch to Bluetooth 4.0 Low Energy as soon as the open source designs of PCB with antenna become available.

FYI. I'm well aware of the dangers of working with 240V and switch mode PSU's etc ;-)

Owner

Great, sounds really cool, let me know how you go :)

Hi Luke,

I thought I'd give you an update on whether the circuit worked.

Unfortunately, I couldn't get reliable readings for current, from the Arduino.
I've used the Open Energy Monitor code to read both the voltage and current inputs, and then transmitted the values via the RFM12B to another Arduino (as I can't physically attach USB to the ATMega328 as the whole thing is at mains potential).

At the moment I've had to stop because I don't have any way to work out why this is occurring. I strongly suspect that its a problem of noise, being amplified by the opamp. This could be supply noise from my switching 5v (USB) PSU, that I modified to output 3.3V, or possibly mains borne noise.

I'll need to get hold of a fairly substantial isolating transformer so that I can connect my scope to the inputs to the ATMega to see whats happening, but don't have the $ spare to spend on this project at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment