How to create a movement sensor alarm with Red Pitaya
-
Posted by
Red Pitaya Team
, July 1, 2020
The PIR motion sensor will detect moving persons, while the LED and buzzer will sound the alarm. There is also an option to remotely disable the alarm by pressing an on-screen button.

Step 2
The main block contains a loop repeating 10 times each second. Inside, the loop the motion sensor is checked and its status is stored into the variable status. If motion is detected the program will start executing another loop, which will sound the buzzer and blink an LED 60 times, unless in the meantime the variable status changes to false.

Step 3
The third block is a function from Program > Functions > to [] []. Functions are used to store code which is used in multiple places. In this case the function is named timestamp, since when executed, it will return a string containing the current time. If you look at the first two blocks, you will see that one prints the alarm start time, the other the alarm stop time, both use the same timestamp function to provide the time string.

Step 4
About the Red Pitaya Team
The Red Pitaya editorial team consists of engineers, researchers, and product experts who develop and test cutting-edge open-source test & measurement solutions.
Our mission is to make advanced instrumentation accessible to everyone — from students and educators to leading research labs worldwide.