Presentation is loading. Please wait.

Presentation is loading. Please wait.

IR Object Detection living with the lab IR light from LED IR light reflected off object IR LED IR receiver Infrared (IR) light leaving an LED reflects.

Similar presentations


Presentation on theme: "IR Object Detection living with the lab IR light from LED IR light reflected off object IR LED IR receiver Infrared (IR) light leaving an LED reflects."— Presentation transcript:

1 IR Object Detection living with the lab IR light from LED IR light reflected off object IR LED IR receiver Infrared (IR) light leaving an LED reflects off an object. The reflected light travels back to an IR receiver. The IR receiver “detects” the presence of the object. The object does not need to move to be detected.

2 living with the lab 2 Panasonic PNA4602M supply voltage: 4.8V – 5.2V current: 3mA This sensor detects infrared (IR) light. However, to avoid detecting the IR component of regular sunlight or light from other stray IR sources, the sensor only looks for light coming in at 38 kHz. IR LED (not your usual LED) outputs 940 nm wavelength light We write an Arduino sketch to make this LED flash 38,000 times per second so it can be detected by the PNA4602M. The Parts

3 living with the lab 3 IR Light IR detector is most sensitive around 950 nm or 0.95(10) -6 m wikipedia.org Panasonic documentation for PNA4602M

4 living with the lab 4 Install an LED Shield It is important to install the LED in an enclosure to properly direct the IR light. Your kit includes the black pieces shown. Insert the legs of the LED through the holes in the longer black cylinder, and then install the smaller top piece over the exposed end of the LED. If you don’t have a shield, a piece of paper can be rolled up and taped around the LED. Your LED will look like this after shielding.

5 living with the lab 5 220Ω from digital output pin on Arduino LED Circuit IR Receiver Circuit Be sure to aim your LED and IR detector so that they have a clear view (nothing in the way) 5V 220Ω to digital input pin on Arduino

6 living with the lab 6 Arduino Sketch nothing is detected by IR sensor something is detected by IR sensor long freq = 38000; long period; int IR_status; void setup() { Serial.begin(9600); pinMode(2,OUTPUT); pinMode(3,INPUT); period=1000000/freq/2; // compute the half period in microseconds } void loop() { for(int i=0;i<200;i++) // detector needs lots of pulses to work (try 200) { digitalWrite(2,HIGH); // manually build a square wave for IR LED delayMicroseconds(period); digitalWrite(2,LOW); delayMicroseconds(period); IR_status = digitalRead(3); // read the status of the sensor } Serial.println(IR_status); // print the status of the sensor delay(200); }

7 living with the lab 7 Alternate Arduino Sketch try the sketch below if the one on the previous page doesn’t work void setup() { Serial.begin(9600); // allows output to display pinMode(2, OUTPUT); // define digital pin 2 as an output (output to LED) pinMode(3, INPUT); // define digital pin 3 as an input (input from sensor) } void loop() { tone(2,38000); // output a LOW HIGH LOW sequence at 38,000 Hz int IR_status= digitalRead(3); // acquire the status of the IR sensor Serial.println(IR_status); // display the status of the IR sensor delay(100); // wait 100ms between sensor queries }


Download ppt "IR Object Detection living with the lab IR light from LED IR light reflected off object IR LED IR receiver Infrared (IR) light leaving an LED reflects."

Similar presentations


Ads by Google