# Arduino IR Signal Detector

15,289

16

3

This Instructable will show you how to use your Arduino module to detect whether a flashing IR signal is present.

This could be useful in IR tracking, where you don't want to track the brightest IR object but the one pulsing at a certain frequency.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Basic Materials/Layout

Materials
1. 10k Ohm resistor
2. IR Phototransistor
3. Hookup wire

Circuit Layout (refer to Drawing)

Simply connect the Phototransistor and Resistor in series.Connect the emitter pin of the Phototransistor (long leg) to GND and the collector pin (short leg) to the resistor which we will connect to the 5v pin of the Arduino.

Analog pin 0 needs to read the voltage drop across the Phototransistor so connect the A0 pin to the Phototransistor's collector pin.

## Step 2: Code

The Arduino Code takes 100 readings from the IR Phototransistor (reading taken aprox every 100uS) and using this, determines whether this signal contains the set frequency.

The code Flash_det is the signal detecting code which will detect a pulsing IR signal of about 200Hz (which can be produced with the flashing_ir code).

The frequency at which the Flash_det will detect at is set by changing the distance between two pulses (in the Flash_det code this is 48)

if(t>t2){

Val=t-t2-48; // change here

}//end if

else{

Val=t2-t-48; // and here

}//end else

If you wish to change the IR frequency that the Arduino will detect un-comment the printing out code and use it to determine the average distance between pulses (see graph). If you change the frequency too much you will also have to change the sampling rate - set by - delayMicroseconds(1);

The "Signal" function is where the detecting occurs, this will return the lowest value of the array (the signal strength of the IR source) which will be positive or negative depending on whether or not the set frequency was detected - negative if signal is detected.

Flash_det will finally print out the returned value.

-Note the Flash_det code could be modified to detect the frequency of the most prominent IR source as well as it's strength.

Participated in the
Sensors Contest

## Recommendations

• ### Internet of Things Class

21,622 Enrolled

## 3 Discussions

Great stuff, Thanks for sharing this valuable info, I am trying to reproduce your project, but having a hard time to change the frequency, could you give me two more examples on how to change the frequency on both receive and transmit end, like 400 and 800Hz . Thanks in advance

It can still detect the signal with some low frequency background noise (or low level high frequency) but all it will tell you about the signal, when detected, is its strength