Distance measure with led bar display

Status
Not open for further replies.

phantom86

New Member
I am completely ignorant when it comes to circuit design (but can build them if designed by others), so I am looking for some assitance from a kind intelligent contributor can help me along.
I will try to give detail information of requirements so I can in return get simple and clear detailed cicruit instructions and parts list. (Please)

Application:
I would like to measure distance between two objects (car entering garage)
Note, this is not a parking distance sensor, but a guide to navigate the right placement when going in between tight objects below line of sight.

Requirements:
Measure distance and display output on 10 dot LED bar graph
Cheap and simple (I will need seven of each measure/output)

Options:
Option 1:
LEDs change colour as distance decreases (This can be done by simply having four green three amber and three red, but it would be cool if they worked this way: 10 lit – all 10 green, <7 lit – all 6 amber, < 4 lit all 3 red

Option 2: Last two dots to flash when only these two are lit, but be solid when more are lit. (Combined with above option, would be optimal)

Specifications:
Accuracy: Less than +/-0.5% (Or < +/- 0.5cm for 100cm range)
Maximum Distance:
0-100cm
Adjustable setout:
0-25cm (Distance from sensor face to zero point of measurement)
Adjustable distance range:
0-10cm where each dot would be 1cm through to 0-100cm where each dot would be 10cm
Real time response (i.e. no calculated output, purely electrically activated)

I hope someone can help me out, I would appreciate any assistance at all.
 
The simplest way to do it would be with a microcontroller and some ultrasonic transducers. You could then have the distance displayed in digits just as easily. This would require the use of a compiler and programmer though, which you can make/download very cheaply. Otherwise, heres a circuit that looks similar to what you need:


http://www.geocities.com/CapeCanaveral/Launchpad/3632/sonar.htm
 
Distance measure with led bar display - use microcontroller

Thanks for that, I have never programmed a microcontroller before and wouldnt know where to start, but I think this might be a good time to learn.
I can get a PIC16F84A programming testbed. Would this be a good PIC to use for this app?
I will need some clues as to I/O basic circuits, but I will do some further research first and ask any specific questions later.
On the sesenors, the Sharp GP2xxxx range seem popular, but expensive. Is there something that might be a little cheaper but still give me an analog signal proportional to distance?
Thanks for the previous suggestions, I must say this looks like a really good forum and is very responsive.
 
Those requirements you specified are very stringent. I know of nothing less than $2000 that will pull that off. 0.5cm accuracy is pretty darn accurate at a range of 1m and sensors that can measure 30cm or more have a deadzone of 3+ cm. The only sensors I know of that measure with a deadzone of 1mm are sensors that only see 2 cm in front of them are less for close-object examination.

I cant think of a cheaper than the Sharp IR sensor that will give you ranging information...they seem amazingly cheap to me. hehe. any cheaper and itsnothing but an LED and photodetector to tell you if something is too close or not. Those sharp IR sensors don't have nearly the accuracy you are looking for...i believe I read somewhere that for the long range version its +/- 10 cm accuracy. And the long range verison (1.8m max) has a deadzone of 20cm I believe. The other version is 30cm maximum and has a deadzone of 3cm I believe...but the accuracy is nowhere near what you specified.

A Devantech sonar sensor would be your best bet. Accuracy of 3-4cm and "usually it does much better, but we won't state the accuracy any better than this due to environmental factors". It also has a deadzone of 3-4cm . But if its used in a garage or outside, temperature and wind eddy currents in the corners and stuff might affect the accuracy. The Devantech SRF08 (multi-echo receive w/ an additional light sensor) and the SRF10 (miniature SRF10 that only receives a single echo, no light sensor) are ~$50. They both have onboard timing and stuff like that so your chip doesnt have to do the timing. You need to use an I2C-protocal serial connection to ask the sensor what was the distance measured.

There is another SRF05 which doesn't have onboard timing or anything. Just the drive circuitry for the transmitter and receiver- your microcontroller would have to do the timing. It's about ~$25.

If you use a microcontroller you can get the LEDs to flash or dance however you want. And if you pick a microcontroller that can supply more than a few mA per pin, then you can drive the LED directly with the microcontroller pin (without using transistor switches to amplify the current). 25mA is the maximum I have heard of. This is the total for all pins at any one time. Its enough to drive several LEDs at a time.

If you decide I can whip up a quick and dirty (untested) circuit for you. I am also curious...where is the sensor going to be and where is the readout going to be? I am imagining some very long wires here that would cause problems.
 
Last edited:
Thanks for the detailed reply, it is very useful information. I am pretty relaxed about the accuracy side of it, I had simply figured +/-0.5% (effectively giving 1%) was reasonable, but that's OK if not. I also agree that the sensor technology is very cool, and for what you get it is "cheap". However I also figured to do it this way would require a number of these little devices and I can get a CMOS camera for not much more and then just monitor the "out of sight" objects that way. That could also eliminate the wire issue you rightly pointed out. Hmm, wires suck dont they.
Anyway, I may persist with at least one of these anyway, just for the "fun" of learning how to program a PIC and if I do I may very well take you up on your Q&D circuit offer if that's OK.
Again thanks for providing such a detailed response it is very helpful.
 
its fine. I just figure drawing a picture out would be easier than explaining it. hehe...can't help you with the code though...
 
I made a circuit not too disimilar to what u have described although it does not have the range, i calibrated mine to about 30cm, although mine was designed to be a parking sensor, i am sure it could be adapted to give longer range, if you would like a copy of my notes, which contain circuit diagrams and photos, drop me an e-mail: olivergw@gmail.com
 
If you're looking to learn PIC Programming, I can recommend the development board and tutorial CDROMs by **broken link removed**. They specialise in "teach yourself Electronics" CDROMs and development packages, and I can personally vouch for their PIC Micro course because it's what I used when I was learning to program them! Luckily for me I already had experience with microprocessors so I had a head start, but the course really does start at the beginning so you'd be fine. You can buy CDROMs compatible with the development board for Assembly, C and I think Flowchart. I can vouch for the first two (I've got them) but I've never tried Flowchart programming.

If you're hoping to use that many displays you're going to need to learn your programming because you'll want to multiplex them in software. Another tip I can offer is regarding the CMOS cameras you mentioned. I had a similar idea not so long ago and hooked up a CMOS camera to the rear of my Land Rover to aid me in reversing up to our caravan so that I could get the tow ball alignment right on my own. I wired the CMOS camera into my in-car DVD system but I found later that the displayed image was the wrong way around horizontally! It seems blatently obvious to me now that this would happen, because the camera is facing towards the rear and you're facing towards the front, but at the time it didn't occur to me. It didn't really matter for my application but it looked very confusing when cars appeared to overtake you on the wrong side of the road!!!
You can get around this by using special cameras which have the image horizontally inverted so that it displays properly on your monitor - they're specifically for parking cameras. Be careful though because CMOS cameras are rubbish in dim-light conditions... such as your garage will be!

dknguyen:

I'm suprised at the lack of accuracy with those distance detection sensors you mention. I've never personally used sensors for detecting distance so I don't have experience with their accuracy, but I'd have guessed them to be more accurate than that. Afterall, all you're doing (on a basic level) is sending out a sound and listening for it's echo. We can measure the speed of sound very accurately, so I'd expect to be able to derive the measured distance fairly accurately too. I am suprised at that!
Also, I wouldn't have expected distance of the wires to be such a problem either. If the ultrasonic sensor only supplies a small signal then yes I can see that it's going to be affected by capacitance in the leads and things, but you could always buffer it first. The length of the wires is not going to be any more than the length of a car, and since electricity travels that distance in such a short time, I wouldn't expect it to alter the accuracy of the distance measurement by too much?

Brian
 
Last edited:
You could do it mechanicaly too if this is allowable. Either a wheel or a rod that is pushed in.
I haven't learned any real programming but the OOpic does most of the robotic kinds of stuff without (most of) the programming. This doesn't mean you don't need to learn it, just its kind of already programmed for you by using that object.

On the subject of garage parkers. My bro bought a very neat system. It uses 2 lasers but he only uses one.
When you open the garage door it turns on the laser and points straight down. You see this as a dot on your car wherever you chose to locate it, like on your dash. I don't know the name of the maker but its so simple that a laser pointer turned on remotely would do it.

http://www.oopic.com/
 
ultrasonic distance measurement doesn't work terribly well in uncontrolled environments:

https://www.electro-tech-online.com/custompdfs/2006/08/RAS1996-ONO.pdf

Skip to the last page for some example sonar ranging tests with two sensors - a narrow field sensor and a wide-field sensor. They stick the sensors on a rotating platform and plot the distances that the ultrasound measures. Note the oddball responses and the nice curvy arcs...

I work on (expensive) 3D optical tracking systems and 1% accuracy is not something that I would easily claim.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…