Practical Voltage Calibration Constant

Hi Team

It was already discussed few times in this forum and i found in one forum, Mr. Robert says adjust the calibration until you get the exact value equal with multimeter.

I have adjusted the constant to 188.50 which is giving me the voltage 230v in my Arduino serial port. But Sorry Robert seriously i don’t like the idea of putting some random number and get the required output.

Here i will give you the values i got from Multimeter. Pls tell me is it possible to derive the constant 188.50 from those values.

Multimeter Measure Values:
Ac-Ac Adapter: 230v to 9v it says
Main Voltage: 230v or 231v
Output Pin Voltage of Ac-Ac Adapter: 13.75 (without load and without connecting to circuit)
ADC Input Pin AC Voltage: 1.17v [After connecting Adapter with Circuit - Measured between input pin to arduino and ground]

I am using 10k and 100k resistor for voltage divider.

Is it possible to calculate from those values? any other information required?

Yes - all the calculations are in the “Learn” section, on the page about calibration theory. Your resistor values don’t appear to be exact - this is to be expected. Also, you should read the page about the factors that affect the calibration. Your constant appears to be wrong by 2.44%, which is most probably due to errors in the resistor values and the ADC reference voltage.

So it is not “some random number”.

there an slightly easier way. you just need to modify the emonlib a little bit . and I find it fairly accurate. or you can use my modified emonlib it was designed to work with mcp3008 chip to provide scalablity but it works fine on normal setup too… or just refer to my sketch - and modify emonlib.h and cpp to be simular to mine ( you can ignore the reference to calcVID and calcIrmsD that in reference to digial and mcp300x chips )

double I_RATIO = (ICAL *((SupplyVoltage/1000.0) / (ADC_COUNTS)))*adj;

then it works in percentages 1 would be normal 0.9 (10% to high) 1.1 ( 10% to low)

I cannot believe @stephen’s suggestion above is serious.

How can modifying emonLib be easier; more to the point how does it work if you have more than one device? The concept and the whole purpose of a library is to have a common code base that is unchanging and can be re-used time and time again. Customising it defeats that.

all it does is add to the sketch an extra parameter to emonlib - example : ct1.calcVI(20,2000, 1); it does not take away from standardizing. every CT and resistor can be slightly different values then the last this made it easier, to calibrate. if one CT was +/-10% different then the other . then all one does is adjust the 1 by +/- 0.1 decimal points to compensate. you still use your same basic Resistor base values for your CTs. it just made it easier then fiddling with numbers to adjust for accuracy. basically look at emontx reading, compare to your tester reading - boils down to emontx_reading/tester_reading = adjusted_value. do not see whats so hard to believe because of simplification of a process…

Because, as Robert said:

Sketches are where the changes should be made. Not the Libraries.

Changing it for your own use isn’t an issue.
Posting the recommendation that others change it, is.

It creates support issues because now there’s more than one version of a library getting used by an unknown number of users.

yes but you are missing the point, it is still a standardised code that can be used over and over it just a slight modification to emonlib that:

Adds an extra parameter to emonlib sketch for compensation in normal variations in hardware

it allows for easy compensation for CTs and resistors all from with in the sketch…

AgudaAmal Raj ask if there was an easier way and a suggested a method if he wants to try it or not is up to them… did not think there would be such a protectionist attitude towards an supposedly opensource project

Simpler? R E A L L Y ?

How is having TWO variables that affect the calibration - the current or voltage calibration constant that we have had up until now, plus your newly invented adjustment to take up component tolerances - simpler than having just one constant to adjust? Are you saying that someone with enough brain to buy and install an OEM system is incapable of working out that to convert a reading of 238.7 V into a reading of 241.2 V, you need to multiply
268.97 by (241.2 / 238.7)? And that they haven’t got a pocket calculator or a smartphone with a calculator on it to do the sum? (I’ll leave out slide rules.)

Simplification means making it easier for someone to calibrate their equipment. Adding an extra variable to adjust will simply beg the question: “Which should I alter, the 268.97 or the 1.00?”

It’s just adding a layer of confusion.

Are you willing to put in as many hours each day providing support for all and sundry, that those of us who answer most of the questions round here do?

Hi Stephen

Thank you for your help. But i guess it’s not the perfect solution.

Since it is open source, editing the files is up to our convenience. But certain things we should consider before editing.

  1. What we can do when new updates on the library released by OEM and if it’s a major security update?
  2. Even if it’s a small library we cannot be 100% sure on where and all our code change will reflect…
  3. If some other people works in same project in future they will be confused on what is base code and what we have overwritten it.

Simple. we should inherit and extend the class and write our own library. Here is the link for Arduino on how to extend library classes. I am new to this. I will give it a try later and update here.


Run the changes by the original author to see if they want to integrate them into the library.

1 Like

look not wanting to get under your skin Robert - but it was still only a suggestion… and truthfully it is easier. all you need to do is calculate the voltage and one CT port accurately - all the rest can be quickly adjusted based on difference compared to initial calibrated CT port . this CT and port is 5% higher ( adjusted value 0.95) , that one 3% lower (adjusted value 1.03). etc thus balancing the CTs for accuracy easily …

no worries Amal Raj … hope you get it working for yourself the way you want…