distance measuring sensor
i bought a pair module of ultrasonic sensors.
it works on 40khz frequency
each module has two pins.
can u tell me functioning of these pins.and how cud i generate a source of 40khz for it
[ Edited Wed Sep 03 2008, 03:27 PM ]
u can generate a square wave of 40khz at any port pin using the AVR internal timer (use the PWM principle with a fixed 50% duty cycle.). Now, amplify the voltage level of the square wave according to the data sheet before feeding it to the transmitter.( if i remember correctly, the sensor can operate at more than 30V DC). this is neccesary because the range of the sound wave is dependent on the energy u transfer to it which is directly proportional to the operating voltage . u can achieve it using a simple NPN power transistor.
now the principle as i explained earlier is that u have to generate a limited train of pulses at that frequency (10~20 pulses is sufficient).simultaneously, start a internal timer inside the AVR. the next step would be to stop the timer as soon as u receive the first pulse from the receiver.the timer value would be directly proportional to the total distance travelled by the wave.
Ultrasonic Transmitter is based on a 4011 quad 2-input NAND gate. Two of the gates, IC1a and IC1b, are used as a conventional CMOS Astable circuit whose oscillation frequency is set by capacitor C1, resistors R6 and R7, plus preset VR2, which adjusts the frequency. Gates IC1c and IC1d buffer the outputs from IC1a and IC1b and drive the ultrasonic transmitter transducer, X1, in push-pull mode.
In the Receiver circuit, ultrasonic echo signal is received by transducer X2. It is first amplified by the 2-stage amplifier based on transistors TR1 and TR2. The output from TR2 is rectified by diode D1 and smoothed by capacitor C4. The result is a voltage level at inverting terminal of IC2 which varies between 1·4V and 2·7V when X2 is not receiving ultrasound echoes, but falls to 1·2V when a strong enough echo from an object is detected. The rectified signal goes to op amp comparator IC2's inverting input, pin 2. The signal is compared with a reference voltage set by preset VR3, and applied to IC2's non-inverting input, pin 3. The output at IC2 pin 6 is low when there is no echo, but swings high when an obstacle ahead of the system is detected.
note that in the receiver section, a clamping circuit is required to translate the signal level to +5V and to remove any distortions in the square pulse received .
nice ckt, if used could take a load off the uC.
the only thing required in the ckt provided by ajay would be to give the output to the internal ADC of the AVR and monitor the voltage level for a valid reflection.
[ Edited Wed Sep 03 2008, 07:01 PM ]
The circuit provided above is for obstacle detection not distance measurement. Guitar was asking how to use them, so i gave an idea.
for distance measurement, you need not to use the opamp IC, instead you can give the o/p of C4 to ADC, to measure the voltage level from 1.4 to 2.7V to measure how far the obstacle is.. for calibration you might need to work out a little.
hope u understood the concept.
they have suggested about 6 circuits for transmitter design.