# Distance sensor from 38kHz receiver

How to build one.
AttachmentSize
graafik.png13.33 KB

It is possible to build ir distance sensor from 38kHz sensor. You need the sensor and IR led. Sensor's output goes to input pin and IR led's one leg goes to output leg so your controller is able to flicker it.

If the LED pulses at 38kHz (and 1kHz too if just pure 38kHz doesn't work) then the sensor is able to detect LED about 10 meters avay. If you mount them side by side then sensor sees things what are closer than some X range (lets say, 2m) and if there is no things closer then sensor sees nothing. Sounds pretty useless.. But now, lets look at the following graph:

Bingo. So if robot sees something when using 38kHz modulation then robot can increase modulation frequency until it sees nothing. Then it is possible to calculate(look up from table) distance by modulation frequency.

This sounds like something very complicated. But it doesn't have to be. It is possible to use just one modulation frequency. Then it is possible to say if there is an object closer than 20 cm or some other random distance.

And, the width of beam equals led's beam width. More than one sensor can be used but then they should be in shrinktubes or something so random ir light from other sensors couldn't shine at/in them.

## Comment viewing options

I'm trying to build this project but there is some isues i wanna ask about

The picture contained the table of freq Vs Distance at the top of the page seems to be no longer available

can anyone tell me from where i could get it ?

I have another question

if the IR sensor (i'm using 1838) does not detect any ir signal unless it is 38Khz

how would it detect any other freq??

The freq/distance diagram comes from the data sheet of the receiver module. Different modules may have different response curves. You cannot use the diagram to calibrate your sensor as the diagram only shows the result of ideal test conditions.

I have spent the last year experimenting with IR sensors including this type. Their sensitivity is affected by the size, colour and angle of the object being detected so they can never measure distance with any real accuracy. Even if you have a white wall, it's distance as measured by the sensor will depend on the angle of the sensor relative to the wall.

This sensor can still be useful in a maze situation where all the walls are the same colour (preferably matt, not gloss finish) to determine in which direction the robot has the most room to travel.

I know that infrared has all this drawbacks but i dont need high accurcy

because i want to make a car that prevents hitting any wall...

first i wanted to use ultrasonic sensors but i couldnt find it so i decided 2 use infrared

i looked for this diagram u told me about in data sheet (TSOP 1838) didnt find it...

also i have another problem in generating variable freq cuz i'm using Atmega32 and it does not have a wide range of output frequancys

The picture contained the table of freq Vs Distance at the top of the page seems to be no longer available

can any one help me finding it??

i have another question

if the IR sensor (i'm using 1838) does not detect any ir signal unless it was 38Khz it is supposed 2 have a buildin band pass filter

how would it detect any other freq??

sorry for the 404, i am moving my site. pic is back and answers your question.

Thanks u so much for your concern and sorry for reapeating my post cuz i'm new in this site and i thought that comments should be at the bottom of the page not the top :) sorry

i still little confused about some isues like what does "relative transmission distance100%" means

related with what??

any way i'll try to build this project using atmega32 and i'll inform u with my results :)

this is my idea in order to use this device as analog distance sensor

the trick is to FM modulate 38kHz carrier with a 1kHz sawtooth signal

the result culd be a pwm signal proportional to distance (lo-pass it and  u got analogic reading)