I am trying to use the WCS1800 to detect the current passing through a wire. However, the adc value remains at 0.
The Aout pin is connected to GPIO pin 35 of T-Beam .
The wire passing through the sensor supplies 5V, 2A power the RS485 relay. The current direction is also correct yet the adc reading remains 0. Below is the code I use.
int currentpin = 35;
void setup() {
Serial.begin(115200);
pinMode(currentpin, INPUT);
}
void loop() {
int adc = analogRead(currentpin);
Serial.print("ADC value is: ");
Serial.println(adc);
float adc_voltage = adc * (5 / 4096.0);
Serial.print("ADC voltage value is: ");
Serial.println(adc_voltage);
delay(10000);
}
And for anyone concerned why I am directly connecting the Aout pin to the T-Beam insteading of using a voltage divider to step it down to handle 3.3V, the T-Beam can take upto 5V without an issue. I confirmed it with the manufacturer.
This time I have connected the sensor's Vcc, gnd and Aout pins to T-Beam only. ESP32 is being used to power up the RS-485 relay.
I can now get a reading on the GPIO of T-beam. However, this value which is around 2800 (adc value) doesn't change when I power up the esp32 (the relay). It seems to be constantly around that region.
The output of the sensor is ratiometric and centered around vcc/2 ( ie 2048 raw ad ) so 2800 is a little bit too much.
The fact that the reading is not changing too much is 'normal' considering the sensitivity of the sensor around 53mv/A ( when powered at 3.3V ) which is very low for your use, to increase sensitivity wind the wire in more loops ( 10 loops = 0.5V/A which is still not a great sensitivity if you are sensing 400mA )
Did you mount the sensor correctly ( the arrow should point the vdd pin )?
Also what is a rs485 relay?
Are you sure esp32 is capable of supplying 400mA to this rs485 relay ( did you measure it )?