Projects with Blocks·Tutorial 1 of 5

Motion Alarm

Intermediate

Build a working motion alarm using the HC-SR04 distance sensor. When something moves within range, the RED LED lights and the buzzer sounds. Adjust the sensitivity with a distance threshold.

25 min6 steps
DistanceHC-SR04AlarmLEDBuzzerProjectIntermediate
0 of 6 steps

Step 1 of 6

Connect your board

Power on your Beaver Board — the OLED will show a PIN code. Click Connect in the toolbar, choose Connect via Bluetooth, and select your board. If it's your first time, enter the PIN shown on the screen.

The HC-SR04 ultrasonic sensor is already wired to GP16 (TRIG) and GP17 (ECHO) — no extra connections needed.