Introduction
Author: Cristian Cristea, Microchip Technology Inc. |
This application note describes how an ultrasonic range detector can be built using the Core Independent Peripherals (CIP) available on the PIC18-Q71 device family. The featured peripherals on this device family enable the ultrasonic range detection circuit to measure and compute the distance traveled by the ultrasonic signal while using minimal resources from the Central Processing Unit (CPU).
The focus of the application is making use of two ultrasonic transducers: one as a transmitter and the other as a receiver. The transmitter emits an ultrasonic signal, while the receiver captures the reflected pulse. Two alternating Pulse-Width Modulation (PWM) signals drive the transmitter to create the required sent pulse, while a Peak Detector and Comparator are used to acquire the reflected signal. Meanwhile, a Universal Timer (UTMR) is employed to measure the time taken for the ultrasonic sonic signal to reach its target and then the distance is calculated based on the speed of sound.
The accuracy and precision of the measurements are dependent upon the shape and structure of the target object. Objects that are flat, large, or parallel to the ultrasonic transducers yield the most accurate responses, while small, curved, or tilted objects will provide a weak echo response due to wave scattering. Furthermore, environmental conditions such as temperature and humidity or airborne debris such as rain, snow, or dust may also alter the measurements taken.
- PIC18F56Q71 microcontroller
- Microchip Curiosity Nano Base for Click boards™
- MikroElektronika PROTO Click accessory board
- 2× Ultrasonic Transducers
- 2× 10 nF Capacitor