I bought an ACS723 low current at SparkFun, this sensor can measure AC and DC low current, but when I try to measure AC current (100mA) sensor doesn't work, is anyone have already used this sensor with 220v ??
My output never change for AC current.
He works weel with DC current (same current 100mA)
Where is you code you used? Please read How to use the forum before posting it.
PS Yes, it can do AC current, but it only gives you the instantaneous current. Aka, you have to time the measurements and/or do RMS/average calculations.
const int analogInPin = A0;
// Number of samples to average the reading over
// Change this to make the reading smoother... but beware of buffer overflows!
const int avgSamples = 10;
int sensorValue = 0;
float sensitivity = 100.0 / 500.0; //100mA per 500mV = 0.2
float Vref = 2570; // Output voltage with no current: ~ 2500mV or 2.5V
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
double VRMS = 0;
void loop() {
// read the analog in value:
for (int i = 0; i < avgSamples; i++) {
sensorValue += analogRead(analogInPin);
delay(2);
}
sensorValue = sensorValue / avgSamples;
// The on-board ADC is 10-bits -> 2^10 = 1024 -> 5V / 1024 ~= 4.88mV
// The voltage is in millivolts
float voltage = 4.88 * sensorValue;
VRMS = (voltage/2.0) * 0.707;
}