Skip to content

HOWTO PIR SENSOR

Anthony edited this page Mar 15, 2017 · 10 revisions

Pir sensor is a device that detect human presence.
A value is sent to arduino periodically.
Useful to wake up the robot or launch face detection/recognition. Or what you want.


ELECTRONIC


pir nervo board inmoov


SETUP


Open C_pir.config Inside services folder and setup like this :

[MAIN]
isPirActivated=1

;witch arduino control pir :
PirControlerArduino=right

[TWEAK]
;5 minutes after presence detected
HumanPresenceTimeout=300000

To check if pir worky you can use multimeter between gnd and signal pin or use input oscope from webgui too


UTILISATION


By default "sleeping" action is sent after 5 minutes of human inactivity
If the robot is sleeping and if human is detected, "wakeup" action is sent.

file services/C_pir.py :

TIMER IS RESET IF HUMAN IS DETECTED
if pins[pin].value>0:
if not RobotIsSleeping:
humanDetected()

IF ROBOT IS SLEEPING WAKUP IS CALLED if RobotIsSleeping:
sleepModeWakeUp()

file inmoovLife/sleepMode.py

SLEEP ACTION IS CALLED BY A X SECONDS TIMER
def SleepTimerRoutine(timedata):
if pirTimerStarted and not RobotIsSleeping:
sleepModeSleep()