My latest sensor experiments involved the PIR Motion Sensor (HC-SR501) that comes with the Photon Maker Kit. The motion sensor didn’t have the best English documentation, however there were enough translations and fragments out on Internet to get the job done.
I decided to interface the motion sensor with a Photon, and then feed the sensor output to a UWA through the Particle Cloud by using a Particle Event Stream.
The sensor has two potentiometers on its PCB. One controls the sensitivity of the sensor and the other controls the output latch delay.
Turning the sensitivity down essentially limits the range of the device. This setting is useful in limiting false alarms depending upon the sensor environment. The output latch delay is used to delay the output going low after being triggered high from motion being detected. For me, I’d rather keep this setting as low as possible so I can take care of any latching function in software.
Software
The UWA I wrote for this project connects to a Particle Event Stream from the targeted Photon, which you can download below. I’ve played with Particle Event Streams in my previous post about the Useless Machine. The value that the Photon is sending via the stream is an ADC value between 0 and 4096. Anything above 2048 is interpreted as a motion present value; anything below is no motion. When no motion is detected the UWA shows the user a green “Clear” indicator. When motion is detected the UWA shows the user a red “Motion” indicator. That’s it, nothing fancy. You can see a quick video of the project working below.
Comments