I'm hoping someone could tell me where I messed up in my circuit.
I am controlling the direction of a motor using a relay. The relay is 5 V, and I'm using a ESP32 which is 3.3 V, so I'm turning on the relay using a MOSFET.
The MOSFET is a TSM900N06CH X0G.
The relay is a J104B2C5VDC.20S.
The relay does not seem to turn on all the time. Sometimes when I start my circuit, the relay will never turn on. Then I move the board, or measure a voltage across the MOSFET, and then it suddenly starts working. It turns on and off as expected then.
I tried adding a 10 kΩ resistor (R1 in the diagram) on the MOSFET, but I'm still having issues.
It's something with the MOSFET and relay combination as the separate MOSFET that I have to turn on and off the motor works every time.