ADE7763 Part-7 (Mystery of the swapped VI)

In my last port I alluded to the mysterious swapping of the voltage and current channel. When I read the Vrms and Irms channels under various loads, it is the voltage channel that changes significantly and not the current. I beat my head against the wall and found not reason for this issue.

I had considered that the SWAP bit was set in the mode register but repeated reads of the mode register indicate that the bit is not set. I even double checked by decoding the data on the SPI bus thinking perhaps I still and an interface issue.

I do believe that at one time it worked. I have notes that show changing current and not voltage. A lot has happened since that test. The SPI interface was changed to bit bang using direct port manipulation rather than using digitalReadWrite routines. I also implemented the zero crossing interrupt and the read of the RMS values inside the ISR.

I also have noticed that the phase of the voltage and current seems to swap on a daily basis. A few days ago, the phase was reversed and I swapped the direction of the CT around to fix. And yesterday I had to swap it again to get them back into phase. This seems to be very strange behavior and I wonder if it is related to the VI swap?

I also did some research and realized that the Arduino does have a hardware based SPI interface. This should be much faster than my bot bang approach and I will switch over shortly. If I can minimize the SPI time, I might just be able to sample waveform data at the slowest rate. This will go on the back burner till I solve the swap issue.

This entry was posted in Home Energy Monitor, Projects. Bookmark the permalink.