Ultrasonic Range Finder Circuit AD605 PIC16F876
Ultrasonic distance measurement, detection circuit pic16f876 microcontroller and ad605 (Dual Low Noise Variable Gain Amplifier singlesupply) integrated circuit diagrams used are C and asm software also Resimlerdede oscilloscope’s measurement. 40kHz ultra sonic transducers used as sensors.
I2C Sonar Ultrasonic Range Finder
In many embedded systems design, it becomes necessary to have the capability of discerning the distance of boundaries or objects without physical contact. Ultrasound can be a very useful tool through which this task can be accomplished with significant accuracy.
The Ultrasonic Range finder utilizes the following primary components.
1. The Microchip PIC16F876 micro-controller
2. An Analog Devices AD605 Single-Supply Variable Gain Amplifier
3. 40KHz Ultrasonic Transducers (Transmit and Receive)
4. “Transducer Matched” ferrite core toroidal Transformer
Ultrasonic Range finder System Operation
The Ultrasonic Range Finder is triggered to return a range sample by communication via I2C interface. After receiving the PIC’s address (which is programmable), a hexadecimal 0x0d, or Carriage Return byte received will cause the module to take a range sample. After triggering a short time period should be delayed to allow the PIC to record the return signal strength for every 2 inches sound travels at room temperature.
When triggered, the PIC processor uses the PWM capability of the Capture/Compare module to generate 16 pulses of approximately 50% duty cycle to an FDV303NCT N-Channel Logic level MOSFET. The micro-controller is then set up to delay 1ms to allow the Ultrasonic Receiver to settle from the Transmitted pulse.
The FDV303NCT drives the primary coil of a t
ransformer. The transformers secondary coil is wound to match the impedance of the Ultrasonic Transducer at 40KHz providing maximum energy transfer efficiency at the Transducers resonant frequency of operation (see notes and calculations below). A ferrite core toroid from Amidon and 30 AWG polythermaleze wire were used. The transformer was coated in clear Epoxy. The primary transformer has only 2 turns and must be isolated from the power supply with a low resistance. Anything from 2 to 10ohms worked fine, a 4.32ohm resistor was chosen. A 4.7uF capacitor was placed across the
primary coil to common/ground. At 50% duty cycle or less, there’s plenty of time for the capacitor to recharge between pulses and provide the energy needed to drive the primary of the coil at full capacity.
After the damping time of 1ms is finished, the processor starts an interrupt driven time delay that is equal to the time it takes sound to travel 2 inches (travel an inch, reflect off an object, travel back an inch) at room temperature 255 times and increment a register for inches. The Receiver Transducers output is connected to an AD605 Amplifier wired for maximum adjustable gain (0dB-96.8dB). The amplifiers output is taken through a voltage doubler circuit and rectified before entering the PIC16F876’s A2D converter. Each returned pulse is averaged with the previous returned pulse to help cancel out noise and the largest pulses corresponding inches register value is recorded as the largest objects distance.
After 255 returned samples have been compar
ed, the inches value is converted from hexadecimal to BCD and ready to be read from the PIC16F876’s I2C Port.
Ultrasonic Range finder calculation and notes
Fο = 1/(2π√LC)
If the capacitance of the transducer is typically 2.4nF (or measured 2.54nF) and the resonant frequency (Fo) is 40KHz, the transducer will have a capacitive-reactance of 1566ohms. The value of the transformers secondary winding was calculated to have the same inductive reactance value of 1566ohms. L is then calculated from the inductive reactance formula XL = 2 πFoL where XL and Fo are the known values. L = 1566ohms/(2π40KHz) to give 6.23mH. The transformer’s primary coil should have only 1 or 2 turns to yield the maximum voltage gain due to the transformer turns ratio.
Amidon Ferrite Toroid
# Turns – 1000√(6.23mH/AL)
AL = 2710mH/1000 turns from the FT-50-J’s specification
# Turns = 47.97, actual # of turns used was 50 to give the closest mH value of 6.25mH. 30AWG polythermaleze wire was used to wind the transformer.
The Sonar triggering from the received I2C 0x0d byte is shown on SDA (I2C data line) and SCL (O2C clock line). Channel 2 shows the 16 pulses at 40KHz being transmitted at the gate of the FDV303 MOSFET. Channel 1 shows the rectified amplifier output at the input of the PIC’s analog to digital converter. After approximately 15ms the result is read back via the I2C port.
For more detail: Ultrasonic Range Finder Circuit AD605 PIC16F876