Problem with input pin on ESP32

Hello! I’m having some problems with my ESP32. I’m bulding a project on a breadboard, have some relays, actuators and sensors. I have 5 pins (set as outputs) to activate 5 different relays(pins G4, G16, G17, G5, G18), and 2 pins (set as digital inputs) to receive on/off signals (pins G19, G21). I have a 3.3V line on the breadboard for the sensors. When the input pins receive a 1, the relays must activate. For some reason, when I manually connect and disconnect the 3.3V to the input pin, it kind of works. When I contact the pin through the breadboard, the serial comm on my computer prints correctly, and the relays do their thing, but if I remove the contact, the pin stays energize, as if something was giving it 3.3 V, when there is nothing connected to it. After a while it goes back to 0 and starts going back and forth, like if a someone was randomly connecting and disconnecting a cable with 3.3V to that pin. I measured the voltage, and there is actually voltage on the pin while nothing is connected to it. Strangely, if a contact the pin on the top part of the ESP32 (where you can see the labels of the pins) this weird behavior doesn’t happen, works perfectly. I thought it might be the breadboard, but I change it with a brand new one and the problem persisted.

Thanks in advance!

that’s called a “floating pin”. What one will typically do is to active a pull down or pull up (depending on your use case and pins).

That sounds weird. Maybe a broken solder joint or something?

You might wanna drop a photo of your build and your yaml (if you use esphome)