Back to Parent


Stuff I used:

1. PIR Sensor - HC-SR501

2. 2 LED's - Red, Yellow & appropriate resistors

3. Two way switch

4. Jumper wires

I use a switch to disable the device. A red LED indicates the switch position (ON/OFF), the yellow LED will blink every-time motion is detected.

Initially I tried to write my own code from scratch, but due to the structure of the program and inexperience with setting up variables, I failed to get any output from the motion sensor. Eventually I switched to using Daragh's code at:

This got the LED blinking every time it detected motion, which was a little too often.

I modified this code using the built-in time function within particle. An additional trigOK() function, makes sure it is ok to publish the event. By setting up an additional variable trigT, to record the time of trigger using I also added the IF condition to check that motion had not already been triggered in the past 60 mins. Another IF condition checks that the current time is between 7-11 AM, Time.hour() .

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!