Help needed to customize Arduino Code.

Hi,

This is my first post. It is great being part of this exciting forum. I look forward to being part of this community of like minded people.

I am doing a project on Smart Meters.

I have built the hardware slightly different to the one recommended on this site.

The current sensor has a max Primary current Ip of 50A.
The conversion ratio is 1:2000 , so the secondary Current Is = 0.025A.

I've connected this to a 200ohm burdern reister so that the max voltage it will send to the Arduino is 5V.

After reading in the value I convert it back to the actual current with this line of code.

          Iin=((Iin/204.8)/200)*2000;

where
204.8 = 1024/5V (1024 is the Arduino max digital value) and 5V is the max value for 5V input.
200 is the value of the Burdern resister i.e: 200ohms
2000 is the conversion ration on the supplier spec sheet.

The Maximum current values are close to what I get on the multimeter. About 0.3A for a 70W light.

However, I need to convert it to an Irms.

I would like to use the code supplied by openenergymonitor to do this but I am not sure how to go about doing so.

How do I adjust the callibration  parameter(111.1) as well as the 1480? (what is this) so that it will work for my setup.

  emon1.current(1, 111.1);             // Current: input pin, calibration.

  double Irms = emon1.calcIrms(1480);  // Calculate Irms only

Any help is appreciated.

Kind Regards
  

 

energyguy's picture

Re: Help needed to customize Arduino Code.

I just noticed that the 1480 is the sampling rate . 
I'm using an Arduino Uno.
Is 1480 the default value?

The 111.1 is the big puzzle. How is that determined?

Robert Wall's picture

Re: Help needed to customize Arduino Code.

You can read the full details of how the calibration constants are calculated in Resources > Building Blocks.

"1480" might not be the best value to use, now that emonLib has been optimised a little more. Check the latest code examples for the emonTx on GitHub.

energyguy's picture

Re: Help needed to customize Arduino Code.

Thank you so much for your help.
I missed that section. Will head off there to have a read. :)

Bill Thomson's picture

Re: Help needed to customize Arduino Code.

204.8 = 1024/5V (1024 is the Arduino max digital value)

Not that it's going to make a big difference, but since the max value is actually 1023, shouldn't the calculation be:
204.6 = 1023/5V?

 

energyguy's picture

Re: Help needed to customize Arduino Code.

Correct.

 

I sometimes get that wrong!

Best to change it, since the resolution of the current is very fine.

Thanks!

abh015's picture

Re: Help needed to customize Arduino Code.

Hi, i have the same problem, Did you find the information?? and if you do, where exactly?? Could you explain a little...

Robert Wall's picture

Re: Help needed to customize Arduino Code.

Look at the banner menu across the top of this page.

Comment viewing options

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