I have a circuit that consists of a relay, two NMOS transistors and some pin headers used for connecting a load.

enter image description here

enter image description here

The differential input voltage is connected to J20. The relay acts as a switch controlled by Q6 driven by an onboard Arduino Micro. When the relay is closed and a load is connected between J21 and J22 current can flow in a closed loop.

\$V_\text{SUPPLY}\$ is a 5 V voltage supplied from a lab bench power supply. \$V_\text{SUPPLY}\$ and the Arduino Micro have common GND.

R28, R29 and R30 are unused.

Q12 (also controlled by the Arduino) acts as an additional switch that makes pin 1 and 2 of J22 able to carry current as well. This is the transistor I have trouble with. It never seems to turn fully off or fully on and sometimes the behavior is totally unpredictable.

I made a test load consisting of a \$220 \ \Omega\$ resistor in series with a diode. I turn on the relay and Q12. When I connect the load across pin 1 and 4 of J21 and J22 respectively it pulls a constant 14.769mA, as it should. If I instead connect the load across pin 4 and pin 1 of J21 and J22 respectively the current is 7 mA and it keeps decreasing until it reaches 0 mA.

Pictures of test setup: -

enter image description here

My first thought was that Q12 was damaged from ESD, and so I have changed it two times but the unwanted behavior persists. I have also tried replacing all the surface mount components but nothing changed.

I haven't changed the relay or pin headers, but I have no reason to believe they could cause any problems. What could be wrong with my circuit or components?

Note that there are 4 identical circuits on the same board. The 1st and 4th circuit have this unwanted behavior with Q12, and it seems after further investigations that the 2nd also suffer but the 3rd is fine. I suspect that it is because the source of Q12 is not at the same potential as the Arduino's GND but that doesn't explain how circuit 3 acts as it it supposed to.

My PCB layout can be seen here.

Entire circuit board

enter image description here

Using the same power supply terminal as both \$V_\text{SUPPLY}\$ and as input voltage removes the problem - probably because the source of the MOSFET is now GND and not floating: -

enter image description here

  • 1
    \$\begingroup\$ What is the voltage at Q12s gate when on / off? \$\endgroup\$
    – MiNiMe
    Oct 9, 2023 at 10:37
  • \$\begingroup\$ @MiNiMe It is 0 V with respect to the Arduino's GND. By the way, I just noticed that connecting the ground clip of my oscilloscope probe to the GND header (31) affects the circuit behavior. Also, unplugging my computer (which the Arduino is powered by) from the wall did something. \$\endgroup\$
    – Carl
    Oct 9, 2023 at 10:43
  • \$\begingroup\$ Check that your grounds are truly connected. || If scope does not have groundedearth wire then scope ground can have highZ Vmains/2 on it. || What is Arduino supply voltage? 5V = Vsupply or other? (THat's inferred but MAY be ambigiuous.) \$\endgroup\$
    – Russell McMahon
    Oct 9, 2023 at 12:18
  • \$\begingroup\$ @RussellMcMahon The Arduino is supplied via my computer through a micro-USB. \$\endgroup\$
    – Carl
    Oct 9, 2023 at 12:31
  • \$\begingroup\$ @RussellMcMahon I know comments aren’t suited for discussions, but would replacing the NMOS transistor with a BJT mitigate the problem with the floating source? I have no experience with BJT’s other than they are current controlled. \$\endgroup\$
    – Carl
    Oct 9, 2023 at 15:43

1 Answer 1


You don't have common GND between the circuit you're driving and the Arduino + relay circuit. As the gate voltage is relative to the source, Q12 floats (if that term can be used here). If you need to keep the two GND separated use an optocoupler or another relay.

  • \$\begingroup\$ Though I agree, I was hoping for another answer than this because this doesn't explain everything. Circuit 3 on my board is works exactly as it should even though that circuit's MOSFET's source is also floating. \$\endgroup\$
    – Carl
    Oct 9, 2023 at 11:33
  • \$\begingroup\$ So there's more? Could you be kind and add that circuit as well? \$\endgroup\$
    – MiNiMe
    Oct 9, 2023 at 11:45
  • 4
    \$\begingroup\$ Without seeing that part of the schematic, it is impossible to say. However, an floating 2N7000 gate is a very small capacitor with a parallel resistance of G ohms. At that impedance, fingerprint oil on the PC board can affect behavior. \$\endgroup\$
    – AnalogKid
    Oct 9, 2023 at 11:46
  • \$\begingroup\$ @MiNiMe It's the same circuit copy pasted 4 times (as seen in the pictures of my setup), so the topology is identical. Therefore, there should be no difference between the two's operation. \$\endgroup\$
    – Carl
    Oct 9, 2023 at 11:52
  • \$\begingroup\$ Do all the controlled circuits have common ground? \$\endgroup\$
    – MiNiMe
    Oct 9, 2023 at 12:04

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.