Updates from October, 2008 Toggle Comment Threads | Keyboard Shortcuts

  • Yury Gitman 10:11 pm on October 28, 2008 Permalink | Reply  

    Analog Sensor Average 

    Hey guys, here’s a link of an analog sensor average code from ITP’s PhyComp website
    [One Sensor Avg]

  • Yury Gitman 7:44 pm on October 28, 2008 Permalink | Reply  

    IR Proximity changes LED’s 

    LED Switch with IR Sensor from Katrina Bekessy on Vimeo.

    I tried Matt’s code and it worked well, but what you see in the video is my less sophisticated code at work which you can see here:

    int irPin = 3; // IR sensor is read from pin 3
    int irVal = 0; // hold the values read from the IR sensor

    int orngPin = 9;   // Orange LED,   connected to digital pin 9
    int bluPin = 10;  // Blue LED, connected to digital pin 10
    int grnPin = 11;  // Green LED,  connected to digital pin 11

    void setup()
      pinMode(orngPin, OUTPUT);   // sets the pins as output
      pinMode(bluPin, OUTPUT);   
      pinMode(grnPin, OUTPUT);
      Serial.begin(9600); //see what the heck my IR sensor is reading

    // Main program
    void loop()
      irVal = analogRead(irPin); 

      if (irVal>=200) //when you’re closest to the sensor
        digitalWrite(grnPin, HIGH);
        digitalWrite(bluPin, LOW);
        digitalWrite(orngPin, LOW);
      else if (irVal>= 75 && irVal<=200) //middle range of sensor
        digitalWrite(grnPin, LOW);
        digitalWrite(bluPin, HIGH);
        digitalWrite(orngPin, LOW);
      else if (irVal<75) //when you’re the furthest away
        digitalWrite(grnPin, LOW);
        digitalWrite(bluPin, LOW);
        digitalWrite(orngPin, HIGH);

  • Yury Gitman 5:59 pm on October 28, 2008 Permalink | Reply  

    recorder (volume control+fwd) 

    recorder (volume+fwd) from maze on Vimeo.






  • Yury Gitman 5:46 pm on October 28, 2008 Permalink | Reply  

    IR sensor +3 color LEDs 

    IR sensor + 3 color LEDs from maze on Vimeo.




    I didn’t use the average code, actually I didn’t know there’s an average code until Yury mentioned about it.
    Somehow my LEDs wouldn’t flicker a lot.
    So here is my code. It is quite simple.
    Basically I just change the on and off status of each LED in different ranges.


    *New Arduino hooked-up to 3 different Super-Bright LEDs.
    *Program the 3 LEDs to turn on/off individually depending on distance of hand.
    *Tzumei M. Hsiao

    // Analog pin settings
    int irIn = 3;    // the IR sensor connected to the analog pin 3

    // Digital pin settings
    int redLED = 9;   // LEDs connected to digital pins 9, 10 and 11
    int blueLED = 10;  //   (Connect cathodes to digital ground)
    int greenLED = 11; 

    // Values
    int irVal = 0;   // the variable to store the input from the IR sensor
    int redVal = 0;   // the variable to store the value of red LED
    int greenVal = 0;  // the variable to store the value of green LED
    int blueVal = 0;  // the variable to store the value of blue LED

    // Variables for comparing values between loops
    int i = 0;            // Loop counter
    int wait = (1000);    // Delay between most recent pot adjustment and output

    int sens         = 3; // Sensitivity threshold, to prevent small changes in
                          // IR sensor values from triggering false reporting
    // FLAGS
    int PRINT = 1; // Set to 1 to output values

    void setup()
      pinMode(redLED, OUTPUT);   // sets the digital pins as output
      pinMode(blueLED, OUTPUT);   
      pinMode(greenLED, OUTPUT);
      Serial.begin(9600);     // Open serial communication for reporting

    void loop()
      i += 1; // Count loop

      irVal = analogRead(irIn);  // read input pins, convert to 0-255 scale
      if (irVal < 300)//if (irVal<341)
        redVal= 255;
        greenVal= 1;
        blueVal= 1;
      }//end of if
      else if (irVal< 600)//else if (irVal< 682)
        redVal= 1;
        greenVal= 1;
        blueVal= 255;
      }//end of else if
        redVal= 1;
        greenVal= 255;
        blueVal= 1;
      }//end of else

      analogWrite(redLED, redVal);    // Send the new value to LEDs
      analogWrite(blueLED, blueVal);
      analogWrite(greenLED, greenVal);

      if (i % wait == 0)                // If enough time has passed…
        if ( irVal > sens )   // If old and new values differ
                                                      // above sensitivity threshold
          if (PRINT)                    // …and if the PRINT flag is set…
            Serial.print("The value of IR sensor: ");        // …then print the values.

            PRINT = 0;
          PRINT = 1;  // Re-set the flag   


  • Yury Gitman 5:18 pm on October 28, 2008 Permalink | Reply  

    IR sensor + 3 LEDS 

    Here’s the fine video of my IR sensor actually working!!

    Another IR sensor + 3 LEDS from Joana Kelly on Vimeo.

    I had some wacky issues connecting my IR sensor, but found a useful diagram, also including here:

    I ended up adapting Matt’s code also. My original code made the lights flicker a lot, but Matt averaged out the IR signal quite effectively. Kudos to you, sir. Matt’s code is also after the jump.

    (More …)

    • Surveillance Solutions 6:21 am on March 22, 2010 Permalink | Reply

      I’ve being researching about IR Devices and reading your blog, I found your post very helpful 🙂 . I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading.

  • Yury Gitman 1:56 pm on October 28, 2008 Permalink | Reply  

    Mid term Concept 


    For my thesis, I am looking at urban spaces and researching on how people navigate through the space and communicate within that space.

    For my midterm, I would like to make a toy which will communicate whether you are intruding its space by sound and light feedback. The data will be collected from surveying 3 different cities, New York, Madras and Amsterdam. There will be three robots made with different IR ranges depending on the results of the survey.

    This will act as a tool that expresses how physical contact, personal space and such differs according to the geographic location and culture.

  • Yury Gitman 1:33 pm on October 28, 2008 Permalink | Reply  

    3 LED IR Setup 

    3 LED IR Setup from Mouse & the Billionaire on Vimeo.

    I had some problems earlier with light flickering, but I solved this by averaging the input from the IR sensor and smoothing out the results. Works great now.

    (More …)

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc