View Full Version : Ir sensor ambient light protection

11-04-2008, 01:47 AM
Hi all,

I am currently working on Ir sensors to be used for ranging in micromouse.
I'm trying out different methods for getting a good detectable range and also to get max ambient light protection.

I just built a simple Ir rx-tx sensor pair and the range i got was of 10-12cm which is sufficient for my purpose.

So now the thing left is ambient light protection.

Though i can understand that all possible precautions are taken by the organizers of the event to reduce as much ambient light interference as possible but still i want the sensors to work even in heavily lit conditions so that it is robust.

I just found this interesting link:
the guy here has really done a good job his sensors work even in direct sunlight!!!?? amazing...
but i could not decipher wat actually to do and how can i customize it's hardware to suite my hardware(AtMega32+ir rx-tx).
It would be nice if ppl read the link and come up with more explanation.

Another idea that i will try to implement is to modulate the ir.
No im not using tsop1738 or anything of that sort.
It's simple and all must have thought about it...
Process is:
1. take sensor reading with ir led turned off(let it be R1)
2. take sensor reading with ir led turned on(let it be R2)
3. ur actual reading that will never vary in any light conditions(theoretically) will be
bottomline: just subtract the ambient light from the sensor reading every time.

Now how i thought of implementing it is:
to use internal timer of m32 to generate the on-off-on sequence of ir led.
to use adc of m32 in single ended conversion mode.

I have some apprehensions for this approach which i would like to discuss here:
1.In single conversion mode ADC uses 13 clock cycles.
This is just for one channel. Im using all 8 channels so that means i will require 13*8+12(one empty clock) which means for adc running at 200Khz(using for 8bit resolution) it will take 580ums for one complete set of readings of all the sensors on umouse.
2.Now i have to take 2 such readings to get the actual value of the distance(R2-R1). that means i will be in effect taking 1160ums or 1.16 miliseconds!!!!
3.Now if my micromouse is running at a speed of 60cm/s this will mean that my mouse will sample distances after every .7mm!!?
At higher speed this distance will increase even more..

I want to know is this sampling rate satisfactory??
And if yes what can be the apparent problems and their solutions.

11-04-2008, 12:53 PM
ir-led-photodiode together with intelligent program works better than anything else. so dont doubt their ability.

1)ambient light cancellation using difference between ON-OFF is my favourite.... it works even in direct torch light or sunlight and can detect wall upto 20 cm (i even tested it successfully with 35cm).

2)suppose the cell size is 16cmX16cm. your mouse is 10cmX10cm. this leaves a gap of 3cm on all sides. now suppose your bot is heading towards wall. you take a sample at t=0 and distance from wall=4cm. it shows no wall. now even if you take next reading after 2-3 cm, you can save it from collison. this is extreme case. to be safe even sampling at 0.5 to 1 cm is enough. so dont worry about that.

3) problem in point 1 approach..... problem of photodiode saturation. suppose a very very strong ir source is just in front of it :P

4) ir-photodiode + ambient deduction + ir-led modulation pulse from timer?????? have you given this approach a try???? i doubt it......

11-05-2008, 03:29 AM
yea i doubt it too.. its too much and too good to be true in such small package.!!
but im trying it out right now and will certainly post results here.

11-05-2008, 07:10 AM
:wink: ....use an umbrella...... :lol:

11-05-2008, 10:13 AM
no, nothing wrong with theory..... its working good in practical..... i wanted to bring your attention to modulation using timer..... you are mixing two things... modulation at 38khz is need of tsops not photodiode....
suppose you are turning ir-led ON/OFF at any fixed frequency using timer. so now until you write a code to check current stuatus of timer how would you know that its on or off. better forget timer..... turn it on and off at your wish. this will give you more control and will consume many times less power. yesterday i tried to overdrive my ir-led this way at 10V without any resistance in between and guess what, it ranged to 50cm....
caution: dont forget to give enough time for cooling!!!!