Introduction: Using IR Sensor (TCRT 5000) With Arduino and Program to Remove Noise
In this instructable, basic circuitry for TCRT 5000 IR sensor and its working is discussed. a major focus of this instructable is on making a program which enables it to remove all kind of ambiance noise. So after using this method IR sensor need not be calibrated for different ambiance condition.
If you don't want to read complete instructable then go through this video: https://youtu.be/-jA5W2S5PeE
Step 1: Working of IR Sensor:
Distance measuring is very easy using IR sensor.
A beam of IR is transmitted to target and reflected beam is captured by the photodiode.
Photodiode measures the intensity of light (here mostly IR light). IR diode does not measure intensity of just IR light but it is also sensitive to visible light.
here, Intensity of IR light recorded by photodiode represents the distance between target and sensor.
Closer the target is the higher intensity of light is recorded and reduces with increase in distance.
Step 2: Making Circuit for Sensor:
we are driving out photodiode using a basic circuit. we can also use op amp based more accurate and better method for precise measurement.
IR LED is connected with 100 Ohm of the resistor in series to digital pin of Arduino. and the photodiode is connected to 5k Ohm of the resistor in series to 5v of supply and signal is taken out from it which goes to the analog input pin of Arduino.
Step 3: Checking Circuit:
Upload this code to arduino.
Now turn ON serial plotter and move some target in front of the sensor. The plot also should move as per movement of the target displacement.
The problem with this method:
- Measurement is ambiance sensitive. any change in light can ruin measurement.
For example, if we calibrate sensor at morning can not be used for evening. And even in indoor if we turn ON - Off room light, calibration get changed.
Step 4: Sources of Noise and Solution:
there are various sources of noise like:
- IR radiation from the sun: the sun transmits a huge portion of IR radiation to earth. which captured by IR photodiode and reading is no more correct.
- Indoor lighting: IR photodiode does not capture just IR light but also senses visible light transmitted by room lights.
- Heat source: All heat source emits some sort of radiation which is captured by IR photodiode. the amount of this radiation so error depends upon temperature and size of a body.
These sources emit IR radiation, which is captured by IR Photodiodes. so the error is added to our measurement.
Ascan be shown in the third image,
If we turn ON led than photodiode measures noise+signal and if led turn Off photodiode receives just noise.
The difference in between this two values will give denoised data.
If we take two reading very fast enough denoising would get better.
attached code can be used to get pure/denoised data from the sensor.
Step 5: Testing Code for Denoising and Application
These pictures show RAW data, noise value and pure signal. you can also refer the video in which output from the sensor in presence of flashing light as well as static noise.
this approach can be used in line follower so that we do not need to calibrate sensor every time we use. it also can be used in some bots where IR sensor is used for the same advantage.
Participated in the
Arduino Contest 2016