MoloWorks account

Welcome back.

Sign in to continue where you left off.

Forgot password?

New to MoloWorks?

EQ-15 · PIR motion sensor

Detect motion after the sensor settles

A passive infrared sensor for detecting movement. Starter includes one AM312 or SR602, depending on stock. Full includes one SR602.

AM312 mini PIR motion sensor module reference

How to use it

You’ll need: ESP32-S3, the supplied AM312 or SR602 PIR, USB data cable, and jumpers.

Connections

This example uses one part at a time on the MoloWorks ESP32-S3. If a course uses different GPIO pins, follow that course’s wiring and code together. Disconnect USB and any external power before changing wires.

On the partConnect to
AM312 VCC or SR602 +ESP32 3V3
AM312 GND or SR602 −ESP32 GND
AM312 VOUT or SR602 OUTESP32 GPIO4 input after checking the output level
  1. Identify the model and read its labels. Starter contains one AM312 or SR602; Full contains SR602. Match the labels rather than copying the other model’s physical pin order.
  2. Use 3.3 V supply and check the signal level before connecting the output to the ESP32. Position the sensor where you can move across its view and then step out of it.
  3. Let the output settle with no motion, then run the example and walk across the sensor’s view. Wait for the output to return to idle before the next pass.

MicroPython example

Run this on the board with your MicroPython editor. Set up the ESP32-S3 first if you don’t have a working connection.

from machine import Pin
from time import sleep_ms

pir = Pin(4, Pin.IN)
last = None
while True:
    value = pir.value()
    if value != last:
        print("motion" if value else "idle")
        last = value
    sleep_ms(100)

What to look for: You see an idle-to-motion transition and a return to idle. The module’s delay varies by model. Stop the loop with Ctrl-C.

AI prompt

Copy the prompt and replace any brackets with details from your kit. Check the suggested wiring against the labels on your parts before applying power.

Detect motion after the sensor settles

My kit includes one [AM312 or SR602] PIR with labels [actual labels], powered at 3.3 V and read on GPIO4 by an ESP32-S3 running MicroPython. Help me check the pin order and output level, then log changes after the sensor settles. Give me a walking test and explain why the output may stay active briefly after I stop moving.

Contact QR code

Open contact