WCS 1800 (Hall effect sensor) Doesn't detect current

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.

Thanks for any help!

Thanks.

Please make and post schematics.

And how much is that relay drawing current? 100mA?

Hello, I drew the schematic.

It draws 400mA. The sensor is the 35A one, do you think it is too small for the sensor to detect?

It's lowish. For testing I would try something higher.
Also do you pass only one wire through the sensor? Not + and - together.

Also do you pass only one wire through the sensor? Not + and - together.

I just pass the wire to the relay from the power supply (adapter). Am I supposed to pass the wire twice to create a difference?

"wire" means +5V or +5v and gnd together? Aka cable.

Yes the +5v and ground cable

they are canceling each other. +400ma-400ma= 0mA
You need to pass only +5V without gnd.

There must be a signal GND to the F-beam.

Do I connect the ground from the sensor to the T-Beam instead of the ESP-32?

I tried it but the reading seems to be at 0 still

As already said:

  • all gnd have to be connected together
  • only 1 wire have to pass inside the transformer ( not the cable with 2 wires )
  • the esp32 is not 5V tolerant ( inside the t-beam there is an esp32 )
  • your sensor works even with 3.3V so power it with 3.3V
  • the sensibility is 72mV/A so at 0.4A your reading is 28.8mV ( +vcc/2 as the output of the sensor is centered at vcc/2 )

P.S.
Is the t-beam a lylygo t-beam ( so why powering the sensor from a different esp32 and not directly from the t-beam )?

Did you read post#11? Without gnd you don't get that sensor output voltage on gpio35

And what's the role of that other Esp32 on your setup??

To the GND of the A0 input circuit.

Hall effect sensors detect magnetic fields, not current. Make the field stronger by wrapping the power supply wire around a small iron core.

Thank you for the reply. I changed the circuit as you mentioned. However, I still face an issue.

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.

Thanks

Hi, @lakindumuhandirumge
Ops sensor
image

Wind the wire through the sensor loop three or four times, that will give you a bigger output for a given current.

Do you have a DMM? (Digital MultiMeter)

Measure the DC volts on the sensor output with respect to gnd.

Can you post some images of your project?
So we can see your component layout.

Tom... :smiley: :+1: :coffee: :australia:

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 )?