Arduino read AC mains, using opam

Status
Not open for further replies.
Hi i have been reading the site for a while now, and today signed up and ready to learn.

So Im doing a control board for refrigeration units. (Currently Im an refrigeration dude)
An for start i like to use an Arduino to read out the Main voltage, and the current being used
by the refrigeration unit.


Im aware of the fact the current reading need split core trasformers, so rigth now Im focusing
on the voltage meter. I google some solution on the web and came this:

**broken link removed**





according to the squematic this will decresee the AC voltage by a factor (given by the Rf/Ri ratio)
and sum to the half of the Vcc (5v/2 = 2.5v)

So, I assume: Rf = 10Kohm
Ri = 100Kohm
Vcc = 5Vcd

An I got 10.2V(ac) ... I know there is above the 5V analog read, but I just want to know how this is
working, so I draw it on proteus... and here come the weird part.

(circuit on Proteus and oscilloscope)



I dont know if I miss something here, I was imagin the ouptu signal will be center at 2.5V and from there will measure
10.2 peak to peak... but on a sinusoidal wave... Instead this is whath came up:




I got some questions:
1.-¿Is correct to assume an sinusoidal wave of small longitud on this circuit? or this is regular operation?
2.- There was no part number on the site, so maybe the Opam is wrong selected on my simulation?
3.- ¿ Any idea whath is going on here?


Thanks in advance for the colaboration.
Kind regards.

Alejandro.
 
So far, you have only tried the simulation, correct? What opamp model are you using ( I cant read the screen dump you posted)?

Are you aware that reading AC line voltage into an Arduino board is intrinsically unsafe; one slip can kill you?
 
Currently Im an refrigeration dude
cool!

1) The output of a op-amp can not get higher than VCC and lower than ground. Actually the outputs do not do well near the power supply pin's voltage.
2) You are over driving the output.

Here I set the gain of the op-amp to one. (-)pin connected to (out) pin
The two 4k resistors look like a 2k resistor connected to 2.5 volts.
I chose resistor values to make thinking easy.
-At 110vac the peak voltage will be near 160 volts so 160k ohms for 160 volts. "easy"
-The (two 4k resistors) is 2k ohms so there will be about 2v peak.
So:
0V on the power line =2.5V
160V=4.5V (2.5+2)
-160V=.5V (2.5-2)

The resistors make a voltage divider to get the voltage down to a safe level.
Divider is 160k/(4k//4k) or 160/2k at 2.5V
 
So far, you have only tried the simulation, correct? What opamp model are you using ( I cant read the screen dump you posted)?

Are you aware that reading AC line voltage into an Arduino board is intrinsically unsafe; one slip can kill you?

Hi Mike, thanks for answering... yes mains AV voltages are dangerous, but as many things are necesary.

The Opam I was using in the simulation was the LM 14 58... I gues it was bad selection also.. thanks for pointting out! ..

Kind Regards.

Alejandro.
 

First from all... thank you!

And yes... yesterday precisly I was watching some videotutorial of opams, and this caracteristic is
clearly pointed out... They can reach neither the positive or negative supply voltage.

Know I got some questions regarding your design, well among others... I just want to be pointted
in the rigth direction to learn the basic theory.




Here is the same circuit, using the Lm 188 as you intended. (This opam got a 70V rating)
The power supply is 127VAC and I put the resistors as you desing.

I got this screen capture from the scope:


For the litte I know... I got the chanel A as Ac input measuring the 127V and we got a nice sinusoidal wave.

Know as for the output... The probe is in the output of the OPAM, and is also an AC input... but the range
for the measurement is 2mV



In this capture Im measuring the input of the opam, on the chanel B, AC and its the same wave but is on
the rangue of 0.5V.

I think the circuit is working as intended, but perhaps, Im miss interpretating the results:


The questions;

1.- I do understand the refrence voltage of 2.5V across the voltage divider, to "mount" on it the more small
sinusoidal wave thath came out of the reduced tension trougth the 160K resistor...
And I understand the gain of the OPAM is 1... as a voltage follower (I think)

But this will no result in the wave of the probe B, being center around 2.5V and around 4.5V and 0.5V peak to peak? ... why this is
making an sinusoidal wave resulting around +-1mV ... When the input is around 1V ???

2.- I make a second measure on the input and output of the resistor 160K... and was around 127VAC In as expected
and 1VAC Out... ¿ How you determine with so much precision the voltage loss on this resistor?



I can make the math of the simple 5 to 2.5 vt divider, But I can see or uderstant how this becomes
160/ ( 4//4) (Witch is 80k rigth?)
So the current going in to the opam is 2mA Rigth?

Is this solved using kirchhoff ?

4.- In proteous this opam got some more ports than yours.... hope this is not doing weird stuff with simulation.


Thank you in advance !!!

I really am trying to understand the theory of operation, not just an a circuit I can build without
know whath is going on.
 

Attachments

  • upload_2014-1-25_14-45-4.png
    431.4 KB · Views: 346
For safety's sake use a transformer to get a low AC voltage representing the mains input. Otherwise, failure of the resistive divider could result in the whole circuit being at/near mains potential and hence dangerous.
 
Please use pin 7 as the +5V.
Please do not use pin 8.


I changue the pins as you indicated...




And is working more like it was intended but its seems to being trimming some of the peak of the signal...

Im missing something?
On tis case the output on the channel C its seems to be 1Vpp



I changue the component for an ua741 (I just google an general propuse OPAM)

An this is the output on the scope:



It seems not being clipping more... yet the output of the OPAM is just around 3Vpp (sorry I dont know how to
accurately measure on this softwawe), the input od the OPAM is around 3Vpp.

So its about 1.5V less than expected.... Is something about the Loss on the OPAM or Im missing on the conections?

Thank You Again. !!!!
 

Input A 125 volts pk. 20V/div AC coupled.
Input B 1.5V pk 1V/div AC coupled.
Input C 1.5V pk 0.5V/div AC coupled.

B and C are the same voltage.
AC line voltage is more like 155V pk. 110 rms. Increasing the input will get you a output of 1.86V. If you want a different voltage change the resistors.
Channels B and C are AC coupled. If you set the scope to DC you will see they are off set by 2.5V.
If you want more output choose a R-R opamp. ( some parts are R-R input and R-R output. ) R-R means rail to rail. The input or output can work from 0 to 5 volts. The 741 is OK but not R-R.
 
This still looks incredibly dangerous! You really should have some kind of isolation between mains and your ELV circuit.

Take a look at this open source energy monitor, they use Arduino to measure mains current / voltage in a safe way. You should take inspiration from this site. https://openenergymonitor.org/emon/
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…