Just started the first system testing of the ADE7763. What I mean is rather than just working on the SPI or other subsystems, I am using the chip as it would be in real life. I have the voltage and current channels of the ADE7763 connected to real sensors.In the case of voltage, it is a simple voltage divider from the 12 volt end of a transformer. This gives me a +- 0.250 VAC signal to the ADE. For the current, I am using a 30 Amps CT I purchased from Sparkfun some time ago. On a scope, the voltage and current inputs look very nice. There is some high frequency noise, and as per the datasheet I will be adding a low pass filter to remove this fuzz.
So the first tests were very positive. The Vrms register stays fairly constant over time. There is some ripple but I think that is because I have yet to implement measurements at the zero crossing points. The Irms register also has some ripple, but tracks very closely to the load I put on the CT. I have a 200 and a 150 watt light bulbs I can switch in and out. Even at 350 watts the current is only about 3 amps or only 10% of the CT’s range. Yet, the linearity of the watts to register value are very nice.
Testing started to go down hill went I went to read the power (watts) register and discovered that there was none. To read the watts, you need to select that point in the processing chain for Sample Mode. I set the bits for that location and read the Sample register and … nothing. Re-read the datasheet and found that you need to set a bit in the Interrupt Enable Register to enable sampling. But when you do that you start to get hammered by a steady 3.5K interrupts per second at the lowest sample rate you can select. That rate is well beyond what my little Arduino can deal with.
So I disabled interrupts and simply read the waveform register to get the watts value. I think I can have interrupts enabled for other things and simply enable the sample mode from the main loop and than inside the ISR turn it off again. That way I can avoid the firestorm of interrupts.
The watts value also looked good with the 0, 150, 200, and 350 watt test values. And then I went to look at the energy register. This is the time integration of watts to give you your kilowatt-hour value that is used as a measure for paying your electric bill. What I found was a negative value!
Not sure how the ADE can determine what is positive (outlet feeding the bulbs) or negative (bulbs sending power to the utility). Since the voltage and current are in phase, the product of V and I will be positive. Integrating a positive number should result in a positive number, but in my case it does not.
Some magic is going on here as the datasheet clearly indicates that you can get a negative energy. I have sent a query of to Analog devices to get some input from them.
Of course this is not the end of the world. I could simply multiply by negative one and the problem would be solved, but mysteries like this drive me nuts.