Skip to main content

Sugar PIR Sensor

Detects the movement of people or animals, and changes the digital level when triggered.

It can be simply understood that the PIR sensor is a special type of "button" whose trigger condition is the presence of a living creature moving in front of it.
![image.png](方糖 人体红外.assets/1623406507499-610c3c01-bc7c-45cf-a401-7a3e614722fc.png)

Parameters


Size24 x 24 x 19 mm
Weight5.6 g
SignalDigital Input (with blue indicator light)
1 (High level): Detects someone approaching
0 (Low level): No person detected
Range5m

Wiring


Connect using a 3-pin terminal cable to P1 on the Robotbit Edu.

(Any of the eight white terminals can be used for connection. Note that the actual wiring must correspond to the program written.)

After turning on the Robotbit power, you can see the red light at the bottom of the LED module illuminate (indicating the module is powered normally).
![image.png](方糖 人体红外.assets/1631618840694-7424a144-0c40-418a-8600-f1183ff15f40.png)

Programming


Implement sound alert when human motion is detected by Micro:bit

info
  • The working status of the PIR sensor (motion sensor) is indicated by a blue LED indicator.

  • The PIR sensor has a 3-second lockout period. When human motion is detected, it maintains the triggered state for 3 seconds before returning to its normal state.

#PIR Alarm System
When someone passes by the PIR sensor, the Micro:bit is triggered to emit a sound.

The Digital Read block must be used, and the pull-up/pull-down resistor must be initialized during setup. Otherwise, detection may be abnormal.
![image.png](方糖 人体红外.assets/1633605408076-366d026d-f0fc-4eab-a11e-a7b8d29b0b7d.png)

image.png