感測器模組簡介
RCWL-0516 微波雷達感應開關模組人體感應模組智慧感應探測器 感應距離大約5-7米
腳位定義:
CDS — Sensor disable input (low = disable)
VIN — 4- to 28-V DC supply input
OUT — HIGH (3.3 V) motion detected/LOW (0 V) idle
GND — Ground/0 V
3V3 — Regulated DC output (100 mA max)
RCWL-0516 Doppler radar unit pin out
電路圖
程式列表(IO輪巡式)
Blockly
Python
"""
EPY Sensor
-----------------
3V3 VCC
GND GND
P4 OUT
VIN
CDS
"""
from machine import LED
from machine import Pin
from machine import Switch
import utime
from machine import RTC
KeyA = None
P4 = None
rtc = None
ledR = None
ledG = None
KeyA = Switch('keya')
rtc = RTC()
ledR = LED('ledr')
ledG = LED('ledg')
ledG.off()
P4 = Pin(Pin.board.P4,Pin.IN)
while True:
if (P4.value()) == 1:
ledR.toggle()
ledG.off()
else:
ledR.off()
ledG.toggle()
if (KeyA.value()) == True:
break
utime.sleep_ms( 500 )
執行結果
沒有物體移動綠燈閃爍
有物體移動紅燈閃爍
參考文獻
How to Get Started with a Microwave Radar Motion Sensor
https://www.electroschematics.com/get-started-microwave-radar-motion-sensor/