How to read power measurement with Arduino analog input ?

Hi folks,

I'm in the middle of my project of measuring power with Arduino Uno. I want to read from RF watt meter and save the data from Serial Comm / Hyper terminal.

I did try with basic code of analogInput. Also, I tried to make voltage divider with 100k and 5k resistors. R1= 100k and R2= 5k.
I understand that Arduino analogInput max is 5V, can't be grater than that. I was wondering why the data those I got are bunch of integer numbers. I tried to divide it refers with the voltage itself.

In this case, I need help regarding how will I measure the Power from the RF watt meter, such as BIRD meter ? The meter is something like this http://www.bird-technologies.com/en/Products/Wattmeters_Line%20Sections/PortableWattmeters.aspx
My goal is to read and display the data through hyper terminal / serial communication

The ADC in arduino quantizes the iput voltage with respect to default reference volatge of 5V. The ADC is of 10-bit resolution so there are 2^10 =1024 quantization levels.So each qunatized level correspond to 5V/1024 ~ 4.883mV. The integer you get corresponds to the number of such levels required to get the approximate input analog value. So if you give a input say,2.4V to the ADC you will get floor(2.4*1024/5) = 491. So if you want to convert it back from the integer to corresponding voltage

quantized voltage = (the integer * 5/1024).

I hope you understand. :slight_smile:

Caution : You should not try to give an input larger than 5V to the analog Pin. It increases the chances getting the Arduino damaged.

Thanks for your explanation. Indeed, I understood that, by calculating the value of R1 and R2. However my question is how would I calculate the voltage exceed 5 volts. Obviously, I need voltage divider though I have one here. R1 and R2 and I set it. Again the problem is IF the analogInput will read the voltage out from voltage divider then it would be stable. I've found that it's unstable, thus intuitively I can say there is problem with the wiring.

Okay, I tried with Power supply and read through voltage. It works well, with max voltage is 16 VDC. However if I go up more than 16 VDC. The arduino stops working. It doesn't give any output from the serial communication.

Any idea ?

What are the values of R1 and R2 you choosed?
Did you re-calculated the values of R1 and R2 before increasing the voltage of power supply to ensure that the analog input is within bounds?
The ADC output straying off by 1 or 2 digits is usual, it may occur due to external noises and switching noise from the regulator.

saravananm92:
What are the values of R1 and R2 you choosed?
Did you re-calculated the values of R1 and R2 before increasing the voltage of power supply to ensure that the analog input is within bounds?
The ADC output straying off by 1 or 2 digits is usual, it may occur due to external noises and switching noise from the regulator.

yes I recalculated for R1 and R2 for the voltage divider. I chose to use R1=5k and R2=100k, vice versa for 100 V max allowed voltage input. For 16 V I use R1=10K and R2=4k7. It can read through 16 V DC power supply. What I got from ADC it’s increment number from 230-400 Integer. I try to divide it according to the mean value of the sample data (Voltage).

Do I need to get voltage divider sensor ? or somewhat what do I need to do ? It supposes to be as simple as reading analogInput from Watt meter, doesn’t it ?

I believe the idea is to scale your input voltage to the Arduino analog pin with the voltage divider, such that the input voltage at the analog pin never exceeds the Analog reference which you are using (5V or 3.3V). The ratio of R2/(R1+R2) gives you the scaling factor (ie: R1= 8K, R2= 2K, 2/10= 1/5= 0.2, so with a maximum of 25V applied to the top of the voltage devider, you would see a max of 5V (250.2) at the junction of R1&R2, this applied to Ax would give a value of 1024, using Saravan's 4.883mV, you would calculate 10250.004883= 5.000193V, THEN you have to apply the scale factor (0.20) to get back to the actual (approximately) voltage applied to the divider: 5.000193/0.2= 25.00096). At least I think that's how it works....... fuzzy old fart, forgets a lot of stuff...

You should also remember that the ADC needs a certain amount of current to charge up the internal caps, so.... you have to limit the total resistance of R1+R2 to keep the conversion time reasonable.

123Splat:
I believe the idea is to scale your input voltage to the Arduino analog pin with the voltage divider, such that the input voltage at the analog pin never exceeds the Analog reference which you are using (5V or 3.3V). The ratio of R2/(R1+R2) gives you the scaling factor (ie: R1= 8K, R2= 2K, 2/10= 1/5= 0.2, so with a maximum of 25V applied to the top of the voltage devider, you would see a max of 5V (250.2) at the junction of R1&R2, this applied to Ax would give a value of 1024, using Saravan's 4.883mV, you would calculate 10250.004883= 5.000193V, THEN you have to apply the scale factor (0.20) to get back to the actual (approximately) voltage applied to the divider: 5.000193/0.2= 25.00096). At least I think that's how it works....... fuzzy old fart, forgets a lot of stuff...

You should also remember that the ADC needs a certain amount of current to charge up the internal caps, so.... you have to limit the total resistance of R1+R2 to keep the conversion time reasonable.

Okay let me do my math again here:

Formula:
Vmax ~ Desired Maximum voltage = 100 V
Vin ~ Arduino Maximum voltage = 5 V
R1 = 100 k
R2=?

My calculation;
Vin = Vmax * (R2/(R1+R2))

0.05 = R2 /(100k + R2)
0.05*100 + 0.05R2 = R2
R2 = 5/0.95
R2 ~ approx 5.3k

Basically from my calculation it should hold for 100 V, but I didn't get my assumption correctly. Why ? I must missed something.

Apply for 25V formula would be different, however, your given calculation seems make sense.

I need an enlightenment to get an idea for this problem

-EDITED-

Ahh I see what you're saying there. A little bit concept of numeric manipulation.

Yeeahhh… I got it…

Reading value: 431 The actual Watts : 38.46
Reading value: 423 The actual Watts : 38.46
Reading value: 443 The actual Watts : 38.46
Reading value: 428 The actual Watts : 38.46
Reading value: 441 The actual Watts : 38.46
Reading value: 433 The actual Watts : 38.46
Reading value: 425 The actual Watts : 38.46
Reading value: 433 The actual Watts : 38.46
Reading value: 423 The actual Watts : 38.46
Reading value: 436 The actual Watts : 38.46
Reading value: 441 The actual Watts : 38.46
Reading value: 440 The actual Watts : 38.46
Reading value: 433 The actual Watts : 38.46
Reading value: 440 The actual Watts : 38.46
Reading value: 0 The actual Watts : 0.00
Reading value: 0 The actual Watts : 0.00
Reading value: 0 The actual Watts : 0.00

However, sometimes my arduino gets stuck and kind a buffer overflow. I don’t know why…

-EDITED- I know why, it was just port number issue

Same way you would build a string for serialprint?
Where are you going to put the string? monitor, SD card, LCD, 7Seg LED?

123Splat:
Same way you would build a string for serialprint?
Where are you going to put the string? monitor, SD card, LCD, 7Seg LED?

I would store the string as txt file. I'm looking for something looks like fopen or fread. I'm searching it up now

You have chosen well.

Good luck and have fun.