Esp8266 doesnot sense my sensor output

I'm using non contact liquid sensor to measure level using esp8266 but serial monitor is always high even though my sensor is low

Post your code and a schematic of your project.

Exactly which sensor are you using ?

this is the program

int Liquid_level=0;
void setup()
{
Serial.begin(9600);
pinMode(12,INPUT);
}
void loop()
{
Liquid_level=digitalRead(12);
if(Liquid_level=HIGH)
{
Serial.println("full");

}
else
{
Serial.println("low");
}

Serial.println(Liquid_level,DEC);
delay(500);
}

im using Non-contact Digital Water / Liquid Level Sensor For Arduino (XKC-Y25-T12V)

Is there a LED indicator on the sensor? Does the LED light when liquid detected?

The data sheet that I found says the supply voltage needs to be 5 to 24V. How are you supplying the power to the sensor? What is the output voltage on the sensor unit? You will need to level shift a 5V output to 3.3V for the ESP input or risk damage to the ESP.

yes there is led indicator and it works fine

my connection img is attached here(sry if its very bad)
im using LM2596 voltage regulator to step down from 9v to 3.3v for esp8266
and 9v battery for sensor
the serial monitor only shows high

You must connect the minus side of the battery connected to the sensor to the ESP module ground.

Op image so we don't have to download it:

What is the output of the sensor when HIGH? If it is 9V you may have already killed the ESP input.

Sry for late reply had to borrow some multimeter to check for sensor output it was 2-3mV for low and 8 mv for high

Samuel_Asher:
Sry for late reply had to borrow some multimeter to check for sensor output it was 2-3mV for low and 8 mv for high

Which GND connection did you measure it against or did you connect them as advised ?

Whichever it was, the ESP has no chance of differentiating between the two voltages or responding to either of them.

Either the sensor is broken, you have not wired it correctly or you have misinterpreted the output

I measured it against the battery and sensor's common as theyre connected together
Yes i have connected as u advised

The sensor is not broken for sure when i connected it voltage regulator input , the regulator corresponded to the sensor output , which happened unexpectedly

In the picture I see no ground connection between the sensor and the ESP.

I changed it now after u guys told me still no change

Samuel_Asher:
Sry for late reply had to borrow some multimeter to check for sensor output it was 2-3mV for low and 8 mv for high

I did not look at the spec sheet.

If you are sending a mV signal to the ESP8266, then, to me, you are receiving a analog signal. I am going to guess that the LM2596, a Switching Power Supply is just doing its thing and making voltage and that's why you will always get a 1.

A LM2596 is Not a level shifter.

get a phone charger.
plug it in to the USB port on the ESP
connect the 5V pin frm the ESP board to the Vcc connection of the special board for the sensors (not shown in your drawing)

connect the ESP ground to the special board as well

connect the output for the device to your pin.

the output will equal the Vcc voltage, so you if you power it with 9v, you will inject 9v into the EXP pin. I do not think they can tolerate more then 5v.
SENSOR LINK

Idahowalker:
I did not look at the spec sheet.

If you are sending a mV signal to the ESP8266, then, to me, you are receiving a analog signal. I am going to guess that the LM2596, a Switching Power Supply is just doing its thing and making voltage and that’s why you will always get a 1.

A LM2596 is Not a level shifter.

this note from the data sheet may help

Output voltage (high level) : InVCC
Output voltage (low level) : 0V

The esp8266 doesnot have 5V pin

dave-in-nj:
get a phone charger.
plug it in to the USB port on the ESP
connect the 5V pin frm the ESP board to the Vcc connection of the special board for the sensors (not shown in your drawing)

connect the ESP ground to the special board as well

connect the output for the device to your pin.

the output will equal the Vcc voltage, so you if you power it with 9v, you will inject 9v into the EXP pin. I do not think they can tolerate more then 5v.
SENSOR LINK

dave-in-nj:
this note from the data sheet may help

Output voltage (high level) : InVCC
Output voltage (low level) : 0V

So if i connect it to analog pin will i get atleast some output

"The esp8266 doesnot have 5V pin"

I suggest you get your sensor operating stand alone monitoring the output with a multimeter. If the sensor has an analog output, then use a pot as a variable voltage divider to reduce the sensor output voltage down to the 1.0v max that the ESP8266 A0 expects. If the sensor output is digital, then do the same to reduce the sensor output voltage to the max voltage on the digital input pin.

I'll try and tell thank you guys for your help

This is a classic example of lack of information.
Exactly which Esp8266 are you using?

Post a link to the exact sensor you bought. the link should have specifications for that thing.
the fritzrig does not show the pin numbers or the colors of the wires, etc. so is not as good as a pencil drawing or something done by hand in PAINT. Fritzrrig does has a schematic view that is actuality pretty good.

When i Google your listed part number it showed a sensor with interface board.
the board outputs values equal to the Vcc and Ground of the input.

Typically the reason For the interface board is that the raw signal is not comparable with the arduino

All of the ESP8266 Development boards have a USB connection. And 5v
the board you have might be something else.
but you said you have it connected to the serial monitor.
That too is not shown. The Serial Monitor has to connect to the USB from some place, so there is 5v at that point.
the need for 5v is the sensor interface board is listed with 5v as the minimum.