
Originally Posted by
dhouston
From
http://en.wikipedia.org/wiki/Root_mean_square
"Thus the peak value of the mains voltage in the USA is about 120 × √2, or about 170 volts."
Working backwards from that, 1/√2*Vpk=Vavg or 1/1.414*170=120. Assuming a more or less pure sinewave, current follows the same pattern,
However, for anything other than a pure resistive load, voltage and current will be out of phase and you may or may not have a sinewave. You have to take many instantaneous measurements of both voltage and current and average them over time to get true power.
Dave, Thanks. I think I understand this caclulation but it's been allot of years you know the saying if you don't use it you loose it... well I think what you are trying to get at here is getting that peak current reading. (I think) I realize they might get out of sync I believe the sensor is going to report back the correct current being used that is what I am ultimately trying to get not the voltage.
In a simplified version of my program I am:
Code:
mainloop:
Gosub getx ' x returned with ad value from current sensor
x = x - 128
vmax1 = vmax1 max x
resv = vmax1 * 3906
resv = div32 1000
Serout2 so,baud,[27,"[2;7H", dec5 resv]
pause 100
goto mainloop
end
using the MAX command over a period of one or more cycles get's the correct current being used (close enough as I said I doubt this hair dryer is right on at 1600 watts it says on the side of it) It's figuring out how to get that peak and know when it's been reached to reset the value of vmax1 and/or display the value my calculated current usage, "resv".
I've tried a couple of things last night like trying to determine when the wave is going up or down and only displaying on the first pass through on the downside then resetting vmax1 to 0 when I hit zero. I would set vmax1 to MAX x on the upside but that sometimes doesn't work because it looks like in some cases when it starts back the downside it didn't get a chance to get the peak value during the upswing of the wave. For example let's say the peak of the wave is 200 I would set vmax1 at 180 but the next pass through mainloop I've already started the down side and get a value of 170 for the very next pass. Well that would be on the downside and I would display a current based on 180 not what the peak really made it to before the downside, do you follow that? I hope so.
It appears the sensor is working correctly and the current is following the same pattern I'm just having difficulty trying to figure out when I've hit the peak so I can display a constant reading not one moving about with the wave.
I'm going to try a simple counter and just keep reseting vmax1 after say 10 cycles through the loop and see how that looks. If anyone has any other suggestions or solutions I'm all ears.
Thanks again
David
Bookmarks