Pyroelectric (PIR) Motion Sensor's are what you'd find in a home burglar alarm or a motion sensitive light. The module shown is the HC-SR501, and it outputs a 3.3v pulse on the output pin whenever movement is detected (some units may be open drain, or output a pulse at the operating voltage). The length of this pulse is adjustable by one of the potentiometers on the unit, being about 2 seconds long at the minimum setting, and 5 minutes or more at the maximum setting (allowing it to control motion sensing lights without external components).
The HC-SR501 draws less than 50uA when it is on, which means it'll run off a battery for ages.
Connect as follows:
HC-SR501 | Espruino |
---|---|
VCC | VBAT (5v) |
OUT | A1 |
GND | GND |
Note: any GPIO pin will do for OUT
You can then easily trigger something to happen when movement is detected:
setWatch(function() {
console.log("Movement detected");
}, A1, {repeat:true, edge:"rising"});
Specification | Value |
---|---|
Input Voltage | 4.5-20v (can work as low as 3.9v) |
Output Voltage | 0 (low), 3.3v (high) |
Current Draw | < 50uA |
These sensors are designed to run off 5v or more, and will not work reliably as they come even off of a LiPo battery (around 3.7v).
You can however easily modify them to work off of lower voltages.
IN
and 3.3v
marked on it. You can
short the two pins (in addition to the diode mentioned above) and can then power the
sensor off of your Espruino board's 3.3v supply.The sensor itself is designed to run off 3.3v internally, so even with the modifications above you won't be able to run it off something like a CR2032 (which is only 3v).
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.