I'm new to electronics, so I would like to directions for building an effective proximity sensor.


  1. Must detect objects within 10-50cm.
  2. Waterproof.
  3. It may be exposed to sunlight.
  4. Distance detection a plus.
  5. Cheap. Really cheap.

Basically I'll put it on the ground, that's why it must be waterproof (rain) and may be exposed to sunlight. The object I'm trying to detect is metallic.

Are there other solutions than using IR/Ultrasonic sensors?



  • \$\begingroup\$ We need to know more about your constraints - like why you are against IR/Ultrasonic . \$\endgroup\$
    – sptrks
    Commented Apr 29, 2012 at 4:25
  • \$\begingroup\$ Because IR may not be appropriate in presence of sunlight, and I still didn't find a cheap ultrasonic sensor out there (< $3). \$\endgroup\$
    – user944275
    Commented May 7, 2012 at 6:33

5 Answers 5



enter image description here

What about this? you can then encase the whole thing in clear resin or hot glue.

  • \$\begingroup\$ I think it would be cheaper to build it by myself, any resource that can help me get started? \$\endgroup\$
    – user944275
    Commented Apr 28, 2012 at 5:12
  • \$\begingroup\$ Well, I've made a proximity sensor with an IR receiver and an emitter (LED) pointing in the same direction about 1cm apart. so when there is something in its way the receiver will generate a small voltage. The only issue is that this is for very small ranges like a few cm. youtube.com/… \$\endgroup\$
    – Shungun
    Commented Apr 28, 2012 at 11:32
  • \$\begingroup\$ @user944275 - Sharp makes these sensors in quantities numbering in the millions. It's unlikely that you can defeat those economies of scale. \$\endgroup\$ Commented Apr 30, 2012 at 1:13
  • \$\begingroup\$ #Size matters.... "The object I'm trying to detect is metallic." Is this a Car or what? It sounds like magnetic sensor is the only way. Double loop .. not cheap.. sorry.. What is it for? \$\endgroup\$ Commented May 9, 2012 at 7:43
  • \$\begingroup\$ Yes, it is a car indeed. \$\endgroup\$
    – user944275
    Commented Jun 26, 2012 at 2:17

You say that distance is a plus, i.e. not a must, which makes me think a presence sensor can be enough. So think carefully whether you need distance or simple presence; a rough distance can also be measured by putting several short-range presence detectors at known locations and then seeing which of them gets triggered.


I have used an IR LED with a barrel/tube around it + a TSOP-style receiver to detect objects up to ~ 50 cm. I never tried direct sunlight (I am in the Netherlands, we have way more clouds and rain than sunlight) but I don't think that will be a problem.

enter image description here

The picture shows the IR LED and the TSOP, looking in the same direction. I put a short piece of black shrink tube around the IR LED to prevent it from directly shining at the receiver.

When writing the code for the IR LED, don't forget that it must emit the correct frequency (often 36 or 38 kHZ, depends on your receiver), but on top of that it must be switched on / off, 1kHz will do nicely.

enter image description here

I sampled the output of the TSOP directly after an IR burst. Note: TSOPs are active low!


Have you looked at capacitive sensors ( a, b )?


If you want the sensor to detect presence/absence of the car, even when covered with water, cap-sense detectors are not for you.

If you merely want the sensor to survive power washing, and then, after the water has run off, to resume working, then perhaps a cap-sense detector could work for you. (See Mark Lee. "Build A Touch-Sensor Solution For Wet Environments". Electronic Design 2008. a for tips on building a cap-sense detector with a 3-way "presence", "absence", and "covered with water so I can't tell if there is presence or absence" output).

detect objects within 10-50cm

In theory, this should be easy with large enough cap-sense plates.

It may be exposed to sunlight.

Capacitive sensors are immune to sunlight.

Cheap. Really cheap.

Capacitive touch sensors can be surprisingly low-cost.

As you can see from "Two-element capacitive touch sensor" ( c ), a few spare I/O pins on a microprocessor, a few resistors, and some plates of metal, are all that are required to make a capacitive touch sensor.

Other articles show how the capacitive touch sensor continues to work even when completely sealed inside a water-tight plastic case.


If you are trying to detect a car at 50cm I would suggest a magnetic field and loop. The principle of operation is inducing eddy currents into the body of the car with an operating frequency of something like 50kHz. The eddy currents alter the magnetic field and this can be detected directly on the coil. It's basically a metal detector with no sophistication. I'd consider a loop of about 10 turns on a diameter of about 30cm. The loop would be part of an oscillator circuit and the eddy currents taken by the car chassis will cause the frequency to change a few Hz. If you have a fixed oscillator and the coil oscillator you can create a "beat" frequency that is detected. There are plenty of ideas on the net about this type of metal detector and as for "cheap", only you can decide that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.