Hi,
I’m trying to build my first Arduino project, and have learned a ton from this site and it’s forum. However I seem to be stuck, so hoping someone could have a look at what I’m doing wrong. Pardon any wrong terminology here…
I’ve got a NodeMCU ESP8266-12E, and an ads1115 16-bit (differential mode) hooked up with my SCT-013-000 (22Ohm burden resistor). So far so good, I’ve got various test-sketches to see that I’m actually reading data and it seems pretty reasonable.
ads1115 running on 3.3V from the esp8266-12E, and its set up with gain=1 meaning it’s measuring +/-4.096V and the resulting count should be -32768->32765
Quite a few of my samples are -31869, and I’m suspecting the minijack-barrel on my breadboard which is poorly fastened. Still my main issue is the sum in my sketch is returning as “ovf” which I’ve found out is overflow when its passing 2^32. I dont see how I can avoid this if I want any reasonable amount of samples, and its stored as the sum of the squared samples. (Is the ovf just happening in the serial output?)
Here is my current sketch which is likely a poor mix of code, but it’s a result of combining some code from the emonlib library, and some previously ported code from that library which I’ve found. I’ve added various points of serial output to troubleshoot now.
Which outputs something like this, and the resulting calcuation ending at 209A which obviously is far off:
Anyone care to point me in the right direction or want to tell me what I’m doing wrong here? Thanks!