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_Arduino


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:

Oscope


UTILISATION


By default the pir pin is 23 on the i01.left Arduino. 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

Comments 13

  1. Hello,

    I am trying to get the pir sensor to work but I keep getting this error upon startup “Arduino COM8 OK
    The Arduino choosen does not exist, plese check pir”

    I have verified that the sensor is working properly on a bread board. This is the text in the config file
    [MAIN]
    isPirActivated=True

    ;witch arduino control pir :
    PirControlerArduino=Right
    PirPin=23
    PlayCurstomSoundIfDetection=True

    PirPin=23 was already set so I did not change it. I am using the new blue nervo boards and have the sensor plugged into the PIR pins on the board.

    Any and all help is greatly appreciated!

    • I think you might not have set the Arduino COM port in service_6_Arduino.config.
      In the PIR config you set to connect to the RIGHT arduino:
      PirControlerArduino=Right

      Do you have a Arduino connected for the right side in the service_6_Arduino.config?

      • Thank you for the quick response. I do have the right side set for COM8 in the arduino.config. I was trying to use just the pir sensor so that’s all I had hooked up. I just tried again but with the right hand attached. I was still getting “The Arduino choosen does not exist, plese check pir” but the right hand was functioning properly.

        Is there any info that I could provide that may help?

        • Could you try the same set up but using the Full arduino in the configs?
          I have never tried it with only the right side, and I am about to take off for Bruxelles.
          The Full configuration works for sure, because I use it all the time.

          • Got the same message when config set to full. I get the same message for the NeoPixel as well when I run it through a slave but works just fine when set for standalone nano through USB.

            Does the aref need to be set in the sketch for the pir as well or just the finger sensors?

            I’m in no rush, still waiting on servos to attach the arms to the torso!

  2. I have adjusted HumanPresenceTimeout=300000 all the way down to 5000 and it still takes 5 minutes to come into sleep mode. I believe I adjusted the Delay Time Adj on the sensor to about 30sec. Is there another setting I am missing?

      • I just tried 150000 same result. Sleep mode activated after 5min 15sec no matter what HumanPresenceTimeout is set to. I even tried 0.

        I also double checked the DealyTimeAdjust pot on the PIR board and it is set for just a few seconds. I tested by pulling it out and hooking up to stand alone arduino with pir monitoring script.

        I am sure its reading my service_C_Pir.config because I have the PIR on the left servo and it does sleep and does wake up with warm body presence.

        I also tried to bring up oscope in swingGui but I can’t seem to get any activity on D23.

        So I am not ruling out a brain fart and that I am missing something very simple. Any ideas would be appreciated.

        Here is a copy and paste of my service_C_Pir.config:
        ;—————————– PIR CONFIGURATION —————————————-
        [MAIN]
        isPirActivated=True

        ;which arduino control pir :
        PirControlerArduino=left
        PirPin=23
        PlayCurstomSoundIfDetection=True

        ;5 minutes after presence detected

        [TWEAK]
        HumanPresenceTimeout=150000
        ;———————————– END ————————————————–

        • Hello,
          In Manticore version 2693.16, the PIR config doesn’t contain:
          [TWEAK]
          HumanPresenceTimeout=300000
          You must have mixed an old config file.
          You need to modify the timeOut in the inmoovLife.config
          Line:
          [SLEEPMODE]
          Activated=True
          UsePirToWakeUp=True
          UsePirToActivateTracking=False

          ;Sleep 5 minutes after last presence detected
          SleepTimeout=150000

Leave a Reply