(I'm in the UK with a nominal mains voltage of 240 V and frequency of 50 Hz)
With my simple power calculating code, I am seeing a power factor of around 0.75 with small resistive loads (incandescent lamp at 40 W) when I would expect near 1.00. I imagined this was due to a phase shift with the current transformer (CT), so I set about exploring this.
The graph below gives a cross correlation between voltage and current sampled at 2 kHz using various resistive loads. If the CT were perfect, the high point of all the curves would be at 0 samples on the x-axis.
Cross correlation code implemented in the mbed from http://paulbourke.net/miscellaneous/correlate/.

Using Excel LINEST function (http://spreadsheetpage.com/index.php/tip/chart_trendline_formulas/) and the Excel Solver add-in (http://archives.math.utk.edu/ICTCM/i/21/C006.html), I obtained the number of samples delay for each load (converted to degrees), to generate the following curve:
It's non-linear which apparently is expected due to magnetic saturation characteristics as a function of the excitation current in the transformer (http://www.crmagnetics.com/Portals/0/analysis_of_ct_error.pdf).
I've found a good paper (http://focus.ti.com/lit/an/slaa122/slaa122.pdf) with some ideas about how to correct this, so I'll see if I can improve the accuracy of my energy monitor at small loads and power factors away from unity (which will be more affected by phase shift).
Without any phase shift correction, I get the following results comparing my energy monitor with my Maplin plug in monitor:
Incandescent 40 W lamp:
Maplin 38 W, 1.00 PF
mbed 40 W, 0.75 PF
Halogen desk lamp with transformer:
Maplin 23 W, 0.90 PF
mbed 28 W, 0.57 PF
This is mainly an issue at lower loads. For comparison, a 300 W halogen lamp is much better (which is probably why I didn't pay too much attention to the issue originally):
Maplin 314 W, 1.00 PF
mbed 313 W, 0.99 PF
I have another issue to address which is that I've assumed a DC bias at exactly half the 3.3 V ADC range, and this is not the case (due to resistors not being identical). I'm not sure yet exactly what effect this has on the accuracy.
Daniel,
Great project. Do you have a schematic of the photoreflector (Fairchild QRB1134 ?) connection to the Mbed.
Do you use InterruptIn, have you got debounce? I'm working on an energy datalogger. I've started with an RS485 connection to my solar invertor and I also want to measure electricity and gas.
Wim