Hi,
I have built this monitor energy with arduino uno, ct sensor (ECS1030-L72) and AC/AC adaptor (input:230V 50Hz ; Output:9V 528mA).
Electrical specificatons ECS1030-L72:
Rated Primary Current(Amp.) 50/60Hz : 30nom(1~60A max)
Turnn ratio : Np:Ns=1:2000
Current Ratio : 30A/15mA
I set burden resistor to 120 ohm. I set the current calibration constant to 17 and the voltage constant calibration to 213. Is it correct?
If I connect light loads (for example 60 Watt) I get strange values, like:
realPower:-25.56 apparentPower:25.66 powerFactor:155.02 rmsVoltage:0.17 rmsCurrent:-1.00.
In theory I should find a real power about equals to 60W, right? Where am I doing wrong?
Regards
Re: Arduino energy monitor: strange output values
You don't say what software you are using, nor the value of the voltage divider. Though your constants don't look far out, read through this page http://openenergymonitor.org/emon/buildingblocks/ct-and-ac-power-adaptor... which tells you exactly how to calculate your calibration constants.
You could be saturating your c.t. I've no idea what the maximum voltage is before distortion sets in, but that is what will happen if the burden resistance is too great (though I would not expect to see that problem with a 60 W load). A big clue is the test burden on the data sheet: 10 Ohms.
You could also, if your grounding and decoupling is not good, be picking up digital noise from the processor and reading that superimposed on the real current signal from your c.t. It seems likely that this is what you are seeing, and the numbers should be more accurate as the power increases. Is this the case, and what does a 6 kW load look like?
Re: Arduino energy monitor: strange output values
I'm sorry. I'm using EmonLib library and i'm following the "How to build an Arduino energy monitor" project.
I built the electric circuit with the values indicated in the project. In the current sensing circuit, I used 2 x 10 KOhm resistors for voltage divider.
Now, I have changed the burden resistor to 10 ohms and I recalculated the calibration constant values according to the formulas in the project:
voltage constant = 230 * 10 / (9+20%) = 213
current constant = (30/ 0.015) / 10 = 200
In this way, I get the following values:
Measurement circuit with light ON (60 Watt): (realPower | apparentPower | powerFactor | rmsVoltage | rmsCurrent)
100.20 124.56 238.94 0.52 0.80
97.59 121.19 237.80 0.51 0.81
100.69 123.25 237.91 0.52 0.82
99.92 124.50 237.62 0.52 0.80
Measurement circuit with light OFF:
42.93 118.80 238.25 0.50 0.36
46.06 117.63 238.33 0.49 0.39
47.99 118.05 238.34 0.50 0.41
41.09 118.84 238.03 0.50 0.35
The difference of real power between light on and light off is about 60 Watt, but I don't understand I get high values when light is off.
I'll try with heavier loads.
Re: Arduino energy monitor: strange output values
Your value names are not consistent with the numbers.
Your results are in this order.
realPower | apparentPower | rmsVoltage | rmsCurrent | powerFactor
Re: Arduino energy monitor: strange output values
The clue is the lousy power factor when under no load. I think it's almost certain you have pick-up from somewhere going into your current input. The voltage you are looking for is only about 1 mV rms (or 15 mV with your original burden) so it's actually less than 1 count peak-peak at the Arduino input. What do you expect? Take a look at this: Measurement implications of ADC resolution at low current values
If you are only interested in measuring small loads, I suggest you go back to your original burden but expect errors at large loads. If you want accuracy at large loads, you'll have to accept the limitation that you can't read small loads with any degree of accuracy. It comes down to this: the ADC can resolve 1024 counts spread over 5 V, and you need about 10 counts peak-peak for reasonable accuracy. By choosing a c.t. with (apparently - it needs to be measured) a maximum output voltage of 300 mV for the specified performance, you've severely limited your range.
There are ways out of this: my first choice would be to put an amplifier with a gain of about 5 between the c.t and the Arduino (You need to carefully calculate what gain you need - at the maximum current you want to measure, you want just under 5 V peak-peak at the analogue input of the Arduino. I think the LMV358 is suitable).
Re: Arduino energy monitor: strange output values
I have to measuring the load my house, that doesn't exceed 3 KWatt. According to you, the optimal solution is to use a amplifier or to choise a different ct sensor?
Re: Arduino energy monitor: strange output values
The standard c.t. is sized to be capable of reading approximately the maximum current that the normal UK domestic supply is rated. The ADC in the processor has 10 bit resolution, so that inherently sets a lower limit on the current that can be accurately measured. If you increase the burden resistance, the power needed is greater than the c.t can supply and it saturates, leading to waveform distortion. If you can source a split-core c.t. capable of around 1.1 V output (for the emonTx) or a little more for a 5 V Arduino at whatever secondary current it gives you with 12.5 A in the primary, then that is the ideal component to use and you won't need an amplifier. But I've not yet found such a beast and so an amplifier seems to be the most sensible way forward. It is the solution adopted by ATmel in their app.note, on which everything round here is largely based.
Re: Arduino energy monitor: strange output values
Thank you very much for the help.
I'm using a amplifier (LM833N) with a gain of 5 between the c.t and the input pin of Arduino, but I get a real power low. I think of getting something wrong. Does the amplifier influence on calibration constant? If so, how?
Another question...the parameter "phase shift" (EmonLib library), that in arduino monitor project is set to 1.7, how do I have to calculate it?
Regards
Re: Arduino energy monitor: strange output values
Yes, the amplifier will of course affect the calibration. I suggest you read up on the theory, and it should become clear (in effect, you'll have multiplied the burden resistor by the amplifier gain).
One caveat: you might find the output swing of that op.amp. is a restriction. There are more suitable devices available (e.g. LMV358).
If you know the phase shift of your voltage reference and your c.t. then calculation is possible. However, by far the easiest way is arrange a purely resistive load and change the number until power factor reads 1.00 (and then of course realPower and apparentPower will be the same). Explanation of the phase correction algorithm might help you - when you've found what those phase shifts are (and that could be quite difficult unless you are using the standard Mascot adapter and YHDC c.t., in which case read those test reports.
If you change it by a large amount, you might want to recheck your voltage calibration (it's not an iterative process).
Calypso_rae has raised concerns about the algorithm and its effect on the shape of the wave, and suggests that if the factor is outside the range 0 - 1, the order in which voltage and current are read should be switched, and if that does not suffice, then one or other value should be delayed by one or more readings.
Re: Arduino energy monitor: strange output values
Hi Robert,
I tried to connect a amplifier with a gain of about 5 between the c.t and the Arduino, recalculating the calibration too, but it doesn't work because I believe the amplified voltage is saturate. In the amplifier enters an AC input voltage of 300 mV peak-peak translated on DC voltage of 2.5 V given by voltage divider (2 x 10 KOhm resistors). If the amplifier amplifies both the component (DC+AC voltage) of input signal, I get an output voltage that exceeds 5 V. Is reasoning correct?
So, I tried to modify the voltage divider resistor to bring the DC voltage a 1 V and I applied a gain of 3. In this way I get the reasonable measures, but they are a bit high...I think due to an incorrect calculation of calibration.
What do you think?
Best regards
Re: Arduino energy monitor: strange output values
Firstly, you're confusing the bias chain with the voltage divider for the voltage input.
If you have an op.amp that will output rail-rail (many don't) and it's running off a 5 V supply, the output can swing 5 V. If it has a gain of 5, then if the input is biassed so that at zero input, the output sits exactly half-way, then a 1 V swing on the input is the maximum before the output saturates.
If you have a 10 Ohm burden resistor, that 1 V swing translates into a current swing of 100 mA in the c.t. secondary, or a swing in the primary of 200 A. That's a current of 70.7 A rms given a sine wave. So it should not be clipping.
What configuration is your amplifier circuit? Is it a follower with gain or an inverting amp? The easiest is the inverting amp, you connect the + input of the op.amp to the bias chain mid-point and that should solve your bias problem. If your chosen op.amp is not capable of rail-rail operation, you need to bias it so that with no input, the output sits exactly mid-way between the highest and lowest voltages that the output can swing to. (And of course if you do have an inverting amplifier, your power direction will be wrong so you must either reverse the c.t, the v.t. or reverse it in software.
Re: Arduino energy monitor: strange output values
Thank you very much. Now it works fine.
Best regards
Re: Arduino energy monitor: strange output values
Hi,
I added a second ct sensor. So, I have added a second c.t. circuit, identical to the first, which goes on another analog in of arduino. Then I modified the voltage and current example (EmonLib library). I have created a new instance of EnergyMonitor class and I repeated the same instructions of first EnergyMonitor instance, but the second ct sensor don't measure nothing. I don't understand because of this.
Best regards
Re: Arduino energy monitor: strange output values
Your sketch should look like this:
Use your old pin numbers for the voltage input and for ct1. You must use the same voltage monitor, but the pin number for your new c.t. input for the current input for ct2.
If you have done all this correctly, swap your new input circuit to the old input pin and check that the hardware is correct.
(If in the future you use voltageTX( ), currentTX( ) and CalcVI( ) you must change the emonLib.cpp library because the pin numbers are coded in the library and they will be likely be wrong if you are not using an emonTx).
Re: Arduino energy monitor: strange output values
Hi,
now, my circuit with 2 c.t. sensor works fine. The unique difference was the creation of two instances of EnergyMonitor class.I have instanced in this way:
EnergyMonitor emon1;
EnergyMonitor emon2;
Anyway thank you very much for help.
Regards
Re: Arduino energy monitor: strange output values
Now, I don't understand!
EnergyMonitor emon1;
EnergyMonitor emon2;
is exactly equivalent to
EnergyMonitor emon1, emon2;
so there must have been another small difference somewhere.
Re: Arduino energy monitor: strange output values
Good morning friends. I rode the scheme is as below,
http://openenergymonitor.org/emon/buildingblocks/how-to-build-an-arduino...
more even without anything attached'm having a current 0.08 and a power of 18.4.How has to fix this?
thanks
Re: Arduino energy monitor: strange output values
I know that it's equivalent. I mean that I don't know where was the problem. Maybe a wire or a component was not properly inserted in the breadboard.
When the circuit didn't work, I thought that the problem was software and not hardware.
Regards
Re: Arduino energy monitor: strange output values
Hi,
Have you used the default calibration constant or have you calculated these constants (ct sensor and AC to AC power adapter) as described in this link http://openenergymonitor.org/emon/buildingblocks/ct-and-ac-power-adaptor-installation-and-calibration-theory ?
I had the same problem and I have solved inserting an amplifier in the circuit as shown in the circuit scheme submitted by Robert.
Regards
Re: Arduino energy monitor: strange output values
elvisin
Your indications are almost certainly pickup in the analogue circuitry, either from the mains wiring itself or from the digital circuits. As Andrew says, amplifying the signal and then scaling down the digital value will reduce the effect of the pickup.
Re: Arduino energy monitor: strange output values
ok my friend .But what amplifier Should I use?Only the LMV358?Because i believe where i live don´t have this amplifier.Thanks
Re: Arduino energy monitor: strange output values
The LMV358 is a good choice, but you do not need to use this. Principally, you need a general purpose amplifier that will run off a 3.3 V single supply and has an output swing that goes from supply rail to supply rail. You don't need a huge open-loop gain, and you don't need a very large gain-bandwidth product.
Your best strategy will be to find a device that you can obtain locally, that is reasonably similar to the LMV358.
Re: Arduino energy monitor: strange output values
friend if I'll ride a circuit like what you drew up the will work? and calibration? error go away? Excuse the ignorance on the subject. thanks.
Re: Arduino energy monitor: strange output values
elvisin
Try this first: http://openenergymonitor.org/emon/node/841?page=14#comment-10531
Re: Arduino energy monitor: strange output values
Friend I need plot only Vrms with power factor its possible?how do I do that?
Re: Arduino energy monitor: strange output values
Vrms and power factor are available in the sketch. After you have called the calcVI( ) method on your instance of the EnergyMonitor class (emon1?), the values are in emon1.Vrms and emon1.powerFactor.
Re: Arduino energy monitor: strange output values
Hi
So how to display "real power | apparent power | rms voltage | rms current | power factor" at serial monitor. example coding below
void loop()
{
emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
Serial.print(" Real Power: ");
Serial.print(" Apparent Power: ");
Serial.print(" RMS Voltage: ");
Serial.print(" RMS Current: ");
Serial.print(" Power Factor: ");
emon1.serialprint(); // Print out all variables
}
Isn't correct???
Re: Arduino energy monitor: strange output values
Are you asking a question or making a statement? What you have written will print:
Real Power: Apparent Power: RMS Voltage: RMS Current: Power Factor: 2530.38 2638.15 238.62 11.05 0.96
Whether that is correct or not depends upon what you want it to display.
Re: Arduino energy monitor: strange output values
ok, but currently I try to develop GUI using visual basic. I have problem that to read from CT sensor to visual basic. Please help me
Re: Arduino energy monitor: strange output values
Sorry, I don't program in Basic. If I was writing a GUI (what do you want it to do?) I would not be using VB and I would not be trying to send stuff like that. It would be much more sensible to do like the output to emonCMS, except you can define your own data format, so if you want to mix integers and floats, you can do. I guess you will want to send the values as text, not as raw bytes, so you will need to read the numbers and store them as variables in order to process them further.
Re: Arduino energy monitor: strange output values
Hello Robert!
I have the same ECS1030-L72 sensor and the 2x10 kOhms voltage divider but I didn't test anything yet as you were talking about using an amplifier.
Would this one be fine: https://www.sparkfun.com/datasheets/BreakoutBoards/OpAmp_Breakout-v16.pdf based on LMV358. (https://www.sparkfun.com/products/9816) ?
Could you please tell me how should I connect this amplifier? (it has 4 connection points: +, -, IN and OUT). In case I use this amplifier, which should be the correct burden resistor value?
Best regards,
Felix
Re: Arduino energy monitor: strange output values
What current are you trying to measure? without knowing that, I cannot even start to answer your questions. You can find the calculations around the burden resistor here. You might not even need an amplifier.
Re: Arduino energy monitor: strange output values
I only want to measure, for the moment, the apparent power (I don't have an AC/AC adapter yet). The power meter will measure power from: 1 TV set, 1 hair dryer and a few smaller appliances (modem, phone power charger).
Re: Arduino energy monitor: strange output values
That is hardly an answer, how do I guess the power of you hairdryer and your system voltage? The problem is the range over which current can be measured with reasonable accuracy is about 200:1. The low end of the range you ask for is set by your phone charger which could be only a few tens of milliamps, and the high end by your hairdryer, and you should know what that is. I don't. If those don't fit, you can't do it without switching ranges somehow.
When you have those answers, you work backwards from the Arduino input voltage (max. 5 V peak-peak), then you have to choose a combination of amplifier gain and burden resistor to give that voltage or somewhat less (to allow for inrush) with the maximum current that you want to measure.
Re: Arduino energy monitor: strange output values
The hairdryer's power is 1700W/220 Volts. Anyway, I got your point. I'll try to read a few theory lines as I have zero knowledge in this field (power consumption calculation). In the meanwhile I'll use a 120Ohm burden resistor (the calculated value was 117,8689298).
Thanks
Re: Arduino energy monitor: strange output values
You will find it hard to measure a phone charger accurately if you set up for say 10 A maximum. 10 A represents 1024 counts in the Arduino and you need at least 5, preferably 10, counts for reasonable accuracy. That implies 100 mA so about 22 W, and I'm betting your phone charger is less than that.
Your c.t is 30 A : 15 mA, so expect 5 mA at max. current, you want 5 V peak-peak, or ~1.75 V rms, so I make your burden 350 Ω (330 + 20). You don't need an amplifier.
Re: Arduino energy monitor: strange output values
That won't be a problem as I'm not interested in measuring only the phone power charger. I have a few devices connected to a multiple socket outlet (anyway, not more than 2000W at peak).
Re: Arduino energy monitor: strange output values
Hello Robert!
I'm using the current only sketch and I've connected only the hairdryer. The values I get for the apparent power are close to 1600 (the maximum hairdryer power is 1700 W).
The only problem is that with the hairdryer off I still read values in the 9-14 range. I've taken off the CT from the outlet wire. Is it normal to get these low values even if there's no current passing through the ct?
The burden resistor is 350 Ohm and the ct_calibration = 5.7
Felix
Re: Arduino energy monitor: strange output values
Yes, it is normal to read low values even without the c.t. connected (replaced by a short-circuit). We believe it is noise from the digital side of the Atmel processor getting into the ADC.
Re: Arduino energy monitor: strange output values
Great then!!! I'll eliminate them while processing in the sketch.
Re: Arduino energy monitor: strange output values
You can't - the values are close to if not completely random. All you can hope to do is reduce the value to negligible. The situation will improve when you add voltage because as you have it at the moment, rectification is taking place in the rms calculation. That disappears when you calculate real power and the noise recorded falls significantly.
Re: Arduino energy monitor: strange output values
For the moment, I could register in the database only the values greater than 14. For all the values lower than 14 I'll make them equal to zero.
Re: Arduino energy monitor: strange output values
Hello measurement project took power in arduino 5v reference. From one Arduino board input voltage ac 127 127v sct013 and transformer: 12V ac-ac ... my question is about the source code emonlib. And understand how to modify the current and voltage but not e able to have accuracy with the power factor. Another question is how often, in the UK are referenced to 53 samples per cycle, in Mexico the frequency is 60 Hz. I would like to know which part to modify the source code accompanying the reference image ...
Re: Arduino energy monitor: strange output values
If you cannot set the power factor accurately using PHASECAL, then it is likely that the difference in the phase errors between your voltage adapter and current transformer are too great. Depending on which way round the error is, it might help if, in your copy of emonLib.cpp, you exchange these two lines so that current is read first
sampleV = analogRead(inPinV); //Read in raw voltage signal
sampleI = analogRead(inPinI); //Read in raw current signal
but doing that might also make it worse. You will have to try and see.
You get about 53 samples per cycle because that is how many pairs of conversions the ADC can read in 20 ms. As your cycle is 16.67 ms long, you will get about 44 samples per cycle. Using emonLib, this happens naturally, you cannot set it anywhere.
Re: Arduino energy monitor: strange output values
Hi. I have a similar problem to OP's. I'm also trying to use the ECS1030-L72 CT. Using a pair of 33k's for offset and using a 350 Ohm as burden. I've created a small sketch for just testing the input ADC values (attached) so I can at least have a grasp on the input values first. Now, the problem is, that regardless of load, I only get values around 2.5. I'm using a hair dryer at 1200W setting (about 5.21A on the 230VAC here), so I guess my values are very off. I'm getting a repeatable raw reading of the ADC around 508-509, which is consistent with the voltage offset -- 1023 pulling the ADC input directly to 5V, so this seems good. I'm using 507 to remove the offset to avoid weird values. But as I've stated, I see nothing but the 2.5ish values, regardless of the state of the load. I've checked all connections on my breadboard, all seem fine.
Any ideas?
Edit: I forgot to mention that I'm using a 47 uF cap instead of a 10 uF one, but this should not matter -- does it?
Re: Arduino energy monitor: strange output values
Have you threaded only the line or only the neutral through the c.t.? If you have both, you will of course get nothing out.
Why don't you use a standard emonTx sketch, changing the input pins appropriately (and leave out the radio of course)?
Re: Arduino energy monitor: strange output values
Thanks for the quick heads up. In the meantime I realised I have made the stupidest mistake :) I just hooked the sensor around the cable as is, and naturally this won't work... I've made a cable where I can hook it around one N and now I'm measuring something. I started off with the original mainsACExample.ino sketch but since it didn't work I started to debug it from the ground up. Now it seems to work -- next is calibration. BTW I initially started with a 100 Ohm burden since I calculated that the entire range nicely fits in around 0-1000 (with a few % margin of error). Going to have a look at the emonTx sketch. Although I don't have a transformer for measuring voltage, yet.
Re: Arduino energy monitor: strange output values
Depending on which method of emonLib you use - you can use the lib to get rms current and multiply by your nominal voltage to obtain apparent power (VA). The advantage of emonLib (apart from it's tried and tested) is a high pass filter is built in so removal of the d.c. offset is more accurate. If you look in Building Blocks, you'll find how to calculate the calibration constants and how to fine tune the calibration.
Re: Arduino energy monitor: strange output values
Thanks for the help, it seems to be working so far, albeit with only the current sensing part, with a mains constant of 230VAC. It appears to be surprisingly accurate despite the 5% resistors. At least, I could repeat the measurements using a "Kill-A-Watt" style cheap power meter, within an acceptable margin. Some sample values are below. Note that when I switched the dryer from low to high setting, there's a value out of the ordinary. I'm using a 100 Ohm burden (around 117 would be ideal for this CT).
I can't measure the PF at the moment with the Arduino.
Re: Arduino energy monitor: strange output values
Only the the c.t. accuracy, burden resistor and the voltage reference affect the calibration. The bias chain resistors don't (though if unequal they will introduce asymmetrical clipping on input overload).