Edited by Anthony Gallot

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

Summary :

  • ELECTRONIC
  • SETUP
  • UTILISATION

ELECTRONIC


pir nervo board inmoov


SETUP


Open InMoov/config/C_pir.config  and setup like this :

[MAIN]
isPirActivated=1

;whitch arduino control pir :
PirControlerArduino=right

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

To check if the PIR is worky, you can use a multimeter between gnd and signal pins or use input oscope from webgui too.

MRL oscope view:


UTILISATION


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

File InMoov/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 InMoov/life/sleepMode.py

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

Leave a Reply