Maker Pro
Maker Pro

Analogue Proximity Sensor

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Does anyone know of a way or a circuit to present an analogue output for the proximity of an object?

IR would be an option, but can an IR phototransistor be operated in a linear region?
I thought of using multiple IR LEDs and detectors, but the proximity to each other would cause problems.
I have seen an Ultrasonic 'Ping' sensor used in many projects, but this would require a microprocessor, and would not actually be 'analogue'.

If anyone has any ideas, it would be much appreciated.
If I can't find an analogue solution, then I will most likely need to go to a digital solution.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You don't need a microprocessor to go the ultrasonic route if you get clean reflections. You just need an oscillator to generate the tone bursts and reset a capacitor ramp, which you sample when the reflection is detected.

You can be tricky with the detection amplitude to give it a crude AGC to prevent triggering on weak reflections, but it really needs a good clear reflection to work properly in my experience.

I designed a circuit to do this many moons ago, but I've looked through my archive and I can't find it :-( But there should be designs available out there on teh interwebs.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
What distance do you consider?

An IR based sensor could generate an analog signal, but probably not a very linear one. Also the signal will depend on factors like reflectivity of the object to be sensed an environmental lighting.
A radar based sensor could be used, but the ones I've seen typically are set up for digital (threshold based) operation. It may be possible to modify such a sensor to give an analog signal.
For very short distances a capacitive sensor can be used. However, the signal will depend on the conductivity of the object to be sensed.
Although the web page for this ultrasonic sensor mentions the use of a microcontroller for measuring distance, I don't see any reason why you shouldn't be able to use this sensor in an analog setup. I imagine this setup:
  • a clock source to repeatedly trigger the emission of a sound burst (ping), e.g. as simple as a 555 timer.
  • a constant current source charging a capacitor where the capacitor is discharged by the triggger impulse for the ping-emitter
  • a track-and-hold circuit that follows the voltage on th capacitor and is triggered by the ping-receiver
The voltage on the capacitor will be reset to 0V on emission of the ping. It will then rise linearly with time due to the constant charging current. Once the ping's echo is received, the receiver triggers the track and hold and the voltage at the output is directly proportional to the time from emission of the ping to reception and therefore to proportional to distance. No microprocessor required :)

Edit: If you can live with a discontinuous output voltage, you could simply turn off the current source (instead of using a separate track-and-hold). The capacitor will hold the voltage until it is discharged for the next measurement.
 
Last edited:

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
The device in question will be using a bar graph driver... so an analogue voltage range is ideal... hopefully linear(ish)
The idea is to have LEDs light up as the person approaches the picture... (Will be wall mounted)
I would like to have it detect between roughly 3-1 feet
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
I think radar or ultrasound would be ideal for this range (just an opinion). An LM3914 will control an LED bargraph display from an analog input voltage that can be derived as Kris and I described above.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
Good job, Frenoy.

@Gryd3: If you want to build your own sensor electronics anyway, here's how it can be done:
distance_sensor-png.17213

  • The 555 generates short pulses spaced approx. 20ms apart.Each pulse discharges C3 which will then be re-charged by R6. I used a simple resistor instead of a current source. This introduces a certain non-linearity which may not be important for your project.
  • B1 is a behavioural source to model the delay of the returning ping. The ".step" and ".param" statements compute the time delay for distances of 0.1m...0.5m in increments of 0.1m. The resultinmg signal is shown as light blue pulses (output of B1).
  • Switch S1 and capacitor C4 form a primitive sample and hold circuit.
  • The red trace in the top diagram is the voltage on C3. The non-linear charge curve is clerly visible.
  • The dark blue traces show the sampled voltage which varies with distance but otherwise stays rather constant.
Note that the top diagram shows the superposition of 5 simulations, 1 for each distance. The variation can be seen in the dark blue traces only.
 

Attachments

  • distance_sensor.png
    distance_sensor.png
    239.5 KB · Views: 229
Last edited:

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Thank you all a ton!
I figured I'd be stuck with a microcontroller for this.
 
Top