IR rangefinder (GP2D12) question
Ok, so I have a GP2D12 here and it works just like it should, outputting a higher voltage the closer the distance.
What I've done is have the BS2 convert that voltage to a frequency (via the ADC) and then output the frequency to a digital potentiometer to control the brightness of an LED.
Seems redundant, right? well sort of, and thats what my question is about. The reason I have to do it this way is:
1) because the voltage needs to be lower the closer the distance is (not higher like normal)
2) because the voltage needs to be 0 when the distance is closer than 20cm, and it needs to stay where it is when the distance is greater than 70cm.
In other words, if someone put there hand 30cm away, the voltage should be low (like 0.25v or so) as they move it closer, it will get dimmer, until it reaches <20cm, when the voltage goes to 0.
Also, if someone put there hand at 50cm, the voltage should be somewhere around 1.5v. slowly moving it up would increase the voltage, but if they took their hand away at 50cm, the voltage would remain 1.5v until someone put their hand back within range of the sensor (between 20 and 70 cm).
The BS2 is handling this just fine, but the problem I have is that it seem quite complex for such a simple task, and I'd rather not go from analog to digital then back to analog again. It would be nice if there was a way to stay analog the entire time.
Does anyone know how I could do this without a micro controller at all?
Thanks!
What I've done is have the BS2 convert that voltage to a frequency (via the ADC) and then output the frequency to a digital potentiometer to control the brightness of an LED.
Seems redundant, right? well sort of, and thats what my question is about. The reason I have to do it this way is:
1) because the voltage needs to be lower the closer the distance is (not higher like normal)
2) because the voltage needs to be 0 when the distance is closer than 20cm, and it needs to stay where it is when the distance is greater than 70cm.
In other words, if someone put there hand 30cm away, the voltage should be low (like 0.25v or so) as they move it closer, it will get dimmer, until it reaches <20cm, when the voltage goes to 0.
Also, if someone put there hand at 50cm, the voltage should be somewhere around 1.5v. slowly moving it up would increase the voltage, but if they took their hand away at 50cm, the voltage would remain 1.5v until someone put their hand back within range of the sensor (between 20 and 70 cm).
The BS2 is handling this just fine, but the problem I have is that it seem quite complex for such a simple task, and I'd rather not go from analog to digital then back to analog again. It would be nice if there was a way to stay analog the entire time.
Does anyone know how I could do this without a micro controller at all?
Thanks!
Comments
Please verify that you connected it as in the attached drawing.
Given that, I have attached a schematic that will result in varying brightness of the LED as you want (0V, bright; +5V dim) and you should still be able to have the output voltage available for whatever.· I have verified the·operation of the circuit.·
Unfortunately, without some very complicated circuit, the second requirement probably won't be possible unless I use a microcontroller and a digital potentiometer. I was thinking of using a 1381 voltage trigger or something, but I can't think of a way to keep the voltage where it was when the distance jumps to >70cm.
I'm thinking op-amp/s:
Post Edited (Whelzorn) : 12/31/2006 1:55:02 AM GMT
Just brain-storming.
·