New to the digi products… Using an X2 and a Smart Plug.
I see this code in the smart_plug.py sample on the wiki:
http://www.digi.com/wiki/developer/index.php/Smart_Plug_Interactive_Demo
parsed_sample = parseIS(raw_sample)
lux = (float(parsed_sample["AI1"]) / 1023.0) * 1200.0
mV = (float(parsed_sample["AI3"]) /1023.0) * 1200.0
current = (mV*(156.0/47.0) - 520.0) /180.0 * .7071
return (lux, current)
Is there any explanation about these numbers?
I see 1200 is used to convert the AD reading of millivolts on AI1 and AI13 because the analog inputs go from 0VDC to 1.2VDC, right? But what about:
156/47?
520/180?
.7071? (power factor, maybe?)
I’m interested in deriving power in watts but at this point I assume I’m out of luck.
I’ve got a 60 Watt light bulb on the Smart Plug.
I can turn it on:
mV = 198.240469208 - Current = 0.542069312202
I can turn it off:
mV = 160.703812317 - Current = 0.0526392254737
With a separate voltmeter I can see the AC voltage on the power strip is around 122V. That works out to:
On = 122 * 0.542069312202 or 66.13… Watts
Off = 122 * 0.0526392254737 or 6.42… Watts
Looks like I’m off by 6 watts or so. IOW, if I shave off 6 watts from my on/off readings, I would have what I would expect; 60 watts on, and 0 watts off.
So the question is: Does anyone use this device for power measurements and if so, how?
I’ve been using some hacked Kill-a-watt meters (see Tweet-a-watt) and an Asus WL520GU wifi router (flashed w/ OpenWRT and python) with some reasonable success so I thought I’d try a professional product and see how it works. Now wondering why I’d pay $90 for Smart Plugs.
Any tips greatly appreciated,
Chris.