Arduino IR Signal Detector

19,900

21

3

Introduction: Arduino IR Signal Detector

About: I like to make everything and anything! from electronics to food! and i'll be showing you all the things i come up with here! Twitter: @ERILtech

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.

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.

Sensors Contest

Participated in the
Sensors Contest

Be the First to Share

    Recommendations

    • Big and Small Contest

      Big and Small Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • Make It Bridge

      Make It Bridge

    3 Comments

    0
    mic980000
    mic980000

    6 years ago

    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

    0
    craftclarity
    craftclarity

    8 years ago on Introduction

    This looks like a good way to pull a signal out of background IR noise...

    0
    MrSirLRD
    MrSirLRD

    Reply 8 years ago on Introduction

    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