Seeed XIAO SAMD21 with PIR 250303

Hello forum,

Have built and installed a half dozen closet lights
that use PIRs (motion detectors) to turn three
12 volt lamps on for a minute.=, schematic attached.

The timer is a microcontroller called XIAO SAMD21

A couple of the closet lights have failed, not because
they won't come on but because they won't go off.

First the PIR was tested to make sure that is
going from high to low so the PIR wasn't the culprit.
But the PIR, which are very reliable, operates
normally in a test circuit.

The XIAO SAMD21 was then tested and the MC seems
to be normal. Also LED D1 acts as a sort of heartbeat
for the XIAO and LED D1 operates as expected,
blinking on and off every three seconds.

The only other component that might fail is the
MOSFET. Very difficult to test a transistor once
soldered into the PCB. So, the MOSFET was removed
and replaced with a brand new, freshly tested
unit.

Out of desperation a new XIAO was unpackaged
programmed and installed. Same result. The
load lights come on but will not go off.

It is unlikely that there is a problem with
the sketch since the same program is being
used in four other systems that are operating
normally.

I am at the end of my troubleshooting
skills rope.

Thanks.

Allen Pitts

No sketch, no series gate resistor, no pulldown gate resistor...

Hello van_der_decken and the Arduino forum,

Although the sketch as a point of failure as pretty well been eliminated by use i systems that are working, the sketch is attached as requested.

...no series gate resistor, no pulldown gate resistor...

By series gate resistor it is conjectured what is meant is a resistor, say , 3.3k, between the trace that runs from XIAO pin 3 and Q2 gate and ground.

Not sure what is meant by pull down gate resistor. It is understood that a pulldown resistor is a resistor set to keep a logic node from floating, so the resistor is used
to make the node be low. But where, exactly would the pulldown resistor go? Approx. value?
Thanks.
Allen Pitts

Closet_ATtiny85_240120.ino (3.8 KB)