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.
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
- 10k Ohm resistor
- IR Phototransistor
- 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)
Val=t-t2-48; // change here
Val=t2-t-48; // and here
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