Before messing further with this AC current measurement stuff, let me summarize what my current setup is:
Oh, and a debug LED and 3x AA battery pack, which provides 3.3 .. 3.9 V with rechargeable EneLoop batteries.
I don’t expect this to be the definitive circuit, but at least it’s now documented. The code I used on the ATtiny85 is now included as tiny50hz example sketch in the Ports library, eh, I mean JeeLib. Here are the main pieces:
Nothing fancy, though it took a fair bit of datasheet reading to get all the ADC details set up. This sketch compiles to 3158 bytes of code – lots of room left.
This project isn’t anywhere near finished:
- I need to add a simple RC low-pass filter for the analog signal
- readout on an LCD is nice, but a wireless link would be much more useful
- haven’t thought about how to power this unit (nor added any power-saving code)
- the ever-recurring question: what (safe!) enclosure to use for such a setup
- and most important of all: do I really want a direct connection to AC mains?
To follow up on that last note: I think the exact same setup could be used with a current transformer w/ burden resistor. I ought to try that, to compare signal levels and to see how well it handles low-power sensing. The ATtiny’s differential inputs, the 20x programmable gain, and the different AREF options clearly add a lot of flexibility.