RMS Current Calculation using ADS1115 and SCT-013-030

I own an ADS1115 and SCT-013-030 (30A/1V). I have been trying to achieve rms current reading using this current sensor through 16-bit ADC. However, could not success at getting the right values. Unfortunately, there aren’t many examples that is done via an ADC. From my readings, I have concluded that my GAIN value needs to be set to 2 and since this version of current sensor has a burden sensor, I connect the positive cable to A0 pin of the ADC and the negative cable to the GND. I also tried the version of reading the differential from A0 to A1 but interestingly, I calculate 0mV from both the ADC voltage and amper meter. Could not find a reasonable explanation though.

@KyleGabriel I also noticed the Energy Usage section in Mycodo but I could not find the source class that you make the calculation using ADC. Could you share the right python file that you achieve it? I also want to verify it by myself to see whether everything works properly.

Thanks in advance!

1 Like

@KyleGabriel As far as backtracking Mycodo, I notice that calc_energy_usage and return_output_usage functions (in mycodo/utils/tools.py) handle the most part of the calculation. But one thing I still could not figure out is whether the RMS current is calculated manually in one of the Mycodo built-in scripts or within the InfluxDB query which happens in the average_start_end_seconds function (mycodo/utils/influx.py).

I’ll need to take a look at the code before I can give you any real response. I just wanted to let you know this thread is on my radar and I’ll check it out soon. It looks like you’re on the right track, though.

Glad to hear that :slight_smile: I will also let you know if I could get accurate results.

hey @KyleGabriel, any chance on this thread?

return_energy_usage() in mycodo/utils/tools.py is what aggregates the Amp measurements for the Current Input energy usage stats. The return values of the function (energy_usage_stats and graph_info) are used in mycodo/mycodo_flask/templates/pages/usage.html.

I’d like to measure the monetary current calculation in Mycodo by plugging the current sensor’s positive and negative sides both in Analog pins in ADS1115 and reading the A0-A1 difference. How can I adapt it in that way? Because there are only options for single Analog pins in the dropdown menu.