ADS1015 as ammeter for AC Mains in Differential Mode

There was another discussion with getting the hardware right for using an ESP8266 + ADS1015 to act as an ammeter for 2x 120v Mains (US) measuring up to 65Amps:

https://forum.arduino.cc/index.php?topic=562406.0

Now I am trying to work on the code.

void adsSetup(){
  ads1015.begin();
  ads1015.setGain(GAIN_TWO); // 2x gain   +/- 2.048V  1 bit = 1mV
}

Here i am setting up the ADS and setting the gain to 2x. This is because I am using 2x 100A/1V CTs and my circuit has an offset of ~1V. so my range will be 0-2V.

in the examples I see from Adafruit, there is this line:

  /* Be sure to update this value based on the IC and the gain settings! */
  float   multiplier = 3.0F;    /* ADS1015 @ +/- 6.144V gain (12-bit results) */
  //float multiplier = 0.1875F; /* ADS1115  @ +/- 6.144V gain (16-bit results) */
float   multiplier = 3.0F;    /* ADS1015 @ +/- 6.144V gain (12-bit results) */

what sorcery was used to find the multiplier? I changed the gain therefore it stands that this needs to changed too, just dont know to what.

Now... the goal is to take a quick set of samples and get out of the loop. the esp is doing a lot of other stuff. I have looked at a ton of examples of others measuring current, and the calculations are much more complicated that I imagined. Also, it seems that using the adafruit library has an issue where I cannot sample fast enough due to delays. I have to do more research and get my CTs in. just throwing this out there in case someone else has already addressed these issue. if not, this will be the thread where they are addressed.

ok, 100% of the examples show some form of SCT-013-xxx which is rated at xxx Amps/xx mAmps.

I am specifically using the SCT-013-000V so the burden resistor is built in and sends anything from -1V to 1V. with an 1V offset, that brings it to 0-2V.

here is a common function that people use (and its over there on openenergymonitor.org)

float getVPP()
{
 float result;
 int readValue; //value read from the sensor
 int maxValue = 0; // store max value here
 uint32_t start_time = millis();
 while((millis()-start_time) < 1000) //sample for 1 Sec
 {
 readValue = analogRead(sensor);
 // see if you have a new maxValue
 if (readValue > maxValue)
 {
 /*record the maximum sensor value*/
 maxValue = readValue;
 }
 }

 // Convert the digital data to a voltage
 result = (maxValue * 5.0)/1024.0;

 return result;
}

first thing is I need to convert my ads values to a voltage. since i changed my gain to 2x, that means i have 12 bits to represent ~2 volts. and 1 bit = 1mV.

how does one do that? im not looking for the answer, just "how".

I found that 12 bits = 0-4095 0 = 0v and 4095 = ...wait a minute...

0 = -2.048V and 4095 = +2.048V

If an sample is taken, and the Leg 1 of my mains shows 100Amps constant, that means pin 0 (- side of ct) would show 1V (2V to the ADS) and pin 1 would show 0V (1V to the ADS). The differential would equal 1V.

so the sample from the ads to the esp should show ~3072?

different sort of question:

if I use continuous mode, and wire up an interrupt pin, how often would the sampling interrupt my esp?

2nd question, does it make sense to use continuous mode, and just grab the last conversion results when my esp is ready? (instead of using an interrupt) i am assuming that with 1600 samples per second, my esp is not going to be able to do anything else.