tomic

Member Since: April 17, 2006

Country: United States

  • Product SEN-08630 | about 5 years ago

    I’d use 10K as pullup resistor. Don’t forget, though the PIR sensor runs on +12V, the pullup should go to +5V! The pullup is on the INPUT pin, and the sensor pulls that to ground. (3.3V for 3.3V inputs, etc)
    The sensor will momentarily pull the input to ground when it thinks “something moved”. Your software will have to determine what that means.
    What I do is, use Arduino’s millisec() function to run a software timer that essentially tells me how much time has passed since someone walked by the sensor. In loop() put this code up near the top:
    if (digitalRead (SENSOR) == LOW) {
    timer= millisec();
    }
    Then when you wanna ask “has someone walked by the sensor in the last 25 seconds?” (for example) you would execute:
    if (millis() - timer < 25000L) {
    Serial.print (“Room is occupied”);
    }
    eg. “less than 25000 milliseconds since I saw an event”. That’s the basic idea anyhoo.

No public wish lists :(