# 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

argh excuxe me, yesterday nigh i was too stoned forgot about the wire :)

i have performed some test varying modulation frequancy...

the test setup is this:

emitter and receiver are parallel facing forward (black tubed)

forward is a wall at a certain distance reflecting the beam back to the receiver

i can vary the frequancy of the emitter using a pot

the outcome is:   yes, it's possible to evaluate distance using the relation between sensitivity and frequancy

in my setup i am able to get readings down to 8 cm

Did you just re-write Salvage's comment in the "I'm sick of Sharps" post?

Yeah, we got it... we all have the concept down now. Where is the prototype? Show me the money.

I thought I saw these somewhere:

"Two 38kHz IR emitters and detectors for opponent detection"

I know from experiments with my IR obstacle detectors that the colour of an object does have some effect on how much IR is reflected. This system would say that a white object is further away than a black object even though they are the same distance.
Yes. But it is cheaper and smaller alternative for Sharp sensors. And Sharp sensors doesn't work below 4.5V, these sensors work on 3.3V if neccessary. And the same sensor can be used for proximity, direction and communication. It may sound pointless for normal sized bots but for nanobots its very good.

using a color sensor in conjunction with this system. As odd said colour makes a big difference to how far out the surface or object is detected. If one knew the colour it was reflecting off then one could compensate and get a more consistent distance reading between different objects. Alas I suspect that it is not just the colour that matters but what the material is made of.

There is a very interesting read here where this guy has taken a scientific approach.

http://www.schursastrophotography.com/robotics/irproxlogic.html

i am using one of those on my critter in the terrarium in order to detect charger beacon

it seems to work fine

How do you mean work fine? can you measure the distance between the robot and the charger?

negative

this sensor is great for 0/1 detection of a ir modulated beam (am i facing the beacon or not?)

or to read reflected modulated ir to detect a wall, always in 0/1 flavour

i have done any test in order to use it for distance evaluation (sweeping current on emitter photodiode from 0 to max) but resuts was poor..