Calibrating AC-AC Voltage

Hi All,

Thanks to your help so far, I have the current-only version of the circuit running smoothly.  I have even added a LCD and a RGB LED to indicate from a distance the amount of amps running through the system.

Tonight I am working on my voltage calibration.  I have read the article and done the math, but wanted to make sure I'm doing this right.  I live in Canada with a single phase of power @ 120V.  I have 2 resistors of 270 and 2700 ohms that are the voltage dividers (ratio 10:1).  Plugging this into the equation and knowing I have a 5V board, I get:

voltage constant = 120 × 10 / (5 × 1.20) = 111.11

Did I apply this right?  111 seems right, but since I'm not in the UK or Europe like you, I don't know if that seems right to anyone else.

I don't know of a way to sample my mains to get the factor even more calibrated.  Is there a way to do this all on my Mega?  I have a multimeter too if that helps.

Thanks again!

Dan Woodie's picture

Re: Calibrating AC-AC Voltage

Squareone,

I live in NY, so I have a similar power setup. To fine tune the calibration read the EmonTx reported voltage at the same time you measure the voltage of your outlet using your multimeter. You will need to make sure that you 1) are safe while measuring the voltage, and 2) have your meter properly setup to measure AC voltage (check that leads are plugged into the right place and the meter is setup properly to AC voltage. It is the type of measurement you can make at an outlet if you are careful. You can then fine tune your factor using the equation:

New factor = (multimeter voltage/EmonTx reported voltage) X current calibration factor

More experienced folks please chime in if I am wrong.

Dan

dBC's picture

Re: Calibrating AC-AC Voltage

Where "current calibration factor" means "existing calibration factor", not current as in amps.  English is very problematic!

squareone's picture

Re: Calibrating AC-AC Voltage

Yes, I read the thread earlier with someone else with this problem!  Thanks so much for your help and I'll give it a shot.  If I'm not back in 24 hours, come and find me!

squareone's picture

Re: Calibrating AC-AC Voltage

I see...we are basically just making a linear factor to correct the calibration factor.  Thanks for the simplification for me.

Robert Wall's picture

Re: Calibrating AC-AC Voltage

Where is "current calibration factor"? (current = now!)  Url & rough position on the page?  I changed one of those recently, are there more?

Robert Wall's picture

Re: Calibrating AC-AC Voltage

squareone:

The voltage of your board (which I'm assuming as you sav "5 V" is an Arduino) doesn't come into the equation. You need to know the voltage out of your ac adapter and the mains voltage at the same instant in order to use the calibration maths.

"230" - or 120 in your case - is the a.c. adapter input voltage, and "(9 × 1.20)" is the actual adapter output voltage at 230 / 120 V.

And your resistor ratio should be 11, not 10, with the values you give. It is the ratio of the voltage divider, not the ratio of the resistor values. If you are right and your adapter output is indeed 5 V, then the resistor ratio is wrong anyway as you will be using only abut a quarter of the available input range of the ADC. You should aim for about (but no more than) 95% at absolute maximum mains voltage.

Dan Woodie's picture

Re: Calibrating AC-AC Voltage

dBC

Where "current calibration factor" means "existing calibration factor", not current as in amps.  English is very problematic!

I even read a similar thread having to clarify that and I still used the unclear wording! Well, it was late so I will blame it on that...

Dan

Robert Wall's picture

Re: Calibrating AC-AC Voltage

Dan:

I think I contributed to the "similar thread", then went away and changed the offending page. I agree it was confusing. You obviously copied and pasted the quote, so I want to know where the offending line is so that I can remove it from the face of the planet. Google can't find it.

Or are you going to blame your browser cache as well as

Dan Woodie's picture

Re: Calibrating AC-AC Voltage

Robert,

My equation was original, just highlighted to stand out. So, your page edit is probably still OK. The only quote I had in this thread was quoting dBC's comment before...

Dan

squareone's picture

Re: Calibrating AC-AC Voltage

Sorry for the confusion.  My AC adapter is 9V output and I can fix the voltage divider ratio.  Thanks for the catch!

squareone's picture

Re: Calibrating AC-AC Voltage

NO!!!!!!  I can't figure it out now.  Moving to the AC-AC adapter setup from the current only measurement.  Now I'm reading zeros across the board!  Ugh.  Just checked everything with the multimeter and next I'll be checking the wiring...Is there an "easy" way to troubleshoot this?  

Robert Wall's picture

Re: Calibrating AC-AC Voltage

squareone:

I shall assume you are using the .._Voltage sketch?

After ct1.calcVI(....) insert

Serial.print("V= "); Serial.println(ct1.Vrms);

That should print to the serial output the voltage value. Assuming that is zero, what do you measure (with a multimeter) out of your adapter. It is a.c. output, isn't it?  If it's nominally 9 V, you should see 10 - 11 V because it is not loaded.

Next, measure across the 270 Ohm resistor. You should see about 1 V.  If you do, do you measure the same between the junction of the 270 & 2700 resistors and the input pin of the processor (pin 25)?

izik's picture

Re: Calibrating AC-AC Voltage

I hope you don't mind that I am going to piggyback this thread. I am having similar issues to squareone.

I calculated a VCAL coefficient of 122.22. (120 *11) / (9 * 1.2)

However, my Vrms is showing to be ~294 for some reason which is VERY far off.

If it's nominally 9 V, you should see 10 - 11 V because it is not loaded.

Next, measure across the 270 Ohm resistor. You should see about 1 V.  If you do, do you measure the same between the junction of the 270 & 2700 resistors and the input pin of the processor (pin 25)?

I am seeing 10.77 VAC as expected and ~1V across my smaller resistor. I am confused where the error is occuring. Is my VCAL coefficient just really far off?

 

Also, I am having trouble with the current sensing part of the circuit. I am using the SCT-013-030 so my ICAL coefficient is 29. I believe I have the circuit set up correctly but the current is showing to be ~63 (also VERY far off) always. Even when I have the current sensor disconnected. It simply isn't being read by the uC. 

Any pointers?

 

Robert Wall's picture

Re: Calibrating AC-AC Voltage

izik:

Is my VCAL coefficient just really far off? I don't think so. You must have another fault in there somewhere. The same goes for your c.t. What hardware do you have?

izik's picture

Re: Calibrating AC-AC Voltage

Current sensor: SCT-013-030
Voltage: 120VAC - 9VAC adapter 

Programming on ATmega328

I am attaching my code.

My printf function sends an integer over serial to the computer where I monitor the output. I typecast the floats to integers to send them over just because this is the function I typically use for debugging. I haven't written one that sends floats.

 

**Edit**

I don't think the issue is in my code because when I uploaded the example directly from EmonLib onto an Arduino rather than my c code on an ATmega328 I was getting the same weird numbers. Therefore the problem is probably with my circuit or components. Ugh

izik's picture

Re: Calibrating AC-AC Voltage

I have a question about what my multimeter should read across the currents sensor. I measure 0.39V across the leads of my SCT-013-030 which makes sense because it is a 30A/1V meter and therefore the sensor is reading ~12A (this is what I expected). However, when I measure across one lead of the currents sensor to ground, I am expecting to see ~2.9VAC because of the 2.5VDC offset but I still see 0.39V. What could cause this?

Robert Wall's picture

Re: Calibrating AC-AC Voltage

What could cause this? Your meter!

My guess is it's intelligent enough to know that you have selected the a.c scale so it's politely ignoring the d.c. offset, and giving you the answer it thinks you want.
Look at the diagram here: http://openenergymonitor.org/emon/buildingblocks/ct-sensors-interface

What are you getting for the value of Supply Voltage (from readVcc( ))? I ask because the measured value of Vcc is used for the ADC reference, and that's common to both V & I measurements. If the reported Vcc is wrong, then the calibration will be wrong too. readVcc( ) works by measuring the internal 1.1 V reference (which it thinks it knows), then reverses the sum to derive the 'correct' value for the supply. The internal reference can vary 1.0 - 1.2 V but that's not nearly enough to explain your error.

What d.c voltage do you read on the AVR input pin? It should be half the supply (1.65 V or 2.5 V) - again that same diagram explains it. You could try running the Raw Samples Tool from here: http://openenergymonitor.org/emon/node/1757 which gives you a rough "oscilloscope" picture of what the inputs see.

 

squareone's picture

Re: Calibrating AC-AC Voltage

Hey Robert,

Thanks for your help again.  I am using the voltage_and_current sketch from the emon library.  I'll do some measuring and get back to you.  Thanks for the ideas!

Robert Wall's picture

Re: Calibrating AC-AC Voltage

squareone:

The obvious first question: have you got the right input pins for your hardware? That example is just a 'bare bones' to illustrate the use if the library. The fully developed sketches with RF comms etc. are all on Github.

squareone's picture

Re: Calibrating AC-AC Voltage

Working on everything now Robert.  Got side tracked yesterday with an invitation to a barbeque at a friends house!  I'll let you know, but it looked like it was plugged in correct.  I'm rebuilding the circuit from scratch tonight to see if it works.  In order to test the circuit, do I have to have the CT running?  I would think not since it's taking an independent voltage measurement.  Also, what error in my normal reading should I expect without the voltage measurement.  I would assume an error of maybe 20%, but I don't know the shape of the signal coming into the wall outlet.

squareone's picture

Re: Calibrating AC-AC Voltage

Found the problem.  When I moved the voltage_and_current sketch over to my file, I accidentally removed 1 key piece of code!  SIGH...at least I know everything else is working solid.

squareone's picture

Re: Calibrating AC-AC Voltage

Everything is working well.  Thanks Robert and Dan!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.