View Full Version : Detecting at 1mm

John Bond
08-04-2006, 08:17 PM
Hi Guys

Please help.

I need to detect an object at 1mm. Signal at approximately 1mm and no signal when the object is further than about·3mm (signal at 3/64ths of an inch,·no signal at an·1/8").

1. Is anyone aware of a·sensor·to do this in moderate ambient light. The sensor should be easy to interface to a microprosessor.

2. The American LED Company (Situated in the Far East???) has a sensor BPR-105. I've bought 5 of these and they seem to work (when I use my multimeter)·but I'm not knowledgable enough to design a circuit for them. Please can someone sketch me a circuit.

Kind regards from Kwa Dukuza in South Africa

John Bond

Matt White
08-04-2006, 10:59 PM
Do you have a datasheet for the BPR-105? I can at least tell you from the diagram your probably going to need an ADC to convert the analog voltage output of the sensor into a digital signal the BASIC Stamp can process. Look at the datasheet for the ADC0831, there's tons of information on how to use these chips with the BASIC Stamp on Parallax's website.

Anyway... post us a link the datasheet for the BPR-105.


Kevin Wood
08-05-2006, 12:52 AM
How about a photoresistor?

John Bond
08-07-2006, 03:06 PM
Hi Matt and Kevin

No Datasheet for the BPR-105... The only thing I can find on the net is that single - Half page sheet. No datasheets anywhere.

Photo resistors have too much variation and aren't accurate enough... One time there's no signal at 0.8mm, the next it's signalling at 3mm. They're also badly affected by ambient light. Sensors like the BPR-105 are the answer if I can only find someone with experience. The BPR-105 switches on quite smartly over the range of 2 mm and about 1.2mm. Trouble is it works at 1.2V and doesn't drive any load.

I've tried getting it to drive an opamp and the comparitor pin on an sx28, both work though a bit intermittantly and I feel what Im doing is "Bush Mechanics". If I'm going to use the BPR-105, I'd like to build a simple circuit where this device switcher a transistor or a FET but I don't have enough electronics experience to design something like this.

Kind regards from the African Bush

John Bond

Explanation of term used
Bush Mechanics - Where you fix your old truck using some fence wire, a dime, a branch from a tree and some bubblegum.

PJ Allen
08-07-2006, 06:53 PM
That device likely doesn't output an analog voltage, but a HI/LO (switching states in response to a reflection of the IRED.)· Ideally, you should pulse the IRED at a fixed frequency and the circuitry on the detector side should be looking for this same frequency.· This eliminates 'false positive' situations which may arise from simply having the IRED full-on (as it were), but it adds a layer of complication over this simpler on = OK approach (it's freq on = OK.)

John Bond
08-07-2006, 07:51 PM
Thanks PJ - That makes sense.

It would also eliminate 50Hz light interference. Simple on the Micro side outputting a frequency to the IRLED. You know, I used a 567 Phase Lock Loop ic some years ago. maybe it's time to pull that old datasheet out. That PLL was as stable as anything. It reliably detected a signal I couldnt see on my oscilloscope because of the background noise!!!

The stupid question is "Why didn't I think of that?..."

Kind regards from Kwa Dukuza

John Bond

Peter Verkaik
08-07-2006, 10:03 PM
Here is a link to a photo interrupter howto:
There is a schematic at the bottom. You may need to change
resistor values as to comply to the BPR105 specifications.

regards peter

08-08-2006, 04:49 AM
Back when dinosaurs still walked the earth, the 'hot' item to work with was the phase locked loop, in chip form.

Forrest Mims authored several how-to books for Radio Shack which included some neat circuits with the PLL....including
a sensor that used modulated light to block ambient light effects in a source-detector type of system.

The output of the PLL is easily connected to the Stamp and is very stable as to switching points, etc.

Tom Sisk


08-08-2006, 01:03 PM
You might look at the sensors from optek.

- Stephen

John Bond
08-08-2006, 02:45 PM
Thanks guys

Peter - Thats the sort of diagram I'm looking for. I have just enough knowledge to adapt the resistor values. I'll be pulsing the IRLED. The guys engineering, judging by the photos on his web site is almost as rough as mine. It's safe to say he would make a good African bush mechanic

Tom - That old guy Forrest Mims III is amazingly versitile. See also his views on evolution!!! Thank for the lead. (I enjoy reading oddall theories)

I'll play with PLL this weekend and if it works, it'll be the way I'll go.

Stephen - A good range of sensors there. thanks

Well, things are moving along again on this project. Thank for all the help. What always amazes me is how the range of advice this forum of people comes up with always dramatically changes my project and my point of view. Even the advice that is off key or not appropriate makes me thing up alternatives.

Kind regards on this fine still winter's day Kwa Dukuza - Kingdom of the Zulus
John Bond

John R.
08-08-2006, 07:43 PM
John Bond;

You mention "detect an object" in the original post. Given the distances you describe, is there a reason you couldn't just use a mechanical "micro-switch"? I only mention this because you didn't explicity mention needing a "non-contact" or "zero force" sensor.

John R.

8 + 8 = 10

John Bond
08-08-2006, 09:35 PM
Good point John

When assembling a new car (Toyota Corolla/Camry), over 50% of all electrical failures are caused by a wiring terminal being inserted in the wrong cavity of a connector block or not being pushed down into the cavity until it "Clicks". There are test probes, similar to those used in testing of PCBs and mass produced circuits but they are very unreliable. The terminal block will accept pins up to about 2mm X 1.5 mm but not microswitches. The Japanese have done some interesting work with fibre optic sensors to check that the terminal is in the right cavity and that it has been pushed completely home. This is very encouraging but cost about US$200 a circuit and we can have upwards of 1200 circuits in a set of wiring for 1 car. Too much money for us.

There are two options, either Toyota imports the wiring from Japan or Thailand or we buy an equally expensive German machine to do the assembly job (in place of the people). either way, people loose their jobs and round here, with 40% unemployment, and 20% AIDS infection, that's tough.

Maybe there's a third option...

Living in Africa is exciting, dangerous, often depressing but never boring. Kind regards from Kwa Dukuza, the epicenter of the South African AIDS/HIV catastophy.

John Bond

Hey, rereading this post, it sounds really bad, its not. The sun still comes up in the morning.

Bruce Bates
08-08-2006, 10:06 PM
John -

Any chance of getting a look at the following (drawings or pictures, as appropriate):

unpropagated male and female connectors

propagated male or female (whichever is the "loose" wired unit)

I have a couple of thoughts for you but it depends a lot on the construction of the wiring devices, and how much room is available to you. If it works, it would be quite low cost, and rather low-tech but would probably involve a microprocessor..


Bruce Bates

<!--StartFragment -->

08-09-2006, 11:20 PM

A few more thoughts on helping you use the sensor you have......after looking closely at the sketch you posted earlier ! : }

To mitigate the effects of ambient light, drive the LED part of the sensor with a 555 timer circuit running at several Khz.

The transistor will be the input into the stamp which can use the pulsin command to see the correct frequency when the reflected light is successfully bounced from the LED to the transistor when you're within 1 mm. Outside that range, the stamp will see either no signal or will pick up a signal at some other frequency ( 50 Hz lighting for example).

You could simplify a bit more by driving the aforementioned PLL with the sensor's transistor output. Then the stamp will receive strictly a go/no-go signal.

Interesting project ....keep at it!


Tom Sisk


John Bond
08-11-2006, 03:16 PM
Hi Guys - Lots of good news!!!

Tom - your pulsing works a treat. No need for a PLL, I just used count or pulsein. both worked well. There was a good rejection of ambient. Other that direct or directly reflected sunlight or a tungsten bulb closer that 2 foot it triggers reliably. My circuit diagram is attached though I think a darlington transistor or a FET would have worked better.

Bruce - I've attached some photos. We have over 150 of these stations and they're manned (is ther a phrase such as womanned?) for two shifts a day. I have also been working on putting an SMD LED in each cavity that needs a cable and I've attached a photo of the very rough 1st prototype.

In addition, our German engineering manager has said "Dis ielektronic chit vont verk!" and has come up with an idea where we have a stack of laser cut plastic plates that block off all the holes except the one you're meant to put the cable in to (and those that already have cables). The idea sounds very good.

I haven't a clue where we're going to end up but this is all definitely do-able

Sorry about the break but I've just been up to Gauteng for two days.

Thanks again for all your help guys

John Bond