Problems getting correct voltage measurement


I am having a problem getting a correct reading for the voltage.

I am in Canada, with a split phase system at 120/240VAC. I am using a 9.5VAC transformer and voltage divider to reduce the waveform to a readable level for the Arduino Uno board I am using. I measure approx 4.3V P-P AC, with 2.39V DC bias.

I am trying the example Voltage-Current sketch from github. I have the current input pin shorted to ground. I thought I should be able to change the calibration value to change the reading to what I am getting from a Fluke DMM (Model 77). 

With the input pins of the Arduino floating, I had strange readings, probably due to noise pickup. Shorting the Current input pin to ground, and feeding my voltage input to the Arduino corrected most of this problem.

What I get now is '0.00 0.00 0.00 161.7 nan'. I have changed the calibration value for the voltage from 1 to 500, from the value in the downloaded sketch (234.26, I think), but the reading remains the same.

If I unplug my voltage transformer feed, the printout drops to '0.00 0.00 0.00 0.78 nan'.

It seems, since the Voltage reading does drop to under 1, that I am measuring some kind of voltage, but I do not understand why changing the calibration factor does not change the voltage indication. I also do not understand where the 'nan' indication is coming from - should that not just drop to 0 with the input connected to ground?

Can anyone help? Thanks in advance.


dBC's picture

Re: Problems getting correct voltage measurement

 '0.00 0.00 0.00 161.7 nan'

I think that represents:

RealPwr, ApparentPwr, Vrms, Irms, PowerFactor

It looks like PowerFactor is calculated as RealPwr / ApparentPwr which would explain the divide by zero. There's an opportunity for a trivial improvement to the code there.

It seems your voltage is showing up in Irms rather than Vrms.  Any chance you've got the inputs around the wrong way (i.e. you've grounded the Voltage input, and you're feeding the output of your adaptor into the Current input)?

ykhome's picture

Re: Problems getting correct voltage measurement

That was the problem. I knew it was something simple and dumb that I was overlooking.

Thanks for the assist!

Comment viewing options

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