@ZenBlizzard in case you are measuring the output with a multimeter, you will get an averaged level, since AC current waveform should be sinusoidal and overlapped with the Vcc/2->2.56V in your case.
To measure the current you need a decently high sampling and some math.
#define SENSITIVITY 66 // mV/A
const float readings = 5;
const float alpha = 2.0 / (2 * readings + 1);
for (ifor = 0; ifor < 250; ifor++)
{
// Voltage
voltageSampleRead = analogRead(V) * vccRead / 1023 - vccRead / 2; /* read the sample value including offset value*/
voltageSampleSum = voltageSampleSum + sq(voltageSampleRead); /* accumulate total analog values for each sample readings*/
voltageSampleOffsetSum = voltageSampleOffsetSum + voltageSampleRead;
// Current
currentSampleRead = analogRead(I) * vccRead / 1023 - vccRead / 2; /* read the sample value including offset value*/
currentSampleSum = currentSampleSum + currentSampleRead * currentSampleRead; /* accumulate total analog values for each sample readings*/
currentSampleOffsetSum = currentSampleOffsetSum + currentSampleRead;
wait(1);
}
voltageMean = voltageSampleSum / ifor; /* calculate average value of all sample readings taken*/
voltageOffset = voltageSampleOffsetSum / ifor;
reading = (sqrt(voltageMean) - voltageOffset) * 230.0 / 1.0; // read voltage / reported voltage.
voltage = round_to_dp(alpha * reading + (1 - alpha) * voltage,1);
Serial.println(voltage);
if (voltage < 25) voltage = 0;
currentMean = currentSampleSum / ifor; /* calculate average value of all sample readings taken*/
currentOffset = currentSampleOffsetSum / ifor;
reading = (sqrt(currentMean) - currentOffset) / SENSITIVITY * 1000 - currentZeroOffset; // subtract no load current.
if (reading < 0) reading = 0;
current = round_to_dp( alpha * reading + (1 - alpha) * current,2);
Hello, i'm making some progress; received the components this week.
Unfortunately it doesn't work... yet
For now i have SanityCheck failure in to logs.
I'm afraid my soldering of all these little components is not good. I tested with a multimeter the 4 pins and i have continuity on one of them but maybe not the others so i guess i will have to try remelting all these small regulators ???