0
\$\begingroup\$

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.

Schematic

\$\endgroup\$
4
  • 3
    \$\begingroup\$ No diode across the relay coil; your MOSFET might be fried. \$\endgroup\$
    – vir
    Commented Jul 28 at 19:35
  • \$\begingroup\$ There are two MOSFETs in the circuit, one them does not have any pull down resistor on its gate, why is that? \$\endgroup\$
    – Andromeda
    Commented Jul 28 at 19:53
  • \$\begingroup\$ @vir The MOSFET is avalanche-rated, so it might be fine. Depends on how much energy is in the pulse (it's rated to 25 mJ). \$\endgroup\$
    – Hearth
    Commented Jul 28 at 20:24
  • \$\begingroup\$ @Andromeda I just did that because that was the mosfet that I was having trouble with... so I just tried that. The other mosfet is driving the motor, which was working reliably. \$\endgroup\$
    – Neel
    Commented Jul 28 at 21:47

2 Answers 2

2
\$\begingroup\$

Check the gate voltage and the drain voltage - at 3.3V the FET should be able to pass a couple of amps, but it’s far from fully switched on. This might result in the drain not pulling down low enough. The relay will hold engaged with less voltage than what it takes to engage in the first place so you may find that it won’t engage reliably. If that’s the case you’ll want to find a FET with a lower threshold voltage, or use a BJT.

\$\endgroup\$
4
  • \$\begingroup\$ This seems to have worked... switching to a BJT seems to reliably turn on the relay. I'm still not quite sure though why the MOSFET that is actually turning on the motor works. It's the same FET driven by the same 3.3V, but the fact that it's driving a motor works fine. I'm assuming it's something to do with the motor drawing more amps than the relay. \$\endgroup\$
    – Neel
    Commented Jul 28 at 21:44
  • \$\begingroup\$ @Neel You're running the mosfets outside of their specifications. 3.3VGs is above the "starts to turn on" threshold, but below the threshold where it can be considered fully on. Thus the mosfet is "on a little bit". How well it'll work will vary with temperature, it will vary from one part to another, and it will vary depending on the position of the moon. If you want guarantees, design to the specifications. \$\endgroup\$
    – marcelm
    Commented Jul 29 at 7:37
  • \$\begingroup\$ @marcelm I think I see. I was looking at Vgs which is the minimum voltage to turn it on. I really should be looking at Rds On with is 10V for that mosfet, right? \$\endgroup\$
    – Neel
    Commented Jul 29 at 17:43
  • \$\begingroup\$ @Neel Correct; Vgsth is the voltage where the mosfet just barely starts to turn on (usually defined as passing 250µA current). Ideally, you want one that has an acceptably low worst case Rdson defined for your target Vgs in the electrical characteristics (yours has no guarantee at 3.3V). Barring that, you can look at the graphs and estimate what it'll do at 3.3Vgs, but the graphs are for typical values, not worst case, so that's a bit tricky. For 3.3V and an easy load like a relay, a BJT is a lot simpler, and it is what I'd prefer. \$\endgroup\$
    – marcelm
    Commented Jul 29 at 20:37
1
\$\begingroup\$

I noticed that the RST pin of the MCU is floating. It is essential to use a pull-up resistor for this pin to ensure stable operation. Without it, the circuit may behave unpredictably and be susceptible to noise-induced resets. Additionally, consider adding more decoupling capacitors to the VCC pins to further stabilize the power supply and reduce noise.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks! I'll add one in! \$\endgroup\$
    – Neel
    Commented Jul 28 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.