abhilash_patel
Published © GPL3+

Using IR Sensor (TCRT 5000) With Arduino

This tutorial is on the IR sensor application. It also specifies a method to remove static and low-frequency noise.

BeginnerFull instructions provided29,775
Using IR Sensor (TCRT 5000) With Arduino

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Visuino TCRT5000
×1
Resistor 100 ohm
Resistor 100 ohm
×1
5k Ohm resistor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic for connection

Code

Remove static noise from IR sensor data

Arduino
This code Static and the low-frequency noise from sensor data.
/*
This code is to Remove ambience noise from sensor data.
IR LED connected to Digital pin: 6
IR diode connected to analog input:A3

by-Abhilash Patel
*/
int a,b,c;
void setup() 
{
Serial.begin(9600);
pinMode(6,OUTPUT);
}

void loop() {
 digitalWrite(6,HIGH);    // Turning ON LED
 delayMicroseconds(500);  //wait
 a=analogRead(A3);        //take reading from photodiode(pin A3) :noise+signal
 digitalWrite(6,LOW);     //turn Off LED
 delayMicroseconds(500);  //wait
 b=analogRead(A3);        // again take reading from photodiode :noise
c=a-b;                    //taking differnce:[ (noise+signal)-(noise)] just signal

//Serial.print(a);         //noise+signal
//Serial.print("\t");
//Serial.print(b);         //noise
//Serial.print("\t");
Serial.println(c);         // denoised signal
 
}

Credits

abhilash_patel

abhilash_patel

0 projects • 26 followers

Comments