I’m using a 10mV/Amp CT to read AC Amps, as you can guess the resolution is not great, a 1 Amp change in current makes only about a 20 count change in ADC value. Plan is, feed the top of a 10k/2k divider (divide by 6) from Arduino’s 3.3V supply for virtual ground. That would be 0.55 volts, 50% of the internal VREF, that would give me an ADC counts / Amp of about 95, almost a 5 times increase. Question is would the different divider Rs affect the AC symmetry?
Current sketch below:
double AmpsRMS = 0;
Voltage = getVPP();
VRMS = (Voltage) *0.707;
AmpsRMS = (VRMS * 10)/mVperAmp;
Serial.println(" Amps RMS");
int readValue; //value read from the sensor
int maxValue = 0; // store max value here
int minValue = 1024; // store min value here
uint32_t start_time = millis();
while((millis()-start_time) < 1000) //sample for 1 Sec
readValue = analogRead(sensorIn);
// see if you have a new maxValue
if (readValue > maxValue)
/*record the maximum sensor value*/
maxValue = readValue;
if (readValue < minValue)
/*record the maximum sensor value*/
minValue = readValue;
// Subtract min from max
result = ((maxValue - minValue) * 5.0)/1024.0;
Are you sure that compiles? The variables you use in the loop function are only declared in the getVPP function and so would be out of scope when you come to use them. Also multiplying an int by a float is going to be inaccurate at the best. When you have to do this it is best to multiply the int my 1000 or so first.
As to your stated problem, what is AC symmetry here?
A schematic would be much better in trying to visualise what you have.
Question is would the different divider Rs affect the AC symmetry?
No. A voltage divider simply reduces voltage. It doesn't change the wave shape or symmetry. But, are you even reading the negative half of the AC waveform? (The Arduino can't directly read negative voltages.)
, a 1 Amp change in current makes only about a 20 count change in ADC value.
You're talking about "change", but how much actual current are you measuring? And, what kind of ADC readings are you getting?
The original pgm came from Instructables, I’m only using it for a starting point, it compiles and works OK, I changed some variables to get the right scaling for this sensor.
Sensor is a 1 Amp to 1mA CT with a 100 Ohm burden resistor so output is 100 mV / Amp.
“schematic” is attached.
The accuracy is better then I expected, reading within 3% of a Fluke amp clamp, with a 40 watt load at 120VAC I was reading 0.31 Amps on serial monitor and 0.33 on the Fluke. The problem is with low resolution because of the small signal. I was hoping I could get a higher reading by using the internal aRef and 3.3 volts on the divider, but that entails a 6 times division to get centered in the 1.1 volt aRef, I wasn’t sure if the unequal R1 & R2 would cause the resulting signal to be unsymmetrical + & - or non linear. I was trying to avoid amplifying.
Normally you boost the low voltage signal, rather than compress the ADC range, since you reduce
the ways noise can get into the signal path.
Generating 0.55V from 3.3V is feasible, just be aware the noise/inaccuracy of the 3.3V rail then has
to be factored in. You will probably need to calibrate at start up at least.
Ensure you protect the analog pin from negative voltages (10k resistor in series with analog pin is
one simple way to protect in).
I wasn't sure if the unequal R1 & R2 would cause the resulting signal to be unsymmetrical + & - or non linear.
I can assure that it does not do any of those things.
If you want to alter the sensitivity of this circuit then all you need to do is to alter the value of the burden resistor.