PIR AM312 to XIAO SAMD21 261113

Thread Starter

allenpitts

Joined Feb 26, 2011
185
Hello AAC forum,

A system was designed and built to turn on a 12 volt
under cabinet LED light system in my kitchen using a PIR
(motion detector) and a microprocessor, XIAO
SAMD21 by Seeed Studio.

Closet_SEED_XIAO_schematic_240826.jpg


The system worked as designed for about a year
and a half. Now the lights stay on and do not
go off after five minutes as the SAMD21 is
programmed, sketch attached herewith below.
Or system goes low for a second
and comes back on again.
closet_xiao_PCB_top_layer_b_&_w_240930.jpg

The first test was on the PIR. The PIR tested normal.
That is when i wave my hand at the lens the output
pin reads 3.1 volts for two seconds.

closet_xiao_SAMD21_PCB_261113.jpg

The second test was at the Gate of the UIRF540
transistor. With the PIR isolated the voltage
at the gate reads 3.2 volts. But the reading
should go to zero after twenty seconds.
The operation is inconsistent. Sometimes
it goes low after twenty seconds as designed
but sometimes it stays on. In other tests
the reading goes low but even with the
PCB completely isolated, inside a cardboard box, for
no apparent reason the reading goes
to 3.2 volts.

The conjecture was that the SAMD21 was
failing and sending a false positive
but tests have been with two other
new from the package SAMD21s exhibit the
same behavior. It seems
highly unlikely that all three microprocessor
would fail and fail in the same way.

Allen Pitts
 

Attachments

sghioto

Joined Dec 31, 2017
8,765
Have you checked the output of the 5 volt regulator?
I would also suspect the PIR. Try replacing that module?
 
Last edited:

MisterBill2

Joined Jan 23, 2018
28,636
Certainly the first check would be the supply voltage level, as already suggested, then followed by a check for noise, first on the supply voltage and then on the system common line, although my fiirst step would be to inspect all of the connections.
An additional response a few days later:
If that failure fault is intermittant then a poor connection would be a prime suspect. AND, even if the fault is consistent rather than occasional, a failed connection is a reasonable cause.
A notorious location for random failures is the solder connection between the post of the terminal strip and the trace on the bottom side of the PCB. The twisting torque of tightning the terminal screw cracks the inadequate solder connection, but the failure happens much later when temperature changes or random vibration disrupt the connection just a bit.
The repair is simple and cheap: Just re-solder the terminal strip connections, adding a bit more solder.
 
Last edited:
IRF540 is not a low voltage drive mosfet, it needs at least 4.5V gate drive and preferably 10V.
VGS(th) is typ 3V max 4V. So you are barely giving it much gate drive and likely the part ran hot and drifted. I could not find datasheets for the "UIRF540Z"
I would change to a 3.3V logic-level power mosfet, or add a gate-drive level shift transistor. Not sure how much current the LED's draw.
edit: I find the IRL540N is logic-level and a suitable power mosfet for 3.3V drive from an MCU. I would replace the IRF part with that.

Also check your firmware does not configure the MCU pin as open-drain.
 
Last edited:
Top