hey can anyone help me on how to connect my acs712 current sensor to the bulb which is connected to 230V 50 hz supply ?
previously when I connected one end of the sensor to the load, another end of sensor to ground of mains and another end of load to the live wire of 230 V mains I blew the fuse.
what extra do I need to connect that the current sensor will work and give me the readings ?
kindly tell me the connections ?
your help would be much appreciated
thank you so much
you connect a sensor in series with the load when measuring current.
so thats how i connected right ? can you please tell me how to connect in detail. acs712 seems to give me the same reading 2.5 V (that corresponds to 0 amps ) if i connect load or not. please help
Firstly, a bump after 15 minutes? You have to be joking. This is a forum of volunteers that sometimes like to have a life away from sorting out other's problems. Also not everyone knows everything so there may not be anyone who knows the answer.
Secondly, treat ALL mains connected boards very carefully. There is mains voltage on the PCB tracks and these can very easily be touched.
Attach a photo of the circuit or a clear photo that shows all connections. Don't bother posting if we cannot see the details clearly.
Weedpharma
This is exactly how i connected my sensor. Only the source was AC 230V mains. can anyone help ? i am not getting any change in Vout

Now how about the program so we can see how you are reading it.
Weedpharma
#include <SoftwareSerial.h>
#include <stdlib.h>
// LED
int ledPin = 13;
// LM35 analog input
int lm35Pin = 0;
// replace with your channel's thingspeak API key
String apiKey = "T2RJXWQAVXG4ZV39";
const int currentPin = 3;
const unsigned long sampleTime = 100000UL; // sample over 100ms, it is an exact number of cycles for both 50Hz and 60Hz mains
const unsigned long numSamples = 250UL; // choose the number of samples to divide sampleTime exactly, but low enough for the ADC to keep up
const unsigned long sampleInterval = sampleTime/numSamples; // the sampling interval, must be longer than then ADC conversion time
const int adc_zero = 510; // relative digital zero of the arudino input from ACS712 (could make this a variable and auto-adjust it)
// connect 10 to TX of Serial USB
// connect 11 to RX of serial USB
SoftwareSerial ser(10, 11); // RX, TX
// this runs once
void setup() {
// initialize the digital pin as an output.
pinMode(ledPin, OUTPUT);
// enable debug serial
Serial.begin(9600);
// enable software serial
ser.begin(9600);
// reset ESP8266
ser.println("AT+RST");
}
// the loop
void loop() {
// blink LED on board
digitalWrite(ledPin, HIGH);
delay(200);
digitalWrite(ledPin, LOW);
// read the value from LM35.
// read 10 values for averaging.
// float val = 0;
//for(int i = 0; i < 10; i++) {
// val += analogRead(lm35Pin);
// delay(500);
// }
unsigned long currentAcc = 0;
unsigned int count = 0;
unsigned long prevMicros = micros() - sampleInterval ;
//float rms=0;
while (count < numSamples)
{
if (micros() - prevMicros >= sampleInterval)
{
int adc_raw = analogRead(currentPin) - adc_zero;
currentAcc += (unsigned long)(adc_raw * adc_raw);
++count;
prevMicros += sampleInterval;
}
}
float rms = sqrt((float)currentAcc/(float)numSamples) * (75.7576 / 1024.0);
Serial.println(rms);
// convert to temp:
// temp value is in 0-1023 range
// LM35 outputs 10mV/degree C. ie, 1 Volt => 100 degrees C
// So Temp = (avg_val/1023)*5 Volts * 100 degrees/Volt
// float temp = val*50.0f/1023.0f;
// convert to string
char buf[16];
String strCurrent= dtostrf(rms, 4, 1, buf);
Serial.println(strCurrent);
// TCP connection
String cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += "184.106.153.149"; // api.thingspeak.com
cmd += "\",80";
ser.println(cmd);
if(ser.find("Error")){
Serial.println("AT+CIPSTART error");
return;
}
// prepare GET string
String getStr = "GET /update?api_key=";
getStr += apiKey;
getStr +="&field1=";
getStr += String(strCurrent);
getStr += "\r\n\r\n";
// send data length
cmd = "AT+CIPSEND=";
cmd += String(getStr.length());
ser.println(cmd);
if(ser.find(">")){
ser.print(getStr);
}
else{
ser.println("AT+CIPCLOSE");
// alert user
Serial.println("AT+CIPCLOSE");
}
// thingspeak needs 15 sec delay between updates
delay(16000);
}
Is the code and connections right ?
To save us a lot of reading, write a simple program that leaves out all but that required to read the sensor and output the analogue value to the serial monitor.
This will test your sensor and basic read code. Once you get a meaningful readout of the analogue value, add in the conversion.
Read the sensor only a few times rather than 250 as you are doing now. You don't need so many.
Weedpharma
Please put your code in its own window as seen in other posts. This can be done by placing [code] and [/code] around the code or use the </> icon. This makes it easier for others to read.
How to use this forum
You can edit the original post to put the code tags around the code.
Weedpharma