PDA

View Full Version : Artcile on IR distance measurement



ardhuru
- 3rd June 2010, 07:31
Hi everyone, I realize this sounds vague, with very sketchy details, so please bear with me.

Somewhere a long time ago, I'd seen an article on a technique to measure the distance to an obstacle using IR; it was to do with either pic basic or the Stamp, I just can recollect.

Basically, it described a technique wherein you use just one source, and one detector (3 pin demodulator). You begin by modulating the transmitter at its optimum frequency (38 KHz?) and keep transmitting a single character, and keep reading the pings. You then keep reducing the modulation frequency till reliable pings stop. The difference between the ideal frequency and the one at which you no more get a ping would then be a function of the distance.

No amount of Googling has yielded any success.

Does anybody remember this at all?

Would be great if someone has a copy, or a vector to this, folks.

Thanks,

Anand Dhuru

mackrackit
- 3rd June 2010, 07:37
This might be it. Good for 6 inches.
http://rentron.com/PicBasic/infrared_object_detection.htm

ardhuru
- 3rd June 2010, 07:59
Boy, that was it, and that was fast, Dave!

Thanks so much.

I thought I had pretty much most of Bruce's articles Scrapbooked in my Firefox, but somehow this one I did not.

Now to see if this range can be increased to a couple of feet. Might not be difficult since the whole environment, including the reflector can be in a tube, isolated from the ambient. Yup, thats right, my quest for the 'perfect' liquid level detector continues.

Thanks again.

Regards,

Anand

languer
- 3rd June 2010, 08:19
You may want to look at Parallax's Robotics with the Boe-Bot (student guide), chapter 8.


Chapter 8: Robot Control with Distance Detection
In Chapter 7, we used the infrared sensors to detect whether an object is in the Boe-Bot’s way without actually touching it. Wouldn’t it be nice to also know how far away the object is? This is usually a task for sonar, which sends a pulse of sound out and records how long it takes for the echo to come back. The time it takes for the echo to come back can then be used to calculate how far away the object is. There is, however, a way to accomplish distance detection with the very same circuit you used in the previous chapter.

ardhuru
- 3rd June 2010, 08:59
Perfect!

Between the 2 pointers you've given I should be able to figure out something.

Thank you so much!

Regards

Anand

Ioannis
- 3rd June 2010, 12:08
For liquids you mayuse Ultrasonics too.

Ioannis

Bruce
- 3rd June 2010, 17:23
Sonar would be a lot better option if you're trying to determine distance between the waters surface and sensor.

A really cheap option is to attach a float to a shaft, and attach the other end of the shaft to a potentiometer. Water level can be determined by an A/D reading from the pot.

ardhuru
- 3rd June 2010, 18:00
Sure, Ioannis, Bruce, sonar would be great. But I'm apprehensive about the longevity of the sensor in the damp humid ambiance this application is likely to subject the sensor to.

Actually, I'd started a thread some time back specifically to do with measuring the level of water in a container.

A lot of great suggestions got thrown in. I'm afraid this thread is turning out to be an extension of that.

I had a fair degree of success with a resistor ladder, with stainless steel screws at the nodes being exposed to water.

Also toyed with the idea of a 'smart' sensor; a pic epoxied at one end of a tube with 10 inputs dipped in the tank, sending the data serially to the control unit, and operating on phantom power.

However, if it can be improved any further, I'd love that. And hence the query on IR.

Bruce, the float driven pot might not be very convenient as the depth of different installations varies. And the mechanical jugglery involved in customizing each installation is daunting.

Till then, if anyone's interested in any specifics, just so that they dont re-invent the wheel, please feel free to ask.

Regards,

Anand

Bruce
- 3rd June 2010, 18:22
Hi Anand,

If this is for commercial application, they make sonar tank level sensors specifically designed to operate in wet environments. I mentioned this alternative since I've installed a ton of these in large water tanks for the state.

The pot + float thing I built one day for my own water tank in my sprinkler system. The float switches I had been using cost around 30-bucks each, and seem to be designed to self-destruct after about 1 year in operation...;)

My cobbled-together one has lasted 5+ years, and cost me around $3.

I've never tried reflecting IR off the waters surface, but I might have to try it some day. If it does work, I'm curious if maybe some of the Sharp IR distance measuring modules would be something to look at?

The only draw-backs I see with IR in this environment would be lens fogging or specular reflections from the water surface from ambient light.

Tobias
- 4th June 2010, 04:18
Back to the IR, I use this sensor quite often and it works great. Pretty cheap too. The output isn't linear though if it matters to you.

http://www.acroname.com/robotics/parts/R144-GP2Y0A02YK.html

ardhuru
- 4th June 2010, 06:45
The output isn't linear though if it matters to you.

http://www.acroname.com/robotics/parts/R144-GP2Y0A02YK.html

Yes, that does look promising, though I wish the range was at least a foot or two more.

I could always use a lookup table. Or, I've noticed in a lot of exponential curves the reciprocal of a reading often fits on a straight line, ready to be used in an algorithm. (I'm no mathematician, so please forgive me if this sounds absurd). Will have to confirm it is so for this sensor in Excel.

Thanks,

Anand Dhuru

Jerson
- 4th June 2010, 08:01
The Sharp IR distance sensors IIRC are meant for small distances less than a couple of feet. I had tried to work with one of these sensors and found the range to be severely limited. I found success with the PING from parallax and subsequently rolled my own PINGer using some locally available Ultrasonic sensors http://robokits.co.in/shop/index.php?main_page=product_info&cPath=11&products_id=100 I didn't get too great a range, but, straight line performance was better than 5 feet.

Regarding the doubts about sensor reliability, you do get the sealed sensors that are meant for liquid measurement applications. The site which will give you a good handle is Maxbotix. This link shows a sensor meant for such http://www.maxbotix.com/MB7067__XL-MaxSonar-WRC1.html

Ioannis
- 4th June 2010, 08:07
Bruce asked if this is a commercial product.

If yes, do not try making your own sensor. In similar cases I used the MicroflexC US sensor. A great product with 4-20mA output. Powered from the 2 lines.

http://www.hycontrol.com/level_measurement/products/ultrasonic_level.php

The other option ruce gave with the pot, wll not be very linear, though very cheap.

Ioannis

mackrackit
- 4th June 2010, 08:07
A pressure sensor at the bottom of the tank in an extra fitting. 0.43 psi/foot.

Ioannis
- 4th June 2010, 08:17
Unless the sensor is well isolated with a special cable too, this is also a good option (Classic 4-20mA too).

But in general is in my opinion, better not to immerse anything electronics in the water. Keep them out, in an controlled place.

Ioannis

mackrackit
- 4th June 2010, 08:36
Unless the sensor is well isolated with a special cable too, this is also a good option (Classic 4-20mA too).

But in general is in my opinion, better not to immerse anything electronics in the water. Keep them out, in an controlled place.

Ioannis

That is where snubbers come in handy to isolate the sensor. But a good stainless steel sensor should work with water just fine. I have used this type of thing with products ranging from a pH of 1 to 13.

Many options. What are the tank dimensions?

El_AMPo
- 28th July 2010, 10:32
Just to add a drop :),

I've built a proximity sensor from IR led + IR-VIs Phototransistor for the pic.

Really a low parts count solution and works like charm in the range of 2-30cm if you apply 2 or 3 layers of filtering.

Anyway, stay away from light reflection methods if you need an accurate linear response according to distance, or be prepared for resolution problems and lookup tables