Help with ESP8266 and relay

Hello and greetings to everyone s, I'm starting in this world and have created a program to control a relay, and I'm desperate not know how to make it work well, please I need you to tell me if the relay behavior is normal.

I use an external source of 5v to power the relay, the ESP8266 to 3.3v and GND are joined.

the GPIO output is 0V and 3.3V when the asset is in the rele the IN has an output 1,60v.

Here comes the problem when I connect the relay IN the GPIO output activates relay me even when the GPIO output to 0V, whereby when the GPIO output active and is set to 3.3v the relay does not change state.

Please tell me if it is normal behavior or what I'm doing wrong.

Thank you very much

Firstly, do not power the relay directly from the output pin. It needs a drive transistor or MOSFET.

A standard transistor drops too much voltage at 5v. So a logic level gate voltage MOSFET is required. This is one where the 3v from the output will fully turn on the MOSFET. Put a 470 ohm from output pin to the gate and a 10k from the gate to Gnd.

Connecting the relay directly to the output pin will draw too much current and can damage the device.

Weedpharma