assurance-tunnel
assurance-tunnel
assurance-tunnel
assurance-tunnel

[ANSWERED] Pir sensor query



  • Hi all

    This is not 100% an isadora question but I am looking to implement elements like this long term to minimise the touch points of gallery elements

    I amnlooking for a PIR style sensor to interact with Isadora and other programs. I wish to mimic the standard space bar push to run a scene etc and use the pir/handwave to execute the scene or similar command.

    I am guessing that someone here has done similar. My primary control computers for this will be mac mini's etc.

    Does anyone have any pointers as to the best place to secure something like this? I am looking but know I am not asking the correct question etc.

    Many thanks

    Eamon


  • Beta Platinum

    I dont know about an all in one package that can do a Spacebar when someone enters the scene. What I normally do is use a High precision PIR sensor with an Arduino board and the Keyboard library (https://www.arduino.cc/referen...)


  • Beta Platinum

    Hi @eamon ,

    Minimising touch-points is interesting in terms of a design challenge. There are a couple of things that come to mind that I have used in the past. These solutions are derived from the spatial context of each situation.

    The first is a floor pressure mat that is placed under a carpet. These are very cheap and easy to implement. The wires from the pressure mat are extended and connected to a hacked USB computer keyboard circuit and then the software responds to the keystroke. This really only provides one gesture - on the mat or off.

    The second is a depth camera. The depth camera, such as the 1st generation Kinect, is going to give you a lot of calibration control for your content based on distance/depth sensor and recognising gesture - like an arm wave. Isadora 3 now has an excellent depth sensor plugin for Mac - the OpenNI Tracker. The Kinect is quite a big unit for a gallery, however a unit like the Orbbec Astra Mini or the RealSense are much smaller units with the same or similar functionality of the Kinect.  I have used the depth camera for gesture control through a glass window out to the street, it worked effectively in that context, where the interface was back projected onto a diffusion film on the glass.

    The third is similar to what @Juriaan has already suggested a motion detector module (PIR sensor) hooked up to a micro-controller and using Isadora's Serial input.  The PIR module that I have can provide adjustable range and delay times via onboard potentiometers, however for gesture control they may not have the nuance of calibration to make it a reliable solution. It will detect motion at a certain range, pause, and detect motion in the same range again after some seconds. The pause means that the data can appear unresponsive at times. I have a Duinotech PIR module for testing and despite tweaking the Arduino code and sensor potentiometers I could not get a pause rate faster than 4 - 5 seconds. And that makes it feel unresponsive for gesture detection. If movement is continuous within its range it is good at reporting that, and if there is no longer movement within range after 3 - 4 seconds it can report that too. But it then pauses before reporting movement again. A different PIR sensor build might do a better job than this one.

    if you want to persist with the PIR sensor, here is the Arduino code I was testing with thanks to this online example:

    #define pirPin 3
    int calibrationTime = 30;
    long unsigned int lowIn;
    long unsigned int pause = 30;
    boolean lockLow = true;
    boolean takeLowTime;
    int PIRValue = 0;
    void setup(void) {
       Serial.begin(9600);
       // while the serial stream is not open, do nothing:
       while (!Serial) ;
       pinMode(pirPin, INPUT);
    }
    void loop(void) {
       PIRSensor();
    }
    void PIRSensor() {
       if(digitalRead(pirPin) == HIGH) {
          if(lockLow) {
             PIRValue = 1;
             lockLow = false;
             Serial.print("PIR: ");        
             Serial.println(PIRValue);
             delay(5);
          }
          takeLowTime = true;
       }
       if(digitalRead(pirPin) == LOW) {
          if(takeLowTime){
             lowIn = millis();takeLowTime = false;
          }
          if(!lockLow && millis() - lowIn > pause) {
             PIRValue = 0;
             lockLow = true;
             Serial.print("PIR: ");        
             Serial.println(PIRValue);
             delay(5);
          }
       }
    }

    and here is the 'Serial In Watcher - Text' actor internal parser string:

    "PIR: " input:string=?

    Best wishes

    Russell


  • Tech Staff

    I've been thinking about using adapted DDR pads in installations for this very reason.



  • You can use an Arduino nano as USB Midi Device: https://www.arduino.cc/en/Refe...

    with an Ultrasonic Range Finder https://www.arduino.cc/en/Tuto...

    and in Isadora the menu Scenes/Edit Go Triggers to configure the MIDI parameters:

    best

    Jean-François


  • Beta Platinum

    @jfg

    Thanks for sharing your approach. The Arduino Midi library looks like an interesting solution to explore. Do you have a sample of the ArduinoIDE code that you are using and willing to share?

    Best wishes

    Russell



  • @bonemap

    It has been a long time since I have worked with it and I cannot guarantee that it is the right file. I hope it helps, though.

    sketch_PIR_MIDI_JF.ino.zip

    PS: I used a board Teensy 3.2 for this project

    best 

    Jean-François